@opentf/web 0.4.0 → 0.6.0
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/README.md +30 -28
- package/components/Link.jsx +43 -0
- package/core/errors.js +48 -0
- package/core/reactive.js +190 -0
- package/core/signals.js +207 -0
- package/index.js +13 -0
- package/package.json +27 -18
- package/runtime/clipboard.js +47 -0
- package/runtime/code-block.js +47 -0
- package/runtime/context.js +99 -0
- package/runtime/dom.js +368 -0
- package/runtime/error-boundary.js +109 -0
- package/runtime/events.js +17 -0
- package/runtime/hydrate.js +121 -0
- package/runtime/index.js +22 -0
- package/runtime/lifecycle.js +9 -0
- package/runtime/mount.js +49 -0
- package/runtime/portal.js +59 -0
- package/runtime/raw-html.js +33 -0
- package/runtime/router.js +392 -0
- package/server/builtins.js +16 -0
- package/server/head.js +191 -0
- package/server/index.js +8 -0
- package/server/render.js +98 -0
- package/server/ssg-runtime.js +112 -0
- package/dist/CHANGELOG.md +0 -49
- package/dist/README.md +0 -41
- package/dist/babel.config.cjs +0 -6
- package/dist/compiler/babel-plugin.cjs +0 -798
- package/dist/core/mount.js +0 -32
- package/dist/index.js +0 -7
- package/dist/node_modules/@babel/core/LICENSE +0 -22
- package/dist/node_modules/@babel/core/README.md +0 -19
- package/dist/node_modules/@babel/core/lib/config/cache-contexts.js +0 -5
- package/dist/node_modules/@babel/core/lib/config/cache-contexts.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/caching.js +0 -261
- package/dist/node_modules/@babel/core/lib/config/caching.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/config-chain.js +0 -469
- package/dist/node_modules/@babel/core/lib/config/config-chain.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/config-descriptors.js +0 -190
- package/dist/node_modules/@babel/core/lib/config/config-descriptors.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/configuration.js +0 -290
- package/dist/node_modules/@babel/core/lib/config/files/configuration.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/import.cjs +0 -6
- package/dist/node_modules/@babel/core/lib/config/files/import.cjs.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/index-browser.js +0 -58
- package/dist/node_modules/@babel/core/lib/config/files/index-browser.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/index.js +0 -78
- package/dist/node_modules/@babel/core/lib/config/files/index.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/module-types.js +0 -203
- package/dist/node_modules/@babel/core/lib/config/files/module-types.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/package.js +0 -61
- package/dist/node_modules/@babel/core/lib/config/files/package.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/plugins.js +0 -220
- package/dist/node_modules/@babel/core/lib/config/files/plugins.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/types.js +0 -5
- package/dist/node_modules/@babel/core/lib/config/files/types.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/files/utils.js +0 -36
- package/dist/node_modules/@babel/core/lib/config/files/utils.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/full.js +0 -312
- package/dist/node_modules/@babel/core/lib/config/full.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js +0 -85
- package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js +0 -23
- package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/helpers/environment.js +0 -12
- package/dist/node_modules/@babel/core/lib/config/helpers/environment.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/index.js +0 -87
- package/dist/node_modules/@babel/core/lib/config/index.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/item.js +0 -67
- package/dist/node_modules/@babel/core/lib/config/item.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/partial.js +0 -158
- package/dist/node_modules/@babel/core/lib/config/partial.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js +0 -38
- package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/plugin.js +0 -33
- package/dist/node_modules/@babel/core/lib/config/plugin.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/printer.js +0 -113
- package/dist/node_modules/@babel/core/lib/config/printer.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js +0 -41
- package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/resolve-targets.js +0 -61
- package/dist/node_modules/@babel/core/lib/config/resolve-targets.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/util.js +0 -31
- package/dist/node_modules/@babel/core/lib/config/util.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js +0 -277
- package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/validation/options.js +0 -187
- package/dist/node_modules/@babel/core/lib/config/validation/options.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/validation/plugins.js +0 -67
- package/dist/node_modules/@babel/core/lib/config/validation/plugins.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/config/validation/removed.js +0 -68
- package/dist/node_modules/@babel/core/lib/config/validation/removed.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/errors/config-error.js +0 -18
- package/dist/node_modules/@babel/core/lib/errors/config-error.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js +0 -98
- package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/gensync-utils/async.js +0 -90
- package/dist/node_modules/@babel/core/lib/gensync-utils/async.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js +0 -31
- package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js +0 -58
- package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/index.js +0 -230
- package/dist/node_modules/@babel/core/lib/index.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/parse.js +0 -45
- package/dist/node_modules/@babel/core/lib/parse.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/parser/index.js +0 -85
- package/dist/node_modules/@babel/core/lib/parser/index.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js +0 -337
- package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js +0 -144
- package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transform-ast.js +0 -48
- package/dist/node_modules/@babel/core/lib/transform-ast.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transform-file-browser.js +0 -23
- package/dist/node_modules/@babel/core/lib/transform-file-browser.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transform-file.js +0 -40
- package/dist/node_modules/@babel/core/lib/transform-file.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transform.js +0 -47
- package/dist/node_modules/@babel/core/lib/transform.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +0 -84
- package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs +0 -4
- package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/file/file.js +0 -204
- package/dist/node_modules/@babel/core/lib/transformation/file/file.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/file/generate.js +0 -84
- package/dist/node_modules/@babel/core/lib/transformation/file/generate.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js +0 -37
- package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/index.js +0 -90
- package/dist/node_modules/@babel/core/lib/transformation/index.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js +0 -127
- package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js +0 -59
- package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js +0 -48
- package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js +0 -54
- package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map +0 -1
- package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js +0 -1042
- package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map +0 -1
- package/dist/node_modules/@babel/core/package.json +0 -82
- package/dist/node_modules/@babel/core/src/config/files/index-browser.ts +0 -115
- package/dist/node_modules/@babel/core/src/config/files/index.ts +0 -30
- package/dist/node_modules/@babel/core/src/config/resolve-targets-browser.ts +0 -42
- package/dist/node_modules/@babel/core/src/config/resolve-targets.ts +0 -54
- package/dist/node_modules/@babel/core/src/transform-file-browser.ts +0 -33
- package/dist/node_modules/@babel/core/src/transform-file.ts +0 -56
- package/dist/node_modules/@babel/helper-module-imports/LICENSE +0 -22
- package/dist/node_modules/@babel/helper-module-imports/README.md +0 -19
- package/dist/node_modules/@babel/helper-module-imports/lib/import-builder.js +0 -122
- package/dist/node_modules/@babel/helper-module-imports/lib/import-builder.js.map +0 -1
- package/dist/node_modules/@babel/helper-module-imports/lib/import-injector.js +0 -304
- package/dist/node_modules/@babel/helper-module-imports/lib/import-injector.js.map +0 -1
- package/dist/node_modules/@babel/helper-module-imports/lib/index.js +0 -37
- package/dist/node_modules/@babel/helper-module-imports/lib/index.js.map +0 -1
- package/dist/node_modules/@babel/helper-module-imports/lib/is-module.js +0 -11
- package/dist/node_modules/@babel/helper-module-imports/lib/is-module.js.map +0 -1
- package/dist/node_modules/@babel/helper-module-imports/package.json +0 -28
- package/dist/node_modules/@babel/plugin-syntax-jsx/LICENSE +0 -22
- package/dist/node_modules/@babel/plugin-syntax-jsx/README.md +0 -19
- package/dist/node_modules/@babel/plugin-syntax-jsx/lib/index.js +0 -21
- package/dist/node_modules/@babel/plugin-syntax-jsx/lib/index.js.map +0 -1
- package/dist/node_modules/@babel/plugin-syntax-jsx/package.json +0 -33
- package/dist/node_modules/@preact/signals-core/CHANGELOG.md +0 -331
- package/dist/node_modules/@preact/signals-core/LICENSE +0 -21
- package/dist/node_modules/@preact/signals-core/README.md +0 -258
- package/dist/node_modules/@preact/signals-core/dist/signals-core.d.ts +0 -149
- package/dist/node_modules/@preact/signals-core/dist/signals-core.js +0 -1
- package/dist/node_modules/@preact/signals-core/dist/signals-core.js.map +0 -1
- package/dist/node_modules/@preact/signals-core/dist/signals-core.min.js +0 -1
- package/dist/node_modules/@preact/signals-core/dist/signals-core.min.js.map +0 -1
- package/dist/node_modules/@preact/signals-core/dist/signals-core.mjs +0 -1
- package/dist/node_modules/@preact/signals-core/dist/signals-core.mjs.map +0 -1
- package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js +0 -1
- package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js.map +0 -1
- package/dist/node_modules/@preact/signals-core/package.json +0 -48
- package/dist/node_modules/@preact/signals-core/src/index.ts +0 -1121
- package/dist/package.json +0 -30
- package/dist/router/Link.js +0 -73
- package/dist/router/index.js +0 -216
- package/dist/runtime/For.js +0 -16
- package/dist/runtime/dom.js +0 -73
- package/dist/runtime/lifecycle.js +0 -25
- package/dist/runtime/props.js +0 -103
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["findConfigUpwards","rootDir","findPackageData","filepath","directories","pkg","isPackage","findRelativeConfig","pkgData","envName","caller","config","ignore","findRootConfig","dirname","loadConfig","name","Error","resolveShowConfigPath","ROOT_CONFIG_FILENAMES","exports","resolvePlugin","resolvePreset","loadPlugin","loadPreset"],"sources":["../../../src/config/files/index-browser.ts"],"sourcesContent":["/* c8 ignore start */\n\nimport type { Handler } from \"gensync\";\n\nimport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types.ts\";\n\nimport type { CallerMetadata } from \"../validation/options.ts\";\n\nexport type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };\n\nexport function findConfigUpwards(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n rootDir: string,\n): string | null {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* findPackageData(filepath: string): Handler<FilePackageData> {\n return {\n filepath,\n directories: [],\n pkg: null,\n isPackage: false,\n };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRelativeConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n pkgData: FilePackageData,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler<RelativeConfig> {\n return { config: null, ignore: null };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRootConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler<ConfigFile | null> {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* loadConfig(\n name: string,\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler<ConfigFile> {\n throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);\n}\n\n// eslint-disable-next-line require-yield\nexport function* resolveShowConfigPath(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n): Handler<string | null> {\n return null;\n}\n\nexport const ROOT_CONFIG_FILENAMES: string[] = [];\n\ntype Resolved =\n | { loader: \"require\"; filepath: string }\n | { loader: \"import\"; filepath: string };\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePlugin(name: string, dirname: string): Resolved | null {\n return null;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePreset(name: string, dirname: string): Resolved | null {\n return null;\n}\n\nexport function loadPlugin(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load plugin ${name} relative to ${dirname} in a browser`,\n );\n}\n\nexport function loadPreset(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load preset ${name} relative to ${dirname} in a browser`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeO,SAASA,iBAAiBA,CAE/BC,OAAe,EACA;EACf,OAAO,IAAI;AACb;AAGO,UAAUC,eAAeA,CAACC,QAAgB,EAA4B;EAC3E,OAAO;IACLA,QAAQ;IACRC,WAAW,EAAE,EAAE;IACfC,GAAG,EAAE,IAAI;IACTC,SAAS,EAAE;EACb,CAAC;AACH;AAGO,UAAUC,kBAAkBA,CAEjCC,OAAwB,EAExBC,OAAe,EAEfC,MAAkC,EACT;EACzB,OAAO;IAAEC,MAAM,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAK,CAAC;AACvC;AAGO,UAAUC,cAAcA,CAE7BC,OAAe,EAEfL,OAAe,EAEfC,MAAkC,EACN;EAC5B,OAAO,IAAI;AACb;AAGO,UAAUK,UAAUA,CACzBC,IAAY,EACZF,OAAe,EAEfL,OAAe,EAEfC,MAAkC,EACb;EACrB,MAAM,IAAIO,KAAK,CAAC,eAAeD,IAAI,gBAAgBF,OAAO,eAAe,CAAC;AAC5E;AAGO,UAAUI,qBAAqBA,CAEpCJ,OAAe,EACS;EACxB,OAAO,IAAI;AACb;AAEO,MAAMK,qBAA+B,GAAAC,OAAA,CAAAD,qBAAA,GAAG,EAAE;AAO1C,SAASE,aAAaA,CAACL,IAAY,EAAEF,OAAe,EAAmB;EAC5E,OAAO,IAAI;AACb;AAGO,SAASQ,aAAaA,CAACN,IAAY,EAAEF,OAAe,EAAmB;EAC5E,OAAO,IAAI;AACb;AAEO,SAASS,UAAUA,CACxBP,IAAY,EACZF,OAAe,EAId;EACD,MAAM,IAAIG,KAAK,CACb,sBAAsBD,IAAI,gBAAgBF,OAAO,eACnD,CAAC;AACH;AAEO,SAASU,UAAUA,CACxBR,IAAY,EACZF,OAAe,EAId;EACD,MAAM,IAAIG,KAAK,CACb,sBAAsBD,IAAI,gBAAgBF,OAAO,eACnD,CAAC;AACH;AAAC","ignoreList":[]}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _configuration.ROOT_CONFIG_FILENAMES;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "findConfigUpwards", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _configuration.findConfigUpwards;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "findPackageData", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _package.findPackageData;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "findRelativeConfig", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _configuration.findRelativeConfig;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "findRootConfig", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _configuration.findRootConfig;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "loadConfig", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _configuration.loadConfig;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "loadPlugin", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _plugins.loadPlugin;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "loadPreset", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _plugins.loadPreset;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "resolvePlugin", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _plugins.resolvePlugin;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "resolvePreset", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _plugins.resolvePreset;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "resolveShowConfigPath", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return _configuration.resolveShowConfigPath;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
var _package = require("./package.js");
|
|
73
|
-
var _configuration = require("./configuration.js");
|
|
74
|
-
var _plugins = require("./plugins.js");
|
|
75
|
-
({});
|
|
76
|
-
0 && 0;
|
|
77
|
-
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_package","require","_configuration","_plugins"],"sources":["../../../src/config/files/index.ts"],"sourcesContent":["type indexBrowserType = typeof import(\"./index-browser\");\ntype indexType = typeof import(\"./index\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n({}) as any as indexBrowserType as indexType;\n\nexport { findPackageData } from \"./package.ts\";\n\nexport {\n findConfigUpwards,\n findRelativeConfig,\n findRootConfig,\n loadConfig,\n resolveShowConfigPath,\n ROOT_CONFIG_FILENAMES,\n} from \"./configuration.ts\";\nexport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types.ts\";\nexport {\n loadPlugin,\n loadPreset,\n resolvePlugin,\n resolvePreset,\n} from \"./plugins.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAcA,IAAAE,QAAA,GAAAF,OAAA;AAlBA,CAAC,CAAC,CAAC;AAA0C","ignoreList":[]}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = loadCodeDefault;
|
|
7
|
-
exports.supportsESM = void 0;
|
|
8
|
-
var _async = require("../../gensync-utils/async.js");
|
|
9
|
-
function _path() {
|
|
10
|
-
const data = require("path");
|
|
11
|
-
_path = function () {
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
|
-
function _url() {
|
|
17
|
-
const data = require("url");
|
|
18
|
-
_url = function () {
|
|
19
|
-
return data;
|
|
20
|
-
};
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
require("module");
|
|
24
|
-
function _semver() {
|
|
25
|
-
const data = require("semver");
|
|
26
|
-
_semver = function () {
|
|
27
|
-
return data;
|
|
28
|
-
};
|
|
29
|
-
return data;
|
|
30
|
-
}
|
|
31
|
-
function _debug() {
|
|
32
|
-
const data = require("debug");
|
|
33
|
-
_debug = function () {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js");
|
|
39
|
-
var _configError = require("../../errors/config-error.js");
|
|
40
|
-
var _transformFile = require("../../transform-file.js");
|
|
41
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
42
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
43
|
-
const debug = _debug()("babel:config:loading:files:module-types");
|
|
44
|
-
try {
|
|
45
|
-
var import_ = require("./import.cjs");
|
|
46
|
-
} catch (_unused) {}
|
|
47
|
-
const supportsESM = exports.supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2");
|
|
48
|
-
const LOADING_CJS_FILES = new Set();
|
|
49
|
-
function loadCjsDefault(filepath) {
|
|
50
|
-
if (LOADING_CJS_FILES.has(filepath)) {
|
|
51
|
-
debug("Auto-ignoring usage of config %o.", filepath);
|
|
52
|
-
return {};
|
|
53
|
-
}
|
|
54
|
-
let module;
|
|
55
|
-
try {
|
|
56
|
-
LOADING_CJS_FILES.add(filepath);
|
|
57
|
-
module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath);
|
|
58
|
-
} finally {
|
|
59
|
-
LOADING_CJS_FILES.delete(filepath);
|
|
60
|
-
}
|
|
61
|
-
return module != null && (module.__esModule || module[Symbol.toStringTag] === "Module") ? module.default || (arguments[1] ? module : undefined) : module;
|
|
62
|
-
}
|
|
63
|
-
const loadMjsFromPath = (0, _rewriteStackTrace.endHiddenCallStack)(function () {
|
|
64
|
-
var _loadMjsFromPath = _asyncToGenerator(function* (filepath) {
|
|
65
|
-
const url = (0, _url().pathToFileURL)(filepath).toString() + "?import";
|
|
66
|
-
if (!import_) {
|
|
67
|
-
throw new _configError.default("Internal error: Native ECMAScript modules aren't supported by this platform.\n", filepath);
|
|
68
|
-
}
|
|
69
|
-
return yield import_(url);
|
|
70
|
-
});
|
|
71
|
-
function loadMjsFromPath(_x) {
|
|
72
|
-
return _loadMjsFromPath.apply(this, arguments);
|
|
73
|
-
}
|
|
74
|
-
return loadMjsFromPath;
|
|
75
|
-
}());
|
|
76
|
-
const tsNotSupportedError = ext => `\
|
|
77
|
-
You are using a ${ext} config file, but Babel only supports transpiling .cts configs. Either:
|
|
78
|
-
- Use a .cts config file
|
|
79
|
-
- Update to Node.js 23.6.0, which has native TypeScript support
|
|
80
|
-
- Install tsx to transpile ${ext} files on the fly\
|
|
81
|
-
`;
|
|
82
|
-
const SUPPORTED_EXTENSIONS = {
|
|
83
|
-
".js": "unknown",
|
|
84
|
-
".mjs": "esm",
|
|
85
|
-
".cjs": "cjs",
|
|
86
|
-
".ts": "unknown",
|
|
87
|
-
".mts": "esm",
|
|
88
|
-
".cts": "cjs"
|
|
89
|
-
};
|
|
90
|
-
const asyncModules = new Set();
|
|
91
|
-
function* loadCodeDefault(filepath, loader, esmError, tlaError) {
|
|
92
|
-
let async;
|
|
93
|
-
const ext = _path().extname(filepath);
|
|
94
|
-
const isTS = ext === ".ts" || ext === ".cts" || ext === ".mts";
|
|
95
|
-
const type = SUPPORTED_EXTENSIONS[hasOwnProperty.call(SUPPORTED_EXTENSIONS, ext) ? ext : ".js"];
|
|
96
|
-
const pattern = `${loader} ${type}`;
|
|
97
|
-
switch (pattern) {
|
|
98
|
-
case "require cjs":
|
|
99
|
-
case "auto cjs":
|
|
100
|
-
if (isTS) {
|
|
101
|
-
return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));
|
|
102
|
-
} else {
|
|
103
|
-
return loadCjsDefault(filepath, arguments[2]);
|
|
104
|
-
}
|
|
105
|
-
case "auto unknown":
|
|
106
|
-
case "require unknown":
|
|
107
|
-
case "require esm":
|
|
108
|
-
try {
|
|
109
|
-
if (isTS) {
|
|
110
|
-
return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));
|
|
111
|
-
} else {
|
|
112
|
-
return loadCjsDefault(filepath, arguments[2]);
|
|
113
|
-
}
|
|
114
|
-
} catch (e) {
|
|
115
|
-
if (e.code === "ERR_REQUIRE_ASYNC_MODULE" || e.code === "ERR_REQUIRE_CYCLE_MODULE" && asyncModules.has(filepath)) {
|
|
116
|
-
asyncModules.add(filepath);
|
|
117
|
-
if (!(async != null ? async : async = yield* (0, _async.isAsync)())) {
|
|
118
|
-
throw new _configError.default(tlaError, filepath);
|
|
119
|
-
}
|
|
120
|
-
} else if (e.code === "ERR_REQUIRE_ESM" || type === "esm") {} else {
|
|
121
|
-
throw e;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
case "auto esm":
|
|
125
|
-
if (async != null ? async : async = yield* (0, _async.isAsync)()) {
|
|
126
|
-
const promise = isTS ? ensureTsSupport(filepath, ext, () => loadMjsFromPath(filepath)) : loadMjsFromPath(filepath);
|
|
127
|
-
return (yield* (0, _async.waitFor)(promise)).default;
|
|
128
|
-
}
|
|
129
|
-
if (isTS) {
|
|
130
|
-
throw new _configError.default(tsNotSupportedError(ext), filepath);
|
|
131
|
-
} else {
|
|
132
|
-
throw new _configError.default(esmError, filepath);
|
|
133
|
-
}
|
|
134
|
-
default:
|
|
135
|
-
throw new Error("Internal Babel error: unreachable code.");
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function ensureTsSupport(filepath, ext, callback) {
|
|
139
|
-
if (process.features.typescript || require.extensions[".ts"] || require.extensions[".cts"] || require.extensions[".mts"]) {
|
|
140
|
-
return callback();
|
|
141
|
-
}
|
|
142
|
-
if (ext !== ".cts") {
|
|
143
|
-
throw new _configError.default(tsNotSupportedError(ext), filepath);
|
|
144
|
-
}
|
|
145
|
-
const opts = {
|
|
146
|
-
babelrc: false,
|
|
147
|
-
configFile: false,
|
|
148
|
-
sourceType: "unambiguous",
|
|
149
|
-
sourceMaps: "inline",
|
|
150
|
-
sourceFileName: _path().basename(filepath),
|
|
151
|
-
presets: [[getTSPreset(filepath), Object.assign({
|
|
152
|
-
onlyRemoveTypeImports: true,
|
|
153
|
-
optimizeConstEnums: true
|
|
154
|
-
}, {
|
|
155
|
-
allowDeclareFields: true
|
|
156
|
-
})]]
|
|
157
|
-
};
|
|
158
|
-
let handler = function (m, filename) {
|
|
159
|
-
if (handler && filename.endsWith(".cts")) {
|
|
160
|
-
try {
|
|
161
|
-
return m._compile((0, _transformFile.transformFileSync)(filename, Object.assign({}, opts, {
|
|
162
|
-
filename
|
|
163
|
-
})).code, filename);
|
|
164
|
-
} catch (error) {
|
|
165
|
-
const packageJson = require("@babel/preset-typescript/package.json");
|
|
166
|
-
if (_semver().lt(packageJson.version, "7.21.4")) {
|
|
167
|
-
console.error("`.cts` configuration file failed to load, please try to update `@babel/preset-typescript`.");
|
|
168
|
-
}
|
|
169
|
-
throw error;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return require.extensions[".js"](m, filename);
|
|
173
|
-
};
|
|
174
|
-
require.extensions[ext] = handler;
|
|
175
|
-
try {
|
|
176
|
-
return callback();
|
|
177
|
-
} finally {
|
|
178
|
-
if (require.extensions[ext] === handler) delete require.extensions[ext];
|
|
179
|
-
handler = undefined;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function getTSPreset(filepath) {
|
|
183
|
-
try {
|
|
184
|
-
return require("@babel/preset-typescript");
|
|
185
|
-
} catch (error) {
|
|
186
|
-
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
|
187
|
-
let message = "You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!";
|
|
188
|
-
if (process.versions.pnp) {
|
|
189
|
-
message += `
|
|
190
|
-
If you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file:
|
|
191
|
-
|
|
192
|
-
packageExtensions:
|
|
193
|
-
\t"@babel/core@*":
|
|
194
|
-
\t\tpeerDependencies:
|
|
195
|
-
\t\t\t"@babel/preset-typescript": "*"
|
|
196
|
-
`;
|
|
197
|
-
}
|
|
198
|
-
throw new _configError.default(message, filepath);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
0 && 0;
|
|
202
|
-
|
|
203
|
-
//# sourceMappingURL=module-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_async","require","_path","data","_url","_semver","_debug","_rewriteStackTrace","_configError","_transformFile","asyncGeneratorStep","n","t","e","r","o","a","c","i","u","value","done","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","debug","buildDebug","import_","_unused","supportsESM","exports","semver","satisfies","process","versions","node","LOADING_CJS_FILES","Set","loadCjsDefault","filepath","has","module","add","endHiddenCallStack","delete","__esModule","Symbol","toStringTag","default","undefined","loadMjsFromPath","_loadMjsFromPath","url","pathToFileURL","toString","ConfigError","_x","tsNotSupportedError","ext","SUPPORTED_EXTENSIONS","asyncModules","loadCodeDefault","loader","esmError","tlaError","async","path","extname","isTS","type","hasOwnProperty","call","pattern","ensureTsSupport","code","isAsync","promise","waitFor","Error","callback","features","typescript","extensions","opts","babelrc","configFile","sourceType","sourceMaps","sourceFileName","basename","presets","getTSPreset","Object","assign","onlyRemoveTypeImports","optimizeConstEnums","allowDeclareFields","handler","m","filename","endsWith","_compile","transformFileSync","error","packageJson","lt","version","console","message","pnp"],"sources":["../../../src/config/files/module-types.ts"],"sourcesContent":["import { isAsync, waitFor } from \"../../gensync-utils/async.ts\";\nimport type { Handler } from \"gensync\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { createRequire } from \"node:module\";\nimport semver from \"semver\";\nimport buildDebug from \"debug\";\n\nimport { endHiddenCallStack } from \"../../errors/rewrite-stack-trace.ts\";\nimport ConfigError from \"../../errors/config-error.ts\";\n\nimport type { InputOptions } from \"../index.ts\";\nimport { transformFileSync } from \"../../transform-file.ts\";\n\nconst debug = buildDebug(\"babel:config:loading:files:module-types\");\n\nconst require = createRequire(import.meta.url);\n\nif (!process.env.BABEL_8_BREAKING) {\n try {\n // Old Node.js versions don't support import() syntax.\n // eslint-disable-next-line no-var\n var import_:\n | ((specifier: string | URL) => any)\n | undefined = require(\"./import.cjs\");\n } catch {}\n}\n\nexport const supportsESM = semver.satisfies(\n process.versions.node,\n // older versions, starting from 10, support the dynamic\n // import syntax but always return a rejected promise.\n \"^12.17 || >=13.2\",\n);\n\nconst LOADING_CJS_FILES = new Set();\n\nfunction loadCjsDefault(filepath: string) {\n // The `require()` call below can make this code reentrant if a require hook\n // like @babel/register has been loaded into the system. That would cause\n // Babel to attempt to compile the `.babelrc.js` file as it loads below. To\n // cover this case, we auto-ignore re-entrant config processing. ESM loaders\n // do not have this problem, because loaders do not apply to themselves.\n if (LOADING_CJS_FILES.has(filepath)) {\n debug(\"Auto-ignoring usage of config %o.\", filepath);\n return {};\n }\n\n let module;\n try {\n LOADING_CJS_FILES.add(filepath);\n module = endHiddenCallStack(require)(filepath);\n } finally {\n LOADING_CJS_FILES.delete(filepath);\n }\n\n if (process.env.BABEL_8_BREAKING) {\n return module != null &&\n (module.__esModule || module[Symbol.toStringTag] === \"Module\")\n ? module.default\n : module;\n } else {\n return module != null &&\n (module.__esModule || module[Symbol.toStringTag] === \"Module\")\n ? module.default ||\n /* fallbackToTranspiledModule */ (arguments[1] ? module : undefined)\n : module;\n }\n}\n\nconst loadMjsFromPath = endHiddenCallStack(async function loadMjsFromPath(\n filepath: string,\n) {\n // Add ?import as a workaround for https://github.com/nodejs/node/issues/55500\n const url = pathToFileURL(filepath).toString() + \"?import\";\n\n if (process.env.BABEL_8_BREAKING) {\n return await import(url);\n } else {\n if (!import_) {\n throw new ConfigError(\n \"Internal error: Native ECMAScript modules aren't supported by this platform.\\n\",\n filepath,\n );\n }\n\n return await import_(url);\n }\n});\n\nconst tsNotSupportedError = (ext: string) => `\\\nYou are using a ${ext} config file, but Babel only supports transpiling .cts configs. Either:\n- Use a .cts config file\n- Update to Node.js 23.6.0, which has native TypeScript support\n- Install tsx to transpile ${ext} files on the fly\\\n`;\n\nconst SUPPORTED_EXTENSIONS = {\n \".js\": \"unknown\",\n \".mjs\": \"esm\",\n \".cjs\": \"cjs\",\n \".ts\": \"unknown\",\n \".mts\": \"esm\",\n \".cts\": \"cjs\",\n} as const;\n\nconst asyncModules = new Set();\n\nexport default function* loadCodeDefault(\n filepath: string,\n loader: \"require\" | \"auto\",\n esmError: string,\n tlaError: string,\n): Handler<unknown> {\n let async;\n\n const ext = path.extname(filepath);\n const isTS = ext === \".ts\" || ext === \".cts\" || ext === \".mts\";\n\n const type =\n SUPPORTED_EXTENSIONS[\n Object.hasOwn(SUPPORTED_EXTENSIONS, ext)\n ? (ext as keyof typeof SUPPORTED_EXTENSIONS)\n : (\".js\" as const)\n ];\n\n const pattern = `${loader} ${type}` as const;\n switch (pattern) {\n case \"require cjs\":\n case \"auto cjs\":\n if (isTS) {\n return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));\n } else if (process.env.BABEL_8_BREAKING) {\n return loadCjsDefault(filepath);\n } else {\n return loadCjsDefault(\n filepath,\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n /* fallbackToTranspiledModule */ arguments[2],\n );\n }\n case \"auto unknown\":\n case \"require unknown\":\n case \"require esm\":\n try {\n if (isTS) {\n return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));\n } else if (process.env.BABEL_8_BREAKING) {\n return loadCjsDefault(filepath);\n } else {\n return loadCjsDefault(\n filepath,\n // @ts-ignore(Babel 7 vs Babel 8) Removed in Babel 8\n /* fallbackToTranspiledModule */ arguments[2],\n );\n }\n } catch (e) {\n if (\n e.code === \"ERR_REQUIRE_ASYNC_MODULE\" ||\n // Node.js 13.0.0 throws ERR_REQUIRE_CYCLE_MODULE instead of\n // ERR_REQUIRE_ASYNC_MODULE when requiring a module a second time\n // https://github.com/nodejs/node/issues/55516\n // This `asyncModules` won't catch all of such cases, but it will\n // at least catch those caused by Babel trying to load a module twice.\n (e.code === \"ERR_REQUIRE_CYCLE_MODULE\" && asyncModules.has(filepath))\n ) {\n asyncModules.add(filepath);\n if (!(async ??= yield* isAsync())) {\n throw new ConfigError(tlaError, filepath);\n }\n // fall through: require() failed due to TLA\n } else if (\n e.code === \"ERR_REQUIRE_ESM\" ||\n (!process.env.BABEL_8_BREAKING && type === \"esm\")\n ) {\n // fall through: require() failed due to ESM\n } else {\n throw e;\n }\n }\n // fall through: require() failed due to ESM or TLA, try import()\n case \"auto esm\":\n if ((async ??= yield* isAsync())) {\n const promise = isTS\n ? ensureTsSupport(filepath, ext, () => loadMjsFromPath(filepath))\n : loadMjsFromPath(filepath);\n\n return (yield* waitFor(promise)).default;\n }\n if (isTS) {\n throw new ConfigError(tsNotSupportedError(ext), filepath);\n } else {\n throw new ConfigError(esmError, filepath);\n }\n default:\n throw new Error(\"Internal Babel error: unreachable code.\");\n }\n}\n\nfunction ensureTsSupport<T>(\n filepath: string,\n ext: string,\n callback: () => T,\n): T {\n if (\n process.features.typescript ||\n require.extensions[\".ts\"] ||\n require.extensions[\".cts\"] ||\n require.extensions[\".mts\"]\n ) {\n return callback();\n }\n\n if (ext !== \".cts\") {\n throw new ConfigError(tsNotSupportedError(ext), filepath);\n }\n\n const opts: InputOptions = {\n babelrc: false,\n configFile: false,\n sourceType: \"unambiguous\",\n sourceMaps: \"inline\",\n sourceFileName: path.basename(filepath),\n presets: [\n [\n getTSPreset(filepath),\n {\n onlyRemoveTypeImports: true,\n optimizeConstEnums: true,\n ...(process.env.BABEL_8_BREAKING ? {} : { allowDeclareFields: true }),\n },\n ],\n ],\n };\n\n let handler: NodeJS.RequireExtensions[\"\"] = function (m, filename) {\n // If we want to support `.ts`, `.d.ts` must be handled specially.\n if (handler && filename.endsWith(\".cts\")) {\n try {\n // @ts-expect-error Undocumented API\n return m._compile(\n transformFileSync(filename, {\n ...opts,\n filename,\n }).code,\n filename,\n );\n } catch (error) {\n // TODO(Babel 8): Add this as an optional peer dependency\n // eslint-disable-next-line import/no-extraneous-dependencies\n const packageJson = require(\"@babel/preset-typescript/package.json\");\n if (semver.lt(packageJson.version, \"7.21.4\")) {\n console.error(\n \"`.cts` configuration file failed to load, please try to update `@babel/preset-typescript`.\",\n );\n }\n throw error;\n }\n }\n return require.extensions[\".js\"](m, filename);\n };\n require.extensions[ext] = handler;\n\n try {\n return callback();\n } finally {\n if (require.extensions[ext] === handler) delete require.extensions[ext];\n handler = undefined;\n }\n}\n\nfunction getTSPreset(filepath: string) {\n try {\n // eslint-disable-next-line import/no-extraneous-dependencies\n return require(\"@babel/preset-typescript\");\n } catch (error) {\n if (error.code !== \"MODULE_NOT_FOUND\") throw error;\n\n let message =\n \"You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!\";\n\n if (!process.env.BABEL_8_BREAKING) {\n if (process.versions.pnp) {\n // Using Yarn PnP, which doesn't allow requiring packages that are not\n // explicitly specified as dependencies.\n message += `\nIf you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file:\n\npackageExtensions:\n\\t\"@babel/core@*\":\n\\t\\tpeerDependencies:\n\\t\\t\\t\"@babel/preset-typescript\": \"*\"\n`;\n }\n }\n\n throw new ConfigError(message, filepath);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,SAAAC,MAAA;EAAA,MAAAC,IAAA,GAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EA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AAM,IAAIrD,oBAAW,CAACqD,OAAO,EAAErE,QAAQ,CAAC;EAC1C;AACF;AAAC","ignoreList":[]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.findPackageData = findPackageData;
|
|
7
|
-
function _path() {
|
|
8
|
-
const data = require("path");
|
|
9
|
-
_path = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _utils = require("./utils.js");
|
|
15
|
-
var _configError = require("../../errors/config-error.js");
|
|
16
|
-
const PACKAGE_FILENAME = "package.json";
|
|
17
|
-
const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
|
18
|
-
let options;
|
|
19
|
-
try {
|
|
20
|
-
options = JSON.parse(content);
|
|
21
|
-
} catch (err) {
|
|
22
|
-
throw new _configError.default(`Error while parsing JSON - ${err.message}`, filepath);
|
|
23
|
-
}
|
|
24
|
-
if (!options) throw new Error(`${filepath}: No config detected`);
|
|
25
|
-
if (typeof options !== "object") {
|
|
26
|
-
throw new _configError.default(`Config returned typeof ${typeof options}`, filepath);
|
|
27
|
-
}
|
|
28
|
-
if (Array.isArray(options)) {
|
|
29
|
-
throw new _configError.default(`Expected config object but found array`, filepath);
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
filepath,
|
|
33
|
-
dirname: _path().dirname(filepath),
|
|
34
|
-
options
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
function* findPackageData(filepath) {
|
|
38
|
-
let pkg = null;
|
|
39
|
-
const directories = [];
|
|
40
|
-
let isPackage = true;
|
|
41
|
-
let dirname = _path().dirname(filepath);
|
|
42
|
-
while (!pkg && _path().basename(dirname) !== "node_modules") {
|
|
43
|
-
directories.push(dirname);
|
|
44
|
-
pkg = yield* readConfigPackage(_path().join(dirname, PACKAGE_FILENAME));
|
|
45
|
-
const nextLoc = _path().dirname(dirname);
|
|
46
|
-
if (dirname === nextLoc) {
|
|
47
|
-
isPackage = false;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
dirname = nextLoc;
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
filepath,
|
|
54
|
-
directories,
|
|
55
|
-
pkg,
|
|
56
|
-
isPackage
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
0 && 0;
|
|
60
|
-
|
|
61
|
-
//# sourceMappingURL=package.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_path","data","require","_utils","_configError","PACKAGE_FILENAME","readConfigPackage","makeStaticFileCache","filepath","content","options","JSON","parse","err","ConfigError","message","Error","Array","isArray","dirname","path","findPackageData","pkg","directories","isPackage","basename","push","join","nextLoc"],"sources":["../../../src/config/files/package.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { Handler } from \"gensync\";\nimport { makeStaticFileCache } from \"./utils.ts\";\n\nimport type { ConfigFile, FilePackageData } from \"./types.ts\";\n\nimport ConfigError from \"../../errors/config-error.ts\";\n\nconst PACKAGE_FILENAME = \"package.json\";\n\nconst readConfigPackage = makeStaticFileCache(\n (filepath, content): ConfigFile => {\n let options;\n try {\n options = JSON.parse(content) as unknown;\n } catch (err) {\n throw new ConfigError(\n `Error while parsing JSON - ${err.message}`,\n filepath,\n );\n }\n\n if (!options) throw new Error(`${filepath}: No config detected`);\n\n if (typeof options !== \"object\") {\n throw new ConfigError(\n `Config returned typeof ${typeof options}`,\n filepath,\n );\n }\n if (Array.isArray(options)) {\n throw new ConfigError(`Expected config object but found array`, filepath);\n }\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n },\n);\n\n/**\n * Find metadata about the package that this file is inside of. Resolution\n * of Babel's config requires general package information to decide when to\n * search for .babelrc files\n */\nexport function* findPackageData(filepath: string): Handler<FilePackageData> {\n let pkg = null;\n const directories = [];\n let isPackage = true;\n\n let dirname = path.dirname(filepath);\n while (!pkg && path.basename(dirname) !== \"node_modules\") {\n directories.push(dirname);\n\n pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME));\n\n const nextLoc = path.dirname(dirname);\n if (dirname === nextLoc) {\n isPackage = false;\n break;\n }\n dirname = nextLoc;\n }\n\n return { filepath, directories, pkg, isPackage };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,MAAA,GAAAD,OAAA;AAIA,IAAAE,YAAA,GAAAF,OAAA;AAEA,MAAMG,gBAAgB,GAAG,cAAc;AAEvC,MAAMC,iBAAiB,GAAG,IAAAC,0BAAmB,EAC3C,CAACC,QAAQ,EAAEC,OAAO,KAAiB;EACjC,IAAIC,OAAO;EACX,IAAI;IACFA,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,OAAO,CAAY;EAC1C,CAAC,CAAC,OAAOI,GAAG,EAAE;IACZ,MAAM,IAAIC,oBAAW,CACnB,8BAA8BD,GAAG,CAACE,OAAO,EAAE,EAC3CP,QACF,CAAC;EACH;EAEA,IAAI,CAACE,OAAO,EAAE,MAAM,IAAIM,KAAK,CAAC,GAAGR,QAAQ,sBAAsB,CAAC;EAEhE,IAAI,OAAOE,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAM,IAAII,oBAAW,CACnB,0BAA0B,OAAOJ,OAAO,EAAE,EAC1CF,QACF,CAAC;EACH;EACA,IAAIS,KAAK,CAACC,OAAO,CAACR,OAAO,CAAC,EAAE;IAC1B,MAAM,IAAII,oBAAW,CAAC,wCAAwC,EAAEN,QAAQ,CAAC;EAC3E;EAEA,OAAO;IACLA,QAAQ;IACRW,OAAO,EAAEC,MAAGA,CAAC,CAACD,OAAO,CAACX,QAAQ,CAAC;IAC/BE;EACF,CAAC;AACH,CACF,CAAC;AAOM,UAAUW,eAAeA,CAACb,QAAgB,EAA4B;EAC3E,IAAIc,GAAG,GAAG,IAAI;EACd,MAAMC,WAAW,GAAG,EAAE;EACtB,IAAIC,SAAS,GAAG,IAAI;EAEpB,IAAIL,OAAO,GAAGC,MAAGA,CAAC,CAACD,OAAO,CAACX,QAAQ,CAAC;EACpC,OAAO,CAACc,GAAG,IAAIF,MAAGA,CAAC,CAACK,QAAQ,CAACN,OAAO,CAAC,KAAK,cAAc,EAAE;IACxDI,WAAW,CAACG,IAAI,CAACP,OAAO,CAAC;IAEzBG,GAAG,GAAG,OAAOhB,iBAAiB,CAACc,MAAGA,CAAC,CAACO,IAAI,CAACR,OAAO,EAAEd,gBAAgB,CAAC,CAAC;IAEpE,MAAMuB,OAAO,GAAGR,MAAGA,CAAC,CAACD,OAAO,CAACA,OAAO,CAAC;IACrC,IAAIA,OAAO,KAAKS,OAAO,EAAE;MACvBJ,SAAS,GAAG,KAAK;MACjB;IACF;IACAL,OAAO,GAAGS,OAAO;EACnB;EAEA,OAAO;IAAEpB,QAAQ;IAAEe,WAAW;IAAED,GAAG;IAAEE;EAAU,CAAC;AAClD;AAAC","ignoreList":[]}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.loadPlugin = loadPlugin;
|
|
7
|
-
exports.loadPreset = loadPreset;
|
|
8
|
-
exports.resolvePreset = exports.resolvePlugin = void 0;
|
|
9
|
-
function _debug() {
|
|
10
|
-
const data = require("debug");
|
|
11
|
-
_debug = function () {
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
|
-
function _path() {
|
|
17
|
-
const data = require("path");
|
|
18
|
-
_path = function () {
|
|
19
|
-
return data;
|
|
20
|
-
};
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
var _async = require("../../gensync-utils/async.js");
|
|
24
|
-
var _moduleTypes = require("./module-types.js");
|
|
25
|
-
function _url() {
|
|
26
|
-
const data = require("url");
|
|
27
|
-
_url = function () {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
var _importMetaResolve = require("../../vendor/import-meta-resolve.js");
|
|
33
|
-
require("module");
|
|
34
|
-
function _fs() {
|
|
35
|
-
const data = require("fs");
|
|
36
|
-
_fs = function () {
|
|
37
|
-
return data;
|
|
38
|
-
};
|
|
39
|
-
return data;
|
|
40
|
-
}
|
|
41
|
-
const debug = _debug()("babel:config:loading:files:plugins");
|
|
42
|
-
const EXACT_RE = /^module:/;
|
|
43
|
-
const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
|
|
44
|
-
const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
|
|
45
|
-
const BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
|
|
46
|
-
const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
|
|
47
|
-
const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$)|[^/]+\/)/;
|
|
48
|
-
const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/;
|
|
49
|
-
const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;
|
|
50
|
-
const resolvePlugin = exports.resolvePlugin = resolveStandardizedName.bind(null, "plugin");
|
|
51
|
-
const resolvePreset = exports.resolvePreset = resolveStandardizedName.bind(null, "preset");
|
|
52
|
-
function* loadPlugin(name, dirname) {
|
|
53
|
-
const {
|
|
54
|
-
filepath,
|
|
55
|
-
loader
|
|
56
|
-
} = resolvePlugin(name, dirname, yield* (0, _async.isAsync)());
|
|
57
|
-
const value = yield* requireModule("plugin", loader, filepath);
|
|
58
|
-
debug("Loaded plugin %o from %o.", name, dirname);
|
|
59
|
-
return {
|
|
60
|
-
filepath,
|
|
61
|
-
value
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function* loadPreset(name, dirname) {
|
|
65
|
-
const {
|
|
66
|
-
filepath,
|
|
67
|
-
loader
|
|
68
|
-
} = resolvePreset(name, dirname, yield* (0, _async.isAsync)());
|
|
69
|
-
const value = yield* requireModule("preset", loader, filepath);
|
|
70
|
-
debug("Loaded preset %o from %o.", name, dirname);
|
|
71
|
-
return {
|
|
72
|
-
filepath,
|
|
73
|
-
value
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function standardizeName(type, name) {
|
|
77
|
-
if (_path().isAbsolute(name)) return name;
|
|
78
|
-
const isPreset = type === "preset";
|
|
79
|
-
return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`).replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`).replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`).replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`).replace(EXACT_RE, "");
|
|
80
|
-
}
|
|
81
|
-
function* resolveAlternativesHelper(type, name) {
|
|
82
|
-
const standardizedName = standardizeName(type, name);
|
|
83
|
-
const {
|
|
84
|
-
error,
|
|
85
|
-
value
|
|
86
|
-
} = yield standardizedName;
|
|
87
|
-
if (!error) return value;
|
|
88
|
-
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
|
89
|
-
if (standardizedName !== name && !(yield name).error) {
|
|
90
|
-
error.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
|
|
91
|
-
}
|
|
92
|
-
if (!(yield standardizeName(type, "@babel/" + name)).error) {
|
|
93
|
-
error.message += `\n- Did you mean "@babel/${name}"?`;
|
|
94
|
-
}
|
|
95
|
-
const oppositeType = type === "preset" ? "plugin" : "preset";
|
|
96
|
-
if (!(yield standardizeName(oppositeType, name)).error) {
|
|
97
|
-
error.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
|
|
98
|
-
}
|
|
99
|
-
if (type === "plugin") {
|
|
100
|
-
const transformName = standardizedName.replace("-proposal-", "-transform-");
|
|
101
|
-
if (transformName !== standardizedName && !(yield transformName).error) {
|
|
102
|
-
error.message += `\n- Did you mean "${transformName}"?`;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
error.message += `\n
|
|
106
|
-
Make sure that all the Babel plugins and presets you are using
|
|
107
|
-
are defined as dependencies or devDependencies in your package.json
|
|
108
|
-
file. It's possible that the missing plugin is loaded by a preset
|
|
109
|
-
you are using that forgot to add the plugin to its dependencies: you
|
|
110
|
-
can workaround this problem by explicitly adding the missing package
|
|
111
|
-
to your top-level package.json.
|
|
112
|
-
`;
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
115
|
-
function tryRequireResolve(id, dirname) {
|
|
116
|
-
try {
|
|
117
|
-
if (dirname) {
|
|
118
|
-
return {
|
|
119
|
-
error: null,
|
|
120
|
-
value: (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
|
|
121
|
-
paths: [b]
|
|
122
|
-
}, M = require("module")) => {
|
|
123
|
-
let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
|
|
124
|
-
if (f) return f;
|
|
125
|
-
f = new Error(`Cannot resolve module '${r}'`);
|
|
126
|
-
f.code = "MODULE_NOT_FOUND";
|
|
127
|
-
throw f;
|
|
128
|
-
})(id, {
|
|
129
|
-
paths: [dirname]
|
|
130
|
-
})
|
|
131
|
-
};
|
|
132
|
-
} else {
|
|
133
|
-
return {
|
|
134
|
-
error: null,
|
|
135
|
-
value: require.resolve(id)
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
} catch (error) {
|
|
139
|
-
return {
|
|
140
|
-
error,
|
|
141
|
-
value: null
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function tryImportMetaResolve(id, options) {
|
|
146
|
-
try {
|
|
147
|
-
return {
|
|
148
|
-
error: null,
|
|
149
|
-
value: (0, _importMetaResolve.resolve)(id, options)
|
|
150
|
-
};
|
|
151
|
-
} catch (error) {
|
|
152
|
-
return {
|
|
153
|
-
error,
|
|
154
|
-
value: null
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function resolveStandardizedNameForRequire(type, name, dirname) {
|
|
159
|
-
const it = resolveAlternativesHelper(type, name);
|
|
160
|
-
let res = it.next();
|
|
161
|
-
while (!res.done) {
|
|
162
|
-
res = it.next(tryRequireResolve(res.value, dirname));
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
loader: "require",
|
|
166
|
-
filepath: res.value
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
function resolveStandardizedNameForImport(type, name, dirname) {
|
|
170
|
-
const parentUrl = (0, _url().pathToFileURL)(_path().join(dirname, "./babel-virtual-resolve-base.js")).href;
|
|
171
|
-
const it = resolveAlternativesHelper(type, name);
|
|
172
|
-
let res = it.next();
|
|
173
|
-
while (!res.done) {
|
|
174
|
-
res = it.next(tryImportMetaResolve(res.value, parentUrl));
|
|
175
|
-
}
|
|
176
|
-
return {
|
|
177
|
-
loader: "auto",
|
|
178
|
-
filepath: (0, _url().fileURLToPath)(res.value)
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
function resolveStandardizedName(type, name, dirname, allowAsync) {
|
|
182
|
-
if (!_moduleTypes.supportsESM || !allowAsync) {
|
|
183
|
-
return resolveStandardizedNameForRequire(type, name, dirname);
|
|
184
|
-
}
|
|
185
|
-
try {
|
|
186
|
-
const resolved = resolveStandardizedNameForImport(type, name, dirname);
|
|
187
|
-
if (!(0, _fs().existsSync)(resolved.filepath)) {
|
|
188
|
-
throw Object.assign(new Error(`Could not resolve "${name}" in file ${dirname}.`), {
|
|
189
|
-
type: "MODULE_NOT_FOUND"
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
return resolved;
|
|
193
|
-
} catch (e) {
|
|
194
|
-
try {
|
|
195
|
-
return resolveStandardizedNameForRequire(type, name, dirname);
|
|
196
|
-
} catch (e2) {
|
|
197
|
-
if (e.type === "MODULE_NOT_FOUND") throw e;
|
|
198
|
-
if (e2.type === "MODULE_NOT_FOUND") throw e2;
|
|
199
|
-
throw e;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
var LOADING_MODULES = new Set();
|
|
204
|
-
function* requireModule(type, loader, name) {
|
|
205
|
-
if (!(yield* (0, _async.isAsync)()) && LOADING_MODULES.has(name)) {
|
|
206
|
-
throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.');
|
|
207
|
-
}
|
|
208
|
-
try {
|
|
209
|
-
LOADING_MODULES.add(name);
|
|
210
|
-
return yield* (0, _moduleTypes.default)(name, loader, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously " + "or when using the Node.js `--experimental-require-module` flag.", `You appear to be using a ${type} that contains top-level await, ` + "which is only supported when running Babel asynchronously.", true);
|
|
211
|
-
} catch (err) {
|
|
212
|
-
err.message = `[BABEL]: ${err.message} (While processing: ${name})`;
|
|
213
|
-
throw err;
|
|
214
|
-
} finally {
|
|
215
|
-
LOADING_MODULES.delete(name);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
0 && 0;
|
|
219
|
-
|
|
220
|
-
//# sourceMappingURL=plugins.js.map
|