@kubb/agent 5.0.0-beta.3 → 5.0.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +1965 -1827
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +1 -1
- package/.output/server/index.mjs +1 -1
- package/.output/server/node_modules/ajv/dist/2019.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/2019.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/2020.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/2020.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/ajv.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/ajv.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/index.d.ts +2 -1
- package/.output/server/node_modules/ajv/dist/compile/index.js +10 -3
- package/.output/server/node_modules/ajv/dist/compile/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/names.d.ts +1 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js +1 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/validate/index.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js +18 -4
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/core.d.ts +4 -0
- package/.output/server/node_modules/ajv/dist/core.js +15 -1
- package/.output/server/node_modules/ajv/dist/core.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/draft4.d.ts +19 -0
- package/.output/server/node_modules/ajv/dist/draft4.js +57 -0
- package/.output/server/node_modules/ajv/dist/draft4.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/ajv/dist/types/index.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +2 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js +2 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/code.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js +10 -3
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js +12 -2
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js +56 -21
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js +29 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js +10 -2
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js +26 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +22 -3
- package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.d.ts +12 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js +43 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js +19 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js +4 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js +20 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js +8 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js +20 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js.map +1 -0
- package/.output/server/node_modules/ajv/lib/2019.ts +1 -0
- package/.output/server/node_modules/ajv/lib/2020.ts +1 -0
- package/.output/server/node_modules/ajv/lib/ajv.ts +1 -0
- package/.output/server/node_modules/ajv/lib/compile/index.ts +16 -3
- package/.output/server/node_modules/ajv/lib/compile/jtd/parse.ts +3 -1
- package/.output/server/node_modules/ajv/lib/compile/jtd/serialize.ts +3 -1
- package/.output/server/node_modules/ajv/lib/compile/names.ts +1 -0
- package/.output/server/node_modules/ajv/lib/compile/validate/index.ts +21 -4
- package/.output/server/node_modules/ajv/lib/core.ts +20 -1
- package/.output/server/node_modules/ajv/lib/draft4.ts +79 -0
- package/.output/server/node_modules/ajv/lib/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/ajv/lib/types/index.ts +4 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +2 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +1 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/properties.ts +4 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/code.ts +10 -3
- package/.output/server/node_modules/ajv/lib/vocabularies/core/ref.ts +21 -5
- package/.output/server/node_modules/ajv/lib/vocabularies/discriminator/index.ts +69 -19
- package/.output/server/node_modules/ajv/lib/vocabularies/draft4.ts +32 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/metadata.ts +10 -2
- package/.output/server/node_modules/ajv/lib/vocabularies/oasContext.ts +27 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +29 -7
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumber.ts +75 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumberExclusive.ts +26 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/index.ts +4 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/readOnly.ts +23 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/required.ts +7 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/writeOnly.ts +22 -0
- package/.output/server/node_modules/ajv/package.json +9 -6
- package/.output/server/node_modules/fflate/esm/index.mjs +87 -56
- package/.output/server/node_modules/fflate/package.json +12 -11
- package/.output/server/node_modules/jiti/LICENSE +21 -0
- package/.output/server/node_modules/jiti/README.md +258 -0
- package/.output/server/node_modules/jiti/dist/babel.cjs +257 -0
- package/.output/server/node_modules/jiti/dist/jiti.cjs +1 -0
- package/.output/server/node_modules/jiti/lib/jiti-cli.mjs +34 -0
- package/.output/server/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
- package/.output/server/node_modules/jiti/lib/jiti-native.mjs +121 -0
- package/.output/server/node_modules/jiti/lib/jiti-register.d.mts +1 -0
- package/.output/server/node_modules/jiti/lib/jiti-register.mjs +4 -0
- package/.output/server/node_modules/jiti/lib/jiti-static.mjs +23 -0
- package/.output/server/node_modules/jiti/lib/jiti.cjs +30 -0
- package/.output/server/node_modules/jiti/lib/jiti.d.cts +8 -0
- package/.output/server/node_modules/jiti/lib/jiti.d.mts +8 -0
- package/.output/server/node_modules/jiti/lib/jiti.mjs +29 -0
- package/.output/server/node_modules/jiti/lib/types.d.ts +420 -0
- package/.output/server/node_modules/jiti/package.json +146 -0
- package/.output/server/node_modules/remeda/dist/hasProp.js +2 -0
- package/.output/server/node_modules/remeda/dist/index.js +1 -1
- package/.output/server/node_modules/remeda/package.json +12 -12
- package/.output/server/node_modules/ws/lib/sender.js +6 -1
- package/.output/server/node_modules/ws/package.json +1 -1
- package/.output/server/package.json +5 -8
- package/README.md +62 -27
- package/package.json +15 -14
- package/.output/server/node_modules/@rolldown/binding-linux-x64-gnu/package.json +0 -40
- package/.output/server/node_modules/@rolldown/binding-linux-x64-gnu/rolldown-binding.linux-x64-gnu.node +0 -0
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js +0 -256
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.js +0 -75
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/index.js +0 -3
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/simple-filters.js +0 -70
- package/.output/server/node_modules/@rolldown/pluginutils/dist/index.js +0 -1
- package/.output/server/node_modules/@rolldown/pluginutils/dist/utils.js +0 -17
- package/.output/server/node_modules/@rolldown/pluginutils/package.json +0 -37
- package/.output/server/node_modules/rolldown/dist/index.mjs +0 -50
- package/.output/server/node_modules/rolldown/dist/parse-ast-index.mjs +0 -60
- package/.output/server/node_modules/rolldown/dist/shared/binding-BeU_1iEk.mjs +0 -582
- package/.output/server/node_modules/rolldown/dist/shared/bindingify-input-options-DbbBhzky.mjs +0 -2211
- package/.output/server/node_modules/rolldown/dist/shared/define-config-DJOr6Iwt.mjs +0 -6
- package/.output/server/node_modules/rolldown/dist/shared/error-DL-e8-oE.mjs +0 -85
- package/.output/server/node_modules/rolldown/dist/shared/logs-D80CXhvg.mjs +0 -180
- package/.output/server/node_modules/rolldown/dist/shared/misc-DJYbNKZX.mjs +0 -21
- package/.output/server/node_modules/rolldown/dist/shared/normalize-string-or-regex-CbQQ69gT.mjs +0 -66
- package/.output/server/node_modules/rolldown/dist/shared/parse-B_ZnWxLZ.mjs +0 -74
- package/.output/server/node_modules/rolldown/dist/shared/prompt-U5ajztzG.mjs +0 -847
- package/.output/server/node_modules/rolldown/dist/shared/rolldown-D3JZ9rMt.mjs +0 -40
- package/.output/server/node_modules/rolldown/dist/shared/rolldown-build-DSxL8qiP.mjs +0 -3325
- package/.output/server/node_modules/rolldown/dist/shared/watch-Bd8v9ewv.mjs +0 -374
- package/.output/server/node_modules/rolldown/package.json +0 -153
- package/.output/server/node_modules/unrun/dist/index.mjs +0 -2
- package/.output/server/node_modules/unrun/dist/src-GU5PtktT.mjs +0 -887
- package/.output/server/node_modules/unrun/package.json +0 -125
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Constructs a RegExp that matches the exact string specified.
|
|
3
|
-
*
|
|
4
|
-
* This is useful for plugin hook filters.
|
|
5
|
-
*
|
|
6
|
-
* @param str the string to match.
|
|
7
|
-
* @param flags flags for the RegExp.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* import { exactRegex } from '@rolldown/pluginutils';
|
|
12
|
-
* const plugin = {
|
|
13
|
-
* name: 'plugin',
|
|
14
|
-
* resolveId: {
|
|
15
|
-
* filter: { id: exactRegex('foo') },
|
|
16
|
-
* handler(id) {} // will only be called for `foo`
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export function exactRegex(str, flags) {
|
|
22
|
-
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Constructs a RegExp that matches a value that has the specified prefix.
|
|
26
|
-
*
|
|
27
|
-
* This is useful for plugin hook filters.
|
|
28
|
-
*
|
|
29
|
-
* @param str the string to match.
|
|
30
|
-
* @param flags flags for the RegExp.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* import { prefixRegex } from '@rolldown/pluginutils';
|
|
35
|
-
* const plugin = {
|
|
36
|
-
* name: 'plugin',
|
|
37
|
-
* resolveId: {
|
|
38
|
-
* filter: { id: prefixRegex('foo') },
|
|
39
|
-
* handler(id) {} // will only be called for IDs starting with `foo`
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export function prefixRegex(str, flags) {
|
|
45
|
-
return new RegExp(`^${escapeRegex(str)}`, flags);
|
|
46
|
-
}
|
|
47
|
-
const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
|
|
48
|
-
function escapeRegex(str) {
|
|
49
|
-
return str.replace(escapeRegexRE, '\\$&');
|
|
50
|
-
}
|
|
51
|
-
export function makeIdFiltersToMatchWithQuery(input) {
|
|
52
|
-
if (!Array.isArray(input)) {
|
|
53
|
-
return makeIdFilterToMatchWithQuery(
|
|
54
|
-
// Array.isArray cannot narrow the type
|
|
55
|
-
// https://github.com/microsoft/TypeScript/issues/17002
|
|
56
|
-
input);
|
|
57
|
-
}
|
|
58
|
-
return input.map((i) => makeIdFilterToMatchWithQuery(i));
|
|
59
|
-
}
|
|
60
|
-
function makeIdFilterToMatchWithQuery(input) {
|
|
61
|
-
if (typeof input === 'string') {
|
|
62
|
-
return `${input}{?*,}`;
|
|
63
|
-
}
|
|
64
|
-
return makeRegexIdFilterToMatchWithQuery(input);
|
|
65
|
-
}
|
|
66
|
-
function makeRegexIdFilterToMatchWithQuery(input) {
|
|
67
|
-
return new RegExp(
|
|
68
|
-
// replace `$` with `(?:\?.*)?$` (ignore `\$`)
|
|
69
|
-
input.source.replace(/(?<!\\)\$/g, '(?:\\?.*)?$'), input.flags);
|
|
70
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./filter/index.js";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const postfixRE = /[?#].*$/;
|
|
2
|
-
export function cleanUrl(url) {
|
|
3
|
-
return url.replace(postfixRE, '');
|
|
4
|
-
}
|
|
5
|
-
export function extractQueryWithoutFragment(url) {
|
|
6
|
-
const questionMarkIndex = url.indexOf('?');
|
|
7
|
-
if (questionMarkIndex === -1) {
|
|
8
|
-
return '';
|
|
9
|
-
}
|
|
10
|
-
const fragmentIndex = url.indexOf('#', questionMarkIndex); // Search for # after ?
|
|
11
|
-
if (fragmentIndex === -1) {
|
|
12
|
-
return url.substring(questionMarkIndex);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
return url.substring(questionMarkIndex, fragmentIndex);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rolldown/pluginutils",
|
|
3
|
-
"version": "1.0.0-rc.17",
|
|
4
|
-
"homepage": "https://rolldown.rs/",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/rolldown/rolldown.git",
|
|
9
|
-
"directory": "packages/pluginutils"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist"
|
|
13
|
-
],
|
|
14
|
-
"type": "module",
|
|
15
|
-
"main": "./dist/index.js",
|
|
16
|
-
"module": "./dist/index.js",
|
|
17
|
-
"types": "./dist/index.d.ts",
|
|
18
|
-
"exports": {
|
|
19
|
-
".": "./dist/index.js",
|
|
20
|
-
"./filter": "./dist/filter/index.js",
|
|
21
|
-
"./package.json": "./package.json"
|
|
22
|
-
},
|
|
23
|
-
"publishConfig": {
|
|
24
|
-
"access": "public"
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@types/picomatch": "^4.0.0",
|
|
28
|
-
"picomatch": "^4.0.2",
|
|
29
|
-
"typescript": "^6.0.0",
|
|
30
|
-
"vitest": "^4.0.15"
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsc",
|
|
34
|
-
"test": "vitest --typecheck",
|
|
35
|
-
"publint": "publint ."
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { n as __toESM, t as require_binding } from "./shared/binding-BeU_1iEk.mjs";
|
|
2
|
-
import { n as onExit, t as watch } from "./shared/watch-Bd8v9ewv.mjs";
|
|
3
|
-
import { a as RolldownMagicString, b as RUNTIME_MODULE_ID, x as VERSION } from "./shared/bindingify-input-options-DbbBhzky.mjs";
|
|
4
|
-
import { t as rolldown } from "./shared/rolldown-D3JZ9rMt.mjs";
|
|
5
|
-
import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
|
|
6
|
-
import { isMainThread } from "node:worker_threads";
|
|
7
|
-
//#region src/setup.ts
|
|
8
|
-
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
9
|
-
if (isMainThread) {
|
|
10
|
-
const subscriberGuard = (0, import_binding.initTraceSubscriber)();
|
|
11
|
-
onExit(() => {
|
|
12
|
-
subscriberGuard?.close();
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/api/build.ts
|
|
17
|
-
/**
|
|
18
|
-
* The API similar to esbuild's `build` function.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```js
|
|
22
|
-
* import { build } from 'rolldown';
|
|
23
|
-
*
|
|
24
|
-
* const result = await build({
|
|
25
|
-
* input: 'src/main.js',
|
|
26
|
-
* output: {
|
|
27
|
-
* file: 'bundle.js',
|
|
28
|
-
* },
|
|
29
|
-
* });
|
|
30
|
-
* console.log(result);
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @experimental
|
|
34
|
-
* @category Programmatic APIs
|
|
35
|
-
*/
|
|
36
|
-
async function build(options) {
|
|
37
|
-
if (Array.isArray(options)) return Promise.all(options.map((opts) => build(opts)));
|
|
38
|
-
else {
|
|
39
|
-
const { output, write = true, ...inputOptions } = options;
|
|
40
|
-
const build = await rolldown(inputOptions);
|
|
41
|
-
try {
|
|
42
|
-
if (write) return await build.write(output);
|
|
43
|
-
else return await build.generate(output);
|
|
44
|
-
} finally {
|
|
45
|
-
await build.close();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
export { RUNTIME_MODULE_ID, RolldownMagicString, VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-D80CXhvg.mjs";
|
|
2
|
-
import { n as parseSync, t as parse } from "./shared/parse-B_ZnWxLZ.mjs";
|
|
3
|
-
//#region src/parse-ast-index.ts
|
|
4
|
-
function wrap(result, filename, sourceText) {
|
|
5
|
-
if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
|
|
6
|
-
return result.program;
|
|
7
|
-
}
|
|
8
|
-
function normalizeParseError(filename, sourceText, errors) {
|
|
9
|
-
let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
10
|
-
const pos = errors[0]?.labels?.[0]?.start;
|
|
11
|
-
for (let i = 0; i < errors.length; i++) {
|
|
12
|
-
if (i >= 5) {
|
|
13
|
-
message += "\n...";
|
|
14
|
-
break;
|
|
15
|
-
}
|
|
16
|
-
const e = errors[i];
|
|
17
|
-
message += e.message + "\n" + e.labels.map((label) => {
|
|
18
|
-
const location = locate(sourceText, label.start, { offsetLine: 1 });
|
|
19
|
-
if (!location) return;
|
|
20
|
-
return getCodeFrame(sourceText, location.line, location.column);
|
|
21
|
-
}).filter(Boolean).join("\n");
|
|
22
|
-
}
|
|
23
|
-
const log = logParseError(message, filename, pos);
|
|
24
|
-
if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
|
|
25
|
-
return error(log);
|
|
26
|
-
}
|
|
27
|
-
const defaultParserOptions = {
|
|
28
|
-
lang: "js",
|
|
29
|
-
preserveParens: false
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Parse code synchronously and return the AST.
|
|
33
|
-
*
|
|
34
|
-
* This function is similar to Rollup's `parseAst` function.
|
|
35
|
-
* Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
|
|
36
|
-
*
|
|
37
|
-
* @category Utilities
|
|
38
|
-
*/
|
|
39
|
-
function parseAst(sourceText, options, filename) {
|
|
40
|
-
return wrap(parseSync(filename ?? "file.js", sourceText, {
|
|
41
|
-
...defaultParserOptions,
|
|
42
|
-
...options
|
|
43
|
-
}), filename, sourceText);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Parse code asynchronously and return the AST.
|
|
47
|
-
*
|
|
48
|
-
* This function is similar to Rollup's `parseAstAsync` function.
|
|
49
|
-
* Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
|
|
50
|
-
*
|
|
51
|
-
* @category Utilities
|
|
52
|
-
*/
|
|
53
|
-
async function parseAstAsync(sourceText, options, filename) {
|
|
54
|
-
return wrap(await parse(filename ?? "file.js", sourceText, {
|
|
55
|
-
...defaultParserOptions,
|
|
56
|
-
...options
|
|
57
|
-
}), filename, sourceText);
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
export { parseAst, parseAstAsync };
|