Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/avaPublic

Replace arrgv with args-tokenizer#3364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
TrySound wants to merge2 commits intoavajs:main
base:main
Choose a base branch
Loading
fromTrySound:args-tokenizer
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
Replace arrgv with args-tokenizer
Recently published args-tokenizer package. We use it at Webstudio forparsing cURL on paste. Used athttps://github.com/antfu-collective/bumpp.There are two benefits- published with type definitions- parser is forgiving to unclosed quotes which can be more user friendlyThe package also is esm only but used only in CLI so should not be aproblem with commonjs. Though I can add cjs support if necessary.https://github.com/TrySound/args-tokenizer
  • Loading branch information
@TrySound
TrySound committedDec 29, 2024
commit3641f1d2bc9dd13fe0db3a792e1f927d0e6498b7
8 changes: 2 additions & 6 deletionslib/node-arguments.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
import process from 'node:process';

importarrgv from 'arrgv';
import{tokenizeArgs} from 'args-tokenizer';

export default function normalizeNodeArguments(fromConf = [], fromArgv = '') {
let parsedArgv = [];
if (fromArgv !== '') {
try {
parsedArgv = arrgv(fromArgv);
} catch {
throw new Error('Could not parse `--node-arguments` value. Make sure all strings are closed and backslashes are used correctly.');
}
parsedArgv = tokenizeArgs(fromArgv);
}

return [...process.execArgv, ...fromConf, ...parsedArgv];
Expand Down
9 changes: 8 additions & 1 deletionpackage-lock.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

5 changes: 3 additions & 2 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -87,7 +87,7 @@
"acorn": "^8.13.0",
"acorn-walk": "^8.3.4",
"ansi-styles": "^6.2.1",
"arrgv": "^1.0.2",
"args-tokenizer": "^0.2.1",
"arrify": "^3.0.0",
"callsites": "^4.2.0",
"cbor": "^9.0.2",
Expand DownExpand Up@@ -151,5 +151,6 @@
},
"volta": {
"node": "22.10.0"
}
},
"packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c"
}
6 changes: 3 additions & 3 deletionstest/node-arguments/snapshots/test.js.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,11 +37,11 @@ Generated by [AVA](https://avajs.dev).
},
]

##detects incomplete --node-arguments
##forgive incomplete --node-arguments

>fails with message
>tests pass

'Could not parse `--node-arguments` value. Make sure all strings are closed and backslashes are used correctly.'
[]

## reads node arguments from config

Expand Down
Binary file modifiedtest/node-arguments/snapshots/test.js.snap
View file
Open in desktop
Binary file not shown.
6 changes: 3 additions & 3 deletionstest/node-arguments/test.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import test from '@ava/test';

import {cleanOutput,cwd, fixture} from '../helpers/exec.js';
import {cwd, fixture} from '../helpers/exec.js';

test('passed node arguments to workers', async t => {
const options = {
Expand DownExpand Up@@ -33,14 +33,14 @@ test('`filterNodeArgumentsForWorkerThreads` configuration ignored for worker pro
t.snapshot(result.stats.passed, 'tests pass');
});

test('detects incomplete --node-arguments', async t => {
test('forgive incomplete --node-arguments', async t => {
const options = {
cwd: cwd('node-arguments'),
};

const result = await t.throwsAsync(fixture(['--node-arguments="--foo=\'bar"', 'node-arguments.js'], options));

t.snapshot(cleanOutput(result.stderr), 'fails with message');
t.snapshot(result.stats.passed, 'tests pass');
});

test('reads node arguments from config', async t => {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp