powerlines 0.23.10 → 0.24.1
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/dist/{api-5H3zEedD.d.ts → api-C32Buv5_.d.ts} +1 -1
- package/dist/{api-B77aqxGC.d.cts → api-wzd5AREv.d.cts} +1 -1
- package/dist/api.cjs +2 -2
- package/dist/api.d.cts +4 -2
- package/dist/api.d.ts +4 -2
- package/dist/api.js +1 -1
- package/dist/astro.cjs +4 -4
- package/dist/astro.d.cts +3 -1
- package/dist/astro.d.ts +3 -1
- package/dist/astro.js +3 -3
- package/dist/chunk-2TWFBWKA.cjs +133 -0
- package/dist/{chunk-3W5CN3M3.js → chunk-7V3LWCLB.js} +1 -1
- package/dist/chunk-EXQM3KGH.js +130 -0
- package/dist/{chunk-4EIGDACJ.cjs → chunk-FGH3MZTQ.cjs} +523 -649
- package/dist/{chunk-SNHUEYEP.cjs → chunk-FPB2O7FD.cjs} +2 -2
- package/dist/{chunk-ZIWN73GA.js → chunk-H74SWU2C.js} +1 -1
- package/dist/{chunk-WBC2XOMT.cjs → chunk-HTGCHSLH.cjs} +2 -2
- package/dist/{chunk-PR3JGGAL.cjs → chunk-TIBYAWZZ.cjs} +2 -2
- package/dist/{chunk-SS5AXCGJ.js → chunk-ZEE73BCY.js} +1 -1
- package/dist/{chunk-MUNYXQYT.js → chunk-ZT2J55YE.js} +526 -649
- package/dist/config.d.cts +3 -1
- package/dist/config.d.ts +3 -1
- package/dist/esbuild.cjs +6 -6
- package/dist/esbuild.d.cts +3 -1
- package/dist/esbuild.d.ts +3 -1
- package/dist/esbuild.js +3 -3
- package/dist/farm.cjs +3 -3
- package/dist/farm.d.cts +3 -1
- package/dist/farm.d.ts +3 -1
- package/dist/farm.js +2 -2
- package/dist/index.cjs +11 -23
- package/dist/index.d.cts +6 -135
- package/dist/index.d.ts +6 -135
- package/dist/index.js +2 -2
- package/dist/lib/{api-Cm51oVbC.d.cts → api-BRMITKt-.d.cts} +1 -1
- package/dist/lib/{api-mja4jirh.d.ts → api-CDUN9en8.d.ts} +1 -1
- package/dist/lib/build/esbuild.d.cts +3 -1
- package/dist/lib/build/esbuild.d.ts +3 -1
- package/dist/lib/build/index.d.cts +5 -3
- package/dist/lib/build/index.d.ts +5 -3
- package/dist/lib/build/rolldown.d.cts +3 -1
- package/dist/lib/build/rolldown.d.ts +3 -1
- package/dist/lib/build/rollup.d.cts +3 -1
- package/dist/lib/build/rollup.d.ts +3 -1
- package/dist/lib/build/rspack.d.cts +3 -1
- package/dist/lib/build/rspack.d.ts +3 -1
- package/dist/lib/build/tsup.d.cts +3 -1
- package/dist/lib/build/tsup.d.ts +3 -1
- package/dist/lib/build/unbuild.d.cts +5 -3
- package/dist/lib/build/unbuild.d.ts +5 -3
- package/dist/lib/build/vite.d.cts +3 -1
- package/dist/lib/build/vite.d.ts +3 -1
- package/dist/lib/build/webpack.d.cts +3 -1
- package/dist/lib/build/webpack.d.ts +3 -1
- package/dist/lib/{chunk-52VDUP5J.js → chunk-6I5PL7H2.js} +5 -17
- package/dist/lib/{chunk-UPVFKXB7.cjs → chunk-6PPZCPME.cjs} +1 -2
- package/dist/lib/{chunk-HNOAMIRO.js → chunk-7CVPZOH4.js} +2 -2
- package/dist/lib/{chunk-SEWUUTNA.js → chunk-A2NFSQ5K.js} +1 -1
- package/dist/lib/{chunk-I6TJUFA6.cjs → chunk-AA6RBP44.cjs} +10 -10
- package/dist/lib/{chunk-VDPCG3RR.js → chunk-CGRHZJY5.js} +41 -82
- package/dist/lib/{chunk-OJ5XFCZN.js → chunk-DFW5FGEO.js} +1 -1
- package/dist/lib/{chunk-VL63QEPF.cjs → chunk-DUZJ7ZF2.cjs} +2 -2
- package/dist/lib/{chunk-EFYMNU53.cjs → chunk-EV357RFB.cjs} +5 -17
- package/dist/lib/{chunk-54XNJQTH.js → chunk-HAXL7QE7.js} +3 -3
- package/dist/lib/{chunk-XG4CC73V.js → chunk-KFWMKDJQ.js} +391 -589
- package/dist/lib/{chunk-RBSNQFLF.cjs → chunk-MS3CD2U6.cjs} +49 -91
- package/dist/lib/{chunk-QABAD5RE.cjs → chunk-RNHKEPFD.cjs} +387 -586
- package/dist/lib/{chunk-4EIXDLFP.cjs → chunk-SAS5EPBD.cjs} +7 -5
- package/dist/lib/{chunk-EUDKQWSB.js → chunk-VHLINWXG.js} +1 -2
- package/dist/lib/{chunk-VLOUSKRX.cjs → chunk-VMLQATMA.cjs} +4 -4
- package/dist/lib/{chunk-IBPA3VN5.cjs → chunk-WUYK74EH.cjs} +3 -3
- package/dist/lib/{chunk-RD5AUWXN.js → chunk-YQ3ODCHV.js} +7 -5
- package/dist/lib/{config-BnJpgcGr.d.cts → config-D8KrE7SZ.d.cts} +109 -35
- package/dist/lib/{config-7Q2dBjJE.d.ts → config-DBIFdRoq.d.ts} +109 -35
- package/dist/lib/config-file.d.cts +3 -1
- package/dist/lib/config-file.d.ts +3 -1
- package/dist/lib/contexts/api-context.cjs +5 -4
- package/dist/lib/contexts/api-context.d.cts +5 -3
- package/dist/lib/contexts/api-context.d.ts +5 -3
- package/dist/lib/contexts/api-context.js +4 -3
- package/dist/lib/contexts/context.cjs +3 -2
- package/dist/lib/contexts/context.d.cts +47 -4
- package/dist/lib/contexts/context.d.ts +47 -4
- package/dist/lib/contexts/context.js +2 -1
- package/dist/lib/contexts/environment-context.cjs +4 -3
- package/dist/lib/contexts/environment-context.d.cts +5 -3
- package/dist/lib/contexts/environment-context.d.ts +5 -3
- package/dist/lib/contexts/environment-context.js +3 -2
- package/dist/lib/contexts/index.cjs +7 -6
- package/dist/lib/contexts/index.d.cts +5 -3
- package/dist/lib/contexts/index.d.ts +5 -3
- package/dist/lib/contexts/index.js +4 -3
- package/dist/lib/contexts/plugin-context.d.cts +5 -3
- package/dist/lib/contexts/plugin-context.d.ts +5 -3
- package/dist/lib/entry.d.cts +3 -1
- package/dist/lib/entry.d.ts +3 -1
- package/dist/lib/index.cjs +39 -45
- package/dist/lib/index.d.cts +67 -48
- package/dist/lib/index.d.ts +67 -48
- package/dist/lib/index.js +12 -14
- package/dist/lib/{internal-BEygquYh.d.ts → internal-1qCyw7bA.d.ts} +2 -2
- package/dist/lib/{internal-BeR8fOB1.d.cts → internal-CaGANOWK.d.cts} +2 -2
- package/dist/lib/logger.d.cts +3 -1
- package/dist/lib/logger.d.ts +3 -1
- package/dist/lib/typescript/compiler-host.cjs +7 -7
- package/dist/lib/typescript/compiler-host.d.cts +3 -1
- package/dist/lib/typescript/compiler-host.d.ts +3 -1
- package/dist/lib/typescript/compiler-host.js +6 -6
- package/dist/lib/typescript/import-transformer.cjs +1 -1
- package/dist/lib/typescript/import-transformer.d.cts +3 -1
- package/dist/lib/typescript/import-transformer.d.ts +3 -1
- package/dist/lib/typescript/import-transformer.js +1 -1
- package/dist/lib/typescript/index.cjs +8 -8
- package/dist/lib/typescript/index.d.cts +3 -2
- package/dist/lib/typescript/index.d.ts +3 -2
- package/dist/lib/typescript/index.js +2 -2
- package/dist/lib/typescript/program.cjs +6 -6
- package/dist/lib/typescript/program.d.cts +3 -1
- package/dist/lib/typescript/program.d.ts +3 -1
- package/dist/lib/typescript/program.js +1 -1
- package/dist/lib/typescript/ts-morph.cjs +2 -2
- package/dist/lib/typescript/ts-morph.d.cts +5 -3
- package/dist/lib/typescript/ts-morph.d.ts +5 -3
- package/dist/lib/typescript/ts-morph.js +1 -1
- package/dist/lib/unplugin/factory.cjs +6 -6
- package/dist/lib/unplugin/factory.d.cts +5 -3
- package/dist/lib/unplugin/factory.d.ts +5 -3
- package/dist/lib/unplugin/factory.js +5 -5
- package/dist/lib/unplugin/helpers.d.cts +3 -1
- package/dist/lib/unplugin/helpers.d.ts +3 -1
- package/dist/lib/unplugin/index.cjs +11 -11
- package/dist/lib/unplugin/index.d.cts +6 -4
- package/dist/lib/unplugin/index.d.ts +6 -4
- package/dist/lib/unplugin/index.js +7 -7
- package/dist/lib/unplugin/plugin.cjs +2 -3
- package/dist/lib/unplugin/plugin.d.cts +6 -4
- package/dist/lib/unplugin/plugin.d.ts +6 -4
- package/dist/lib/unplugin/plugin.js +1 -2
- package/dist/lib/{unplugin-CbbNDduM.d.ts → unplugin-CEeJqADD.d.ts} +2 -2
- package/dist/lib/{unplugin-ppAOzR__.d.cts → unplugin-bUSyjd0S.d.cts} +2 -2
- package/dist/lib/utilities/bundle.cjs +2 -3
- package/dist/lib/utilities/bundle.d.cts +3 -1
- package/dist/lib/utilities/bundle.d.ts +3 -1
- package/dist/lib/utilities/bundle.js +1 -2
- package/dist/lib/utilities/cache.d.cts +3 -1
- package/dist/lib/utilities/cache.d.ts +3 -1
- package/dist/lib/utilities/file-header.d.cts +3 -1
- package/dist/lib/utilities/file-header.d.ts +3 -1
- package/dist/lib/utilities/index.cjs +14 -19
- package/dist/lib/utilities/index.d.cts +3 -2
- package/dist/lib/utilities/index.d.ts +3 -2
- package/dist/lib/utilities/index.js +4 -5
- package/dist/lib/utilities/meta.d.cts +3 -1
- package/dist/lib/utilities/meta.d.ts +3 -1
- package/dist/lib/utilities/resolve.cjs +3 -4
- package/dist/lib/utilities/resolve.d.cts +3 -1
- package/dist/lib/utilities/resolve.d.ts +3 -1
- package/dist/lib/utilities/resolve.js +2 -3
- package/dist/lib/utilities/source-file.d.cts +3 -1
- package/dist/lib/utilities/source-file.d.ts +3 -1
- package/dist/lib/utilities/source-map.d.cts +3 -1
- package/dist/lib/utilities/source-map.d.ts +3 -1
- package/dist/lib/utilities/worker.d.cts +3 -1
- package/dist/lib/utilities/worker.d.ts +3 -1
- package/dist/lib/utilities/write-file.d.cts +3 -1
- package/dist/lib/utilities/write-file.d.ts +3 -1
- package/dist/next.cjs +4 -4
- package/dist/next.js +3 -3
- package/dist/nuxt.cjs +6 -6
- package/dist/nuxt.js +4 -4
- package/dist/plugin-utils/{context-Cg11S-CE.d.cts → context-BITGF5LZ.d.cts} +118 -39
- package/dist/plugin-utils/{context-Cg11S-CE.d.ts → context-BITGF5LZ.d.ts} +118 -39
- package/dist/plugin-utils/context-helpers.d.cts +4 -1
- package/dist/plugin-utils/context-helpers.d.ts +4 -1
- package/dist/plugin-utils/enforce.d.cts +4 -1
- package/dist/plugin-utils/enforce.d.ts +4 -1
- package/dist/plugin-utils/extend.d.cts +4 -1
- package/dist/plugin-utils/extend.d.ts +4 -1
- package/dist/plugin-utils/get-config-path.d.cts +4 -1
- package/dist/plugin-utils/get-config-path.d.ts +4 -1
- package/dist/plugin-utils/helpers.d.cts +4 -1
- package/dist/plugin-utils/helpers.d.ts +4 -1
- package/dist/plugin-utils/index.d.cts +4 -1
- package/dist/plugin-utils/index.d.ts +4 -1
- package/dist/plugin-utils/merge.d.cts +4 -1
- package/dist/plugin-utils/merge.d.ts +4 -1
- package/dist/plugin-utils/paths.d.cts +4 -1
- package/dist/plugin-utils/paths.d.ts +4 -1
- package/dist/{resolved-B3BSdXCt.d.ts → resolved-BABoCnXm.d.ts} +43 -1
- package/dist/{resolved-DGrpILrS.d.cts → resolved-CSqGKlA5.d.cts} +43 -1
- package/dist/rolldown.cjs +3 -3
- package/dist/rolldown.d.cts +3 -1
- package/dist/rolldown.d.ts +3 -1
- package/dist/rolldown.js +2 -2
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.d.cts +3 -1
- package/dist/rollup.d.ts +3 -1
- package/dist/rollup.js +2 -2
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.d.cts +3 -1
- package/dist/rspack.d.ts +3 -1
- package/dist/rspack.js +2 -2
- package/dist/tsup.cjs +4 -4
- package/dist/tsup.js +3 -3
- package/dist/types/api.d.cts +4 -2
- package/dist/types/api.d.ts +4 -2
- package/dist/types/babel.d.cts +3 -1
- package/dist/types/babel.d.ts +3 -1
- package/dist/types/commands.d.cts +3 -1
- package/dist/types/commands.d.ts +3 -1
- package/dist/types/config.d.cts +3 -1
- package/dist/types/config.d.ts +3 -1
- package/dist/types/context.d.cts +3 -1
- package/dist/types/context.d.ts +3 -1
- package/dist/types/fs.d.cts +68 -36
- package/dist/types/fs.d.ts +68 -36
- package/dist/types/hooks.d.cts +3 -1
- package/dist/types/hooks.d.ts +3 -1
- package/dist/types/index.d.cts +5 -3
- package/dist/types/index.d.ts +5 -3
- package/dist/types/internal.d.cts +4 -2
- package/dist/types/internal.d.ts +4 -2
- package/dist/types/plugin.d.cts +3 -1
- package/dist/types/plugin.d.ts +3 -1
- package/dist/types/resolved.d.cts +3 -1
- package/dist/types/resolved.d.ts +3 -1
- package/dist/types/unplugin.d.cts +4 -2
- package/dist/types/unplugin.d.ts +4 -2
- package/dist/unloader.cjs +3 -3
- package/dist/unloader.d.cts +3 -1
- package/dist/unloader.d.ts +3 -1
- package/dist/unloader.js +2 -2
- package/dist/unplugin.cjs +12 -28
- package/dist/unplugin.d.cts +104 -31
- package/dist/unplugin.d.ts +104 -31
- package/dist/unplugin.js +10 -23
- package/dist/vite.cjs +6 -6
- package/dist/vite.d.cts +3 -1
- package/dist/vite.d.ts +3 -1
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +6 -6
- package/dist/webpack.d.cts +3 -1
- package/dist/webpack.d.ts +3 -1
- package/dist/webpack.js +3 -3
- package/package.json +17 -16
- package/schemas/fs.capnp +35 -38
- package/dist/chunk-4TBQYHPZ.cjs +0 -234
- package/dist/chunk-7G7OFGGH.js +0 -230
- package/dist/lib/chunk-G7S5PIAC.js +0 -89
- package/dist/lib/chunk-MZJWK36Q.cjs +0 -37
- package/dist/lib/chunk-NWAD7K4D.js +0 -35
- package/dist/lib/chunk-ZBDVQVUK.cjs +0 -91
- package/dist/lib/unplugin/resolve-id.cjs +0 -11
- package/dist/lib/unplugin/resolve-id.d.cts +0 -57
- package/dist/lib/unplugin/resolve-id.d.ts +0 -57
- package/dist/lib/unplugin/resolve-id.js +0 -2
- package/dist/lib/utilities/resolve-path.cjs +0 -11
- package/dist/lib/utilities/resolve-path.d.cts +0 -40
- package/dist/lib/utilities/resolve-path.d.ts +0 -40
- package/dist/lib/utilities/resolve-path.js +0 -2
- /package/dist/lib/{chunk-HMO3LAYL.js → chunk-I2DQRMX3.js} +0 -0
- /package/dist/lib/{chunk-EJ25PQEL.cjs → chunk-YK4PYVLM.cjs} +0 -0
|
@@ -26,11 +26,11 @@ var isSet = require('@stryke/type-checks/is-set');
|
|
|
26
26
|
var isSetObject = require('@stryke/type-checks/is-set-object');
|
|
27
27
|
var isSetString = require('@stryke/type-checks/is-set-string');
|
|
28
28
|
var chalk5 = require('chalk');
|
|
29
|
-
var defu6 = require('defu');
|
|
30
29
|
var Handlebars = require('handlebars');
|
|
31
30
|
var helperPluginUtils = require('@babel/helper-plugin-utils');
|
|
32
31
|
var t = require('@babel/types');
|
|
33
32
|
var ts2 = require('typescript');
|
|
33
|
+
var defu6 = require('defu');
|
|
34
34
|
var _package = require('@stryke/string-format/package');
|
|
35
35
|
var superdiff = require('@donedeal0/superdiff');
|
|
36
36
|
var json = require('@stryke/fs/json');
|
|
@@ -53,6 +53,7 @@ var join = require('@stryke/path/join');
|
|
|
53
53
|
var isNull = require('@stryke/type-checks/is-null');
|
|
54
54
|
var isString = require('@stryke/type-checks/is-string');
|
|
55
55
|
var uuid = require('@stryke/unique-id/uuid');
|
|
56
|
+
var bundleRequire = require('bundle-require');
|
|
56
57
|
var jiti = require('jiti');
|
|
57
58
|
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
58
59
|
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
@@ -60,8 +61,10 @@ var isFile = require('@stryke/fs/is-file');
|
|
|
60
61
|
var $ = require('@stryke/capnp');
|
|
61
62
|
var bufferToString = require('@stryke/convert/buffer-to-string');
|
|
62
63
|
var buffer = require('@stryke/fs/buffer');
|
|
64
|
+
var correctPath = require('@stryke/path/correct-path');
|
|
63
65
|
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
64
66
|
var isBuffer = require('@stryke/type-checks/is-buffer');
|
|
67
|
+
var flatCache = require('flat-cache');
|
|
65
68
|
var buffer$1 = require('buffer');
|
|
66
69
|
var _fs = require('fs');
|
|
67
70
|
var logger = require('@storm-software/config-tools/logger');
|
|
@@ -70,6 +73,7 @@ var noop = require('@stryke/helpers/noop');
|
|
|
70
73
|
var isParentPath = require('@stryke/path/is-parent-path');
|
|
71
74
|
var memfs = require('memfs');
|
|
72
75
|
var unionfs = require('unionfs');
|
|
76
|
+
var tsMorph = require('ts-morph');
|
|
73
77
|
require('@stryke/fs/remove-file');
|
|
74
78
|
var kebabCase = require('@stryke/string-format/kebab-case');
|
|
75
79
|
var isObject = require('@stryke/type-checks/is-object');
|
|
@@ -95,10 +99,10 @@ function _interopNamespace(e) {
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
var chalk5__default = /*#__PURE__*/_interopDefault(chalk5);
|
|
98
|
-
var defu6__default = /*#__PURE__*/_interopDefault(defu6);
|
|
99
102
|
var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
|
|
100
103
|
var t__namespace = /*#__PURE__*/_interopNamespace(t);
|
|
101
104
|
var ts2__default = /*#__PURE__*/_interopDefault(ts2);
|
|
105
|
+
var defu6__default = /*#__PURE__*/_interopDefault(defu6);
|
|
102
106
|
var $__namespace = /*#__PURE__*/_interopNamespace($);
|
|
103
107
|
var _fs__default = /*#__PURE__*/_interopDefault(_fs);
|
|
104
108
|
|
|
@@ -107,7 +111,7 @@ function resolveModulePath(nodePath, state) {
|
|
|
107
111
|
return;
|
|
108
112
|
}
|
|
109
113
|
const sourcePath = nodePath.node.value;
|
|
110
|
-
const resolvedPath = state.context?.fs.
|
|
114
|
+
const resolvedPath = state.context?.fs.resolveSync(sourcePath);
|
|
111
115
|
if (resolvedPath) {
|
|
112
116
|
nodePath.replaceWith(t__namespace.stringLiteral(
|
|
113
117
|
// Remove the file extension if it exists
|
|
@@ -211,33 +215,31 @@ function formatTypes(code) {
|
|
|
211
215
|
).replaceAll("#private;", "").replace(/__Ω/g, "");
|
|
212
216
|
}
|
|
213
217
|
chunkUSNT2KNT_cjs.__name(formatTypes, "formatTypes");
|
|
214
|
-
async function emitTypes(context,
|
|
215
|
-
context.log(types.LogLevelLabel.TRACE,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
+
async function emitTypes(context, files) {
|
|
219
|
+
context.log(types.LogLevelLabel.TRACE, `Running the TypeScript compiler for ${files.length} generated runtime files.`);
|
|
220
|
+
context.program.addSourceFilesAtPaths(files);
|
|
221
|
+
const result = context.program.emitToMemory({
|
|
222
|
+
emitOnlyDtsFiles: true
|
|
223
|
+
});
|
|
218
224
|
let builtinModules = "";
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
225
|
+
for (const file of result.getFiles()) {
|
|
226
|
+
if (!file.filePath.endsWith(".map")) {
|
|
227
|
+
if (context.builtins.some((builtin) => builtin === file.filePath || context.fs.metadata[builtin]?.id && context.fs.metadata[builtin]?.id === file.filePath)) {
|
|
228
|
+
const module = await context.fs.resolve(file.filePath);
|
|
223
229
|
builtinModules += `
|
|
224
|
-
declare module "${
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
`;
|
|
230
|
+
declare module "${module}" {
|
|
231
|
+
${file.text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
|
|
232
|
+
}
|
|
233
|
+
`;
|
|
228
234
|
}
|
|
229
235
|
}
|
|
230
|
-
}
|
|
231
|
-
const diagnostics = ts2.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
236
|
+
}
|
|
232
237
|
const diagnosticMessages = [];
|
|
233
|
-
|
|
234
|
-
if (diagnostic.
|
|
235
|
-
|
|
236
|
-
const message = ts2.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
237
|
-
diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
238
|
+
result.getDiagnostics().forEach((diagnostic) => {
|
|
239
|
+
if (diagnostic.getSourceFile()?.getBaseName()) {
|
|
240
|
+
diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${ts2.flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n")}`);
|
|
238
241
|
} else {
|
|
239
|
-
|
|
240
|
-
diagnosticMessages.push(message);
|
|
242
|
+
diagnosticMessages.push(ts2.flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n"));
|
|
241
243
|
}
|
|
242
244
|
});
|
|
243
245
|
const diagnosticMessage = diagnosticMessages.join("\n");
|
|
@@ -552,6 +554,7 @@ async function initializeTsconfig(context) {
|
|
|
552
554
|
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
553
555
|
context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
554
556
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
557
|
+
context.log(types.LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
555
558
|
await context.fs.writeFile(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson), {
|
|
556
559
|
mode: "fs"
|
|
557
560
|
});
|
|
@@ -793,8 +796,6 @@ function replacePathTokens(context, path) {
|
|
|
793
796
|
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{distPath}", context.config.output.distPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
794
797
|
}
|
|
795
798
|
chunkUSNT2KNT_cjs.__name(replacePathTokens, "replacePathTokens");
|
|
796
|
-
|
|
797
|
-
// src/lib/entry.ts
|
|
798
799
|
function resolveEntryInputFile(context, typeDefinition) {
|
|
799
800
|
return replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
|
|
800
801
|
}
|
|
@@ -955,187 +956,6 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
|
955
956
|
return "FileMetadata_" + super.toString();
|
|
956
957
|
}
|
|
957
958
|
};
|
|
958
|
-
var ChunkData = class extends $__namespace.Struct {
|
|
959
|
-
static {
|
|
960
|
-
chunkUSNT2KNT_cjs.__name(this, "ChunkData");
|
|
961
|
-
}
|
|
962
|
-
static _capnp = {
|
|
963
|
-
displayName: "ChunkData",
|
|
964
|
-
id: "84076f13b057f83a",
|
|
965
|
-
size: new $__namespace.ObjectSize(8, 4)
|
|
966
|
-
};
|
|
967
|
-
/**
|
|
968
|
-
* An additional name for the file.
|
|
969
|
-
*
|
|
970
|
-
*/
|
|
971
|
-
get id() {
|
|
972
|
-
return $__namespace.utils.getText(0, this);
|
|
973
|
-
}
|
|
974
|
-
set id(value) {
|
|
975
|
-
$__namespace.utils.setText(0, value, this);
|
|
976
|
-
}
|
|
977
|
-
/**
|
|
978
|
-
* Files that are implicitly loaded after one of the specified files.
|
|
979
|
-
*
|
|
980
|
-
*/
|
|
981
|
-
get name() {
|
|
982
|
-
return $__namespace.utils.getText(1, this);
|
|
983
|
-
}
|
|
984
|
-
set name(value) {
|
|
985
|
-
$__namespace.utils.setText(1, value, this);
|
|
986
|
-
}
|
|
987
|
-
_adoptImplicitlyLoadedAfterOneOf(value) {
|
|
988
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
|
|
989
|
-
}
|
|
990
|
-
_disownImplicitlyLoadedAfterOneOf() {
|
|
991
|
-
return $__namespace.utils.disown(this.implicitlyLoadedAfterOneOf);
|
|
992
|
-
}
|
|
993
|
-
/**
|
|
994
|
-
* The importer of the file.
|
|
995
|
-
*
|
|
996
|
-
*/
|
|
997
|
-
get implicitlyLoadedAfterOneOf() {
|
|
998
|
-
return $__namespace.utils.getList(2, $__namespace.TextList, this);
|
|
999
|
-
}
|
|
1000
|
-
_hasImplicitlyLoadedAfterOneOf() {
|
|
1001
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
|
|
1002
|
-
}
|
|
1003
|
-
_initImplicitlyLoadedAfterOneOf(length) {
|
|
1004
|
-
return $__namespace.utils.initList(2, $__namespace.TextList, length, this);
|
|
1005
|
-
}
|
|
1006
|
-
set implicitlyLoadedAfterOneOf(value) {
|
|
1007
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
|
|
1008
|
-
}
|
|
1009
|
-
/**
|
|
1010
|
-
* The signature preservation mode for the file.
|
|
1011
|
-
*
|
|
1012
|
-
*/
|
|
1013
|
-
get importer() {
|
|
1014
|
-
return $__namespace.utils.getText(3, this);
|
|
1015
|
-
}
|
|
1016
|
-
set importer(value) {
|
|
1017
|
-
$__namespace.utils.setText(3, value, this);
|
|
1018
|
-
}
|
|
1019
|
-
get preserveSignature() {
|
|
1020
|
-
return $__namespace.utils.getUint16(0, this);
|
|
1021
|
-
}
|
|
1022
|
-
set preserveSignature(value) {
|
|
1023
|
-
$__namespace.utils.setUint16(0, value, this);
|
|
1024
|
-
}
|
|
1025
|
-
toString() {
|
|
1026
|
-
return "ChunkData_" + super.toString();
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
var PrebuiltData = class extends $__namespace.Struct {
|
|
1030
|
-
static {
|
|
1031
|
-
chunkUSNT2KNT_cjs.__name(this, "PrebuiltData");
|
|
1032
|
-
}
|
|
1033
|
-
static _capnp = {
|
|
1034
|
-
displayName: "PrebuiltData",
|
|
1035
|
-
id: "c5b1a6ca696328ee",
|
|
1036
|
-
size: new $__namespace.ObjectSize(0, 4)
|
|
1037
|
-
};
|
|
1038
|
-
/**
|
|
1039
|
-
* An additional name for the file.
|
|
1040
|
-
*
|
|
1041
|
-
*/
|
|
1042
|
-
get id() {
|
|
1043
|
-
return $__namespace.utils.getText(0, this);
|
|
1044
|
-
}
|
|
1045
|
-
set id(value) {
|
|
1046
|
-
$__namespace.utils.setText(0, value, this);
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* The file exports.
|
|
1050
|
-
*
|
|
1051
|
-
*/
|
|
1052
|
-
get name() {
|
|
1053
|
-
return $__namespace.utils.getText(1, this);
|
|
1054
|
-
}
|
|
1055
|
-
set name(value) {
|
|
1056
|
-
$__namespace.utils.setText(1, value, this);
|
|
1057
|
-
}
|
|
1058
|
-
_adoptExports(value) {
|
|
1059
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
|
|
1060
|
-
}
|
|
1061
|
-
_disownExports() {
|
|
1062
|
-
return $__namespace.utils.disown(this.exports);
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* The source map for the file.
|
|
1066
|
-
*
|
|
1067
|
-
*/
|
|
1068
|
-
get exports() {
|
|
1069
|
-
return $__namespace.utils.getList(2, $__namespace.TextList, this);
|
|
1070
|
-
}
|
|
1071
|
-
_hasExports() {
|
|
1072
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
|
|
1073
|
-
}
|
|
1074
|
-
_initExports(length) {
|
|
1075
|
-
return $__namespace.utils.initList(2, $__namespace.TextList, length, this);
|
|
1076
|
-
}
|
|
1077
|
-
set exports(value) {
|
|
1078
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
|
|
1079
|
-
}
|
|
1080
|
-
get map() {
|
|
1081
|
-
return $__namespace.utils.getText(3, this);
|
|
1082
|
-
}
|
|
1083
|
-
set map(value) {
|
|
1084
|
-
$__namespace.utils.setText(3, value, this);
|
|
1085
|
-
}
|
|
1086
|
-
toString() {
|
|
1087
|
-
return "PrebuiltData_" + super.toString();
|
|
1088
|
-
}
|
|
1089
|
-
};
|
|
1090
|
-
var AssetData = class extends $__namespace.Struct {
|
|
1091
|
-
static {
|
|
1092
|
-
chunkUSNT2KNT_cjs.__name(this, "AssetData");
|
|
1093
|
-
}
|
|
1094
|
-
static _capnp = {
|
|
1095
|
-
displayName: "AssetData",
|
|
1096
|
-
id: "da660c6c1fa4c830",
|
|
1097
|
-
size: new $__namespace.ObjectSize(8, 3)
|
|
1098
|
-
};
|
|
1099
|
-
/**
|
|
1100
|
-
* An additional name for the file.
|
|
1101
|
-
*
|
|
1102
|
-
*/
|
|
1103
|
-
get id() {
|
|
1104
|
-
return $__namespace.utils.getText(0, this);
|
|
1105
|
-
}
|
|
1106
|
-
set id(value) {
|
|
1107
|
-
$__namespace.utils.setText(0, value, this);
|
|
1108
|
-
}
|
|
1109
|
-
/**
|
|
1110
|
-
* Indicates whether the file needs a code reference.
|
|
1111
|
-
*
|
|
1112
|
-
*/
|
|
1113
|
-
get name() {
|
|
1114
|
-
return $__namespace.utils.getText(1, this);
|
|
1115
|
-
}
|
|
1116
|
-
set name(value) {
|
|
1117
|
-
$__namespace.utils.setText(1, value, this);
|
|
1118
|
-
}
|
|
1119
|
-
/**
|
|
1120
|
-
* The original file name before any transformations.
|
|
1121
|
-
*
|
|
1122
|
-
*/
|
|
1123
|
-
get needsCodeReference() {
|
|
1124
|
-
return $__namespace.utils.getBit(0, this);
|
|
1125
|
-
}
|
|
1126
|
-
set needsCodeReference(value) {
|
|
1127
|
-
$__namespace.utils.setBit(0, value, this);
|
|
1128
|
-
}
|
|
1129
|
-
get originalFileName() {
|
|
1130
|
-
return $__namespace.utils.getText(2, this);
|
|
1131
|
-
}
|
|
1132
|
-
set originalFileName(value) {
|
|
1133
|
-
$__namespace.utils.setText(2, value, this);
|
|
1134
|
-
}
|
|
1135
|
-
toString() {
|
|
1136
|
-
return "AssetData_" + super.toString();
|
|
1137
|
-
}
|
|
1138
|
-
};
|
|
1139
959
|
var FileId = class extends $__namespace.Struct {
|
|
1140
960
|
static {
|
|
1141
961
|
chunkUSNT2KNT_cjs.__name(this, "FileId");
|
|
@@ -1201,14 +1021,11 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
|
|
|
1201
1021
|
static _capnp = {
|
|
1202
1022
|
displayName: "FileSystem",
|
|
1203
1023
|
id: "ae0c23d43e56abcf",
|
|
1204
|
-
size: new $__namespace.ObjectSize(0,
|
|
1024
|
+
size: new $__namespace.ObjectSize(0, 3)
|
|
1205
1025
|
};
|
|
1206
1026
|
static _Ids;
|
|
1207
1027
|
static _Files;
|
|
1208
1028
|
static _Metadata;
|
|
1209
|
-
static _Assets;
|
|
1210
|
-
static _Chunks;
|
|
1211
|
-
static _Prebuilt;
|
|
1212
1029
|
_adoptIds(value) {
|
|
1213
1030
|
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(0, this));
|
|
1214
1031
|
}
|
|
@@ -1263,60 +1080,6 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
|
|
|
1263
1080
|
set metadata(value) {
|
|
1264
1081
|
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
|
|
1265
1082
|
}
|
|
1266
|
-
_adoptAssets(value) {
|
|
1267
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(3, this));
|
|
1268
|
-
}
|
|
1269
|
-
_disownAssets() {
|
|
1270
|
-
return $__namespace.utils.disown(this.assets);
|
|
1271
|
-
}
|
|
1272
|
-
get assets() {
|
|
1273
|
-
return $__namespace.utils.getList(3, _FileSystem._Assets, this);
|
|
1274
|
-
}
|
|
1275
|
-
_hasAssets() {
|
|
1276
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(3, this));
|
|
1277
|
-
}
|
|
1278
|
-
_initAssets(length) {
|
|
1279
|
-
return $__namespace.utils.initList(3, _FileSystem._Assets, length, this);
|
|
1280
|
-
}
|
|
1281
|
-
set assets(value) {
|
|
1282
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(3, this));
|
|
1283
|
-
}
|
|
1284
|
-
_adoptChunks(value) {
|
|
1285
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(4, this));
|
|
1286
|
-
}
|
|
1287
|
-
_disownChunks() {
|
|
1288
|
-
return $__namespace.utils.disown(this.chunks);
|
|
1289
|
-
}
|
|
1290
|
-
get chunks() {
|
|
1291
|
-
return $__namespace.utils.getList(4, _FileSystem._Chunks, this);
|
|
1292
|
-
}
|
|
1293
|
-
_hasChunks() {
|
|
1294
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(4, this));
|
|
1295
|
-
}
|
|
1296
|
-
_initChunks(length) {
|
|
1297
|
-
return $__namespace.utils.initList(4, _FileSystem._Chunks, length, this);
|
|
1298
|
-
}
|
|
1299
|
-
set chunks(value) {
|
|
1300
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(4, this));
|
|
1301
|
-
}
|
|
1302
|
-
_adoptPrebuilt(value) {
|
|
1303
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(5, this));
|
|
1304
|
-
}
|
|
1305
|
-
_disownPrebuilt() {
|
|
1306
|
-
return $__namespace.utils.disown(this.prebuilt);
|
|
1307
|
-
}
|
|
1308
|
-
get prebuilt() {
|
|
1309
|
-
return $__namespace.utils.getList(5, _FileSystem._Prebuilt, this);
|
|
1310
|
-
}
|
|
1311
|
-
_hasPrebuilt() {
|
|
1312
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(5, this));
|
|
1313
|
-
}
|
|
1314
|
-
_initPrebuilt(length) {
|
|
1315
|
-
return $__namespace.utils.initList(5, _FileSystem._Prebuilt, length, this);
|
|
1316
|
-
}
|
|
1317
|
-
set prebuilt(value) {
|
|
1318
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(5, this));
|
|
1319
|
-
}
|
|
1320
1083
|
toString() {
|
|
1321
1084
|
return "FileSystem_" + super.toString();
|
|
1322
1085
|
}
|
|
@@ -1325,9 +1088,6 @@ FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair)
|
|
|
1325
1088
|
FileSystem._Ids = $__namespace.CompositeList(FileId);
|
|
1326
1089
|
FileSystem._Files = $__namespace.CompositeList(FileData);
|
|
1327
1090
|
FileSystem._Metadata = $__namespace.CompositeList(FileMetadata);
|
|
1328
|
-
FileSystem._Assets = $__namespace.CompositeList(AssetData);
|
|
1329
|
-
FileSystem._Chunks = $__namespace.CompositeList(ChunkData);
|
|
1330
|
-
FileSystem._Prebuilt = $__namespace.CompositeList(PrebuiltData);
|
|
1331
1091
|
var createLog = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((name, options = {}) => {
|
|
1332
1092
|
const logLevel = options.logLevel === null ? types.LogLevelLabel.SILENT : options.logLevel || types.LogLevelLabel.INFO;
|
|
1333
1093
|
if (logLevel === types.LogLevelLabel.SILENT) {
|
|
@@ -1371,13 +1131,9 @@ function isBufferEncoding(options) {
|
|
|
1371
1131
|
}
|
|
1372
1132
|
chunkUSNT2KNT_cjs.__name(isBufferEncoding, "isBufferEncoding");
|
|
1373
1133
|
function isPowerlinesWriteFileOptions(options) {
|
|
1374
|
-
return !isBufferEncoding(options) && isSetObject.isSetObject(options) &&
|
|
1134
|
+
return !isBufferEncoding(options) && isSetObject.isSetObject(options) && "mode" in options && (options.mode === "fs" || options.mode === "virtual");
|
|
1375
1135
|
}
|
|
1376
1136
|
chunkUSNT2KNT_cjs.__name(isPowerlinesWriteFileOptions, "isPowerlinesWriteFileOptions");
|
|
1377
|
-
function isNodeWriteFileOptions(options) {
|
|
1378
|
-
return !isUndefined.isUndefined(options) && (isBufferEncoding(options) || !isPowerlinesWriteFileOptions(options));
|
|
1379
|
-
}
|
|
1380
|
-
chunkUSNT2KNT_cjs.__name(isNodeWriteFileOptions, "isNodeWriteFileOptions");
|
|
1381
1137
|
function isVirtualFileData(obj) {
|
|
1382
1138
|
return !!(isSetObject.isSetObject(obj) && "code" in obj && obj.code);
|
|
1383
1139
|
}
|
|
@@ -1514,6 +1270,18 @@ function patchFS(originalFS, vfs) {
|
|
|
1514
1270
|
};
|
|
1515
1271
|
}
|
|
1516
1272
|
chunkUSNT2KNT_cjs.__name(patchFS, "patchFS");
|
|
1273
|
+
function isValidId(id, prefix = "powerlines") {
|
|
1274
|
+
return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
|
|
1275
|
+
}
|
|
1276
|
+
chunkUSNT2KNT_cjs.__name(isValidId, "isValidId");
|
|
1277
|
+
function normalizeId(id, prefix = "powerlines") {
|
|
1278
|
+
return `${prefix.replace(/:$/, "")}:${toFilePath(id).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(toFilePath(id)), "")}`;
|
|
1279
|
+
}
|
|
1280
|
+
chunkUSNT2KNT_cjs.__name(normalizeId, "normalizeId");
|
|
1281
|
+
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
1282
|
+
return isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1283
|
+
}
|
|
1284
|
+
chunkUSNT2KNT_cjs.__name(normalizePath, "normalizePath");
|
|
1517
1285
|
var UnifiedFS = class _UnifiedFS extends unionfs.Union {
|
|
1518
1286
|
static {
|
|
1519
1287
|
chunkUSNT2KNT_cjs.__name(this, "UnifiedFS");
|
|
@@ -1690,9 +1458,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1690
1458
|
*/
|
|
1691
1459
|
#paths;
|
|
1692
1460
|
/**
|
|
1693
|
-
* A
|
|
1461
|
+
* A cache for module resolution results.
|
|
1694
1462
|
*/
|
|
1695
|
-
#
|
|
1463
|
+
#resolverCache;
|
|
1696
1464
|
/**
|
|
1697
1465
|
* The unified volume that combines the virtual file system with the real file system.
|
|
1698
1466
|
*
|
|
@@ -1727,189 +1495,35 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1727
1495
|
* @returns `true` if the path exists, otherwise `false`.
|
|
1728
1496
|
*/
|
|
1729
1497
|
#existsSync(path) {
|
|
1730
|
-
|
|
1731
|
-
return this.#unifiedFS.virtual.existsSync(formattedPath) || this.#unifiedFS.physical.existsSync(formattedPath) || this.#unifiedFS.resolveFS(path).existsSync(formattedPath);
|
|
1498
|
+
return this.#unifiedFS.virtual.existsSync(this.#normalizePath(path)) || this.#unifiedFS.physical.existsSync(this.#normalizePath(path)) || this.#unifiedFS.resolveFS(path).existsSync(this.#normalizePath(path));
|
|
1732
1499
|
}
|
|
1733
1500
|
/**
|
|
1734
|
-
*
|
|
1501
|
+
* Normalizes a given module id by resolving it against the built-ins path.
|
|
1735
1502
|
*
|
|
1736
|
-
* @param
|
|
1737
|
-
* @returns
|
|
1503
|
+
* @param id - The module id to normalize.
|
|
1504
|
+
* @returns The normalized module id.
|
|
1738
1505
|
*/
|
|
1739
|
-
#
|
|
1740
|
-
|
|
1741
|
-
return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
1506
|
+
#normalizeId(id) {
|
|
1507
|
+
return normalizeId(id, this.#context.config.output.builtinPrefix);
|
|
1742
1508
|
}
|
|
1743
1509
|
/**
|
|
1744
|
-
*
|
|
1510
|
+
* Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
|
|
1745
1511
|
*
|
|
1746
|
-
* @param
|
|
1747
|
-
* @returns The
|
|
1512
|
+
* @param path - The path to normalize.
|
|
1513
|
+
* @returns The normalized path.
|
|
1748
1514
|
*/
|
|
1749
|
-
#
|
|
1750
|
-
|
|
1751
|
-
return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(formattedId), "")}`;
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1755
|
-
*
|
|
1756
|
-
* @param id - The id to resolve.
|
|
1757
|
-
* @returns The resolved file id if it exists, otherwise undefined.
|
|
1758
|
-
*/
|
|
1759
|
-
#resolveId(id) {
|
|
1760
|
-
if (this.#ids[this.#formatId(id)]) {
|
|
1761
|
-
return this.#ids[this.#formatId(id)] || false;
|
|
1762
|
-
}
|
|
1763
|
-
return false;
|
|
1515
|
+
#normalizePath(path) {
|
|
1516
|
+
return normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
|
|
1764
1517
|
}
|
|
1765
1518
|
/**
|
|
1766
|
-
*
|
|
1767
|
-
*
|
|
1768
|
-
* @param path - The path to resolve.
|
|
1769
|
-
* @param options - Optional parameters for resolving the path.
|
|
1770
|
-
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1771
|
-
*/
|
|
1772
|
-
#resolvePath(path, options = {}) {
|
|
1773
|
-
if (isType.isAbsolutePath(path)) {
|
|
1774
|
-
if (this.#existsSync(path)) {
|
|
1775
|
-
return path;
|
|
1776
|
-
}
|
|
1777
|
-
const result = this.#checkVariants(path);
|
|
1778
|
-
if (result) {
|
|
1779
|
-
return result;
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
for (const parentPath of this.#resolveParentPaths(path, options.paths)) {
|
|
1783
|
-
const request = joinPaths.joinPaths(parentPath, path);
|
|
1784
|
-
if (this.#existsSync(request)) {
|
|
1785
|
-
return request;
|
|
1786
|
-
}
|
|
1787
|
-
const result = this.#checkVariants(request);
|
|
1788
|
-
if (result) {
|
|
1789
|
-
return result;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
return false;
|
|
1793
|
-
}
|
|
1794
|
-
/**
|
|
1795
|
-
* Resolves parent paths for a given request.
|
|
1796
|
-
*
|
|
1797
|
-
* @param request - The request path to resolve parent paths for.
|
|
1798
|
-
* @param parents - An optional array of parent paths to consider.
|
|
1799
|
-
* @returns An array of resolved parent paths.
|
|
1800
|
-
*/
|
|
1801
|
-
#resolveParentPaths(request, parents = []) {
|
|
1802
|
-
let paths = [
|
|
1803
|
-
this.#context.workspaceConfig.workspaceRoot,
|
|
1804
|
-
joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
|
|
1805
|
-
];
|
|
1806
|
-
if (this.#context.tsconfig.options.paths) {
|
|
1807
|
-
paths = this.#context.tsconfig.options.paths ? Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => request.startsWith(tsconfigPath.replaceAll("*", ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().reduce((ret, path) => {
|
|
1808
|
-
if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
|
|
1809
|
-
ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
|
|
1810
|
-
}
|
|
1811
|
-
return ret;
|
|
1812
|
-
}, paths) : paths;
|
|
1813
|
-
}
|
|
1814
|
-
return paths.reduce((ret, path) => {
|
|
1815
|
-
if (!ret.includes(path)) {
|
|
1816
|
-
ret.push(path);
|
|
1817
|
-
}
|
|
1818
|
-
return ret;
|
|
1819
|
-
}, parents.filter(Boolean).map((p) => this.formatPath(p)));
|
|
1820
|
-
}
|
|
1821
|
-
/**
|
|
1822
|
-
* Clears the resolver cache for a given path.
|
|
1823
|
-
*
|
|
1824
|
-
* @param path - The path to clear the resolver cache for.
|
|
1825
|
-
*/
|
|
1826
|
-
#clearResolverCache(path) {
|
|
1827
|
-
this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
|
|
1828
|
-
}
|
|
1829
|
-
/**
|
|
1830
|
-
* Check if the file exists with different variants (index, extensions).
|
|
1831
|
-
*
|
|
1832
|
-
* @param request - The request path to check.
|
|
1833
|
-
* @param parentPath - An optional parent path to prepend to the request.
|
|
1834
|
-
* @returns The file path if it exists, otherwise false.
|
|
1835
|
-
*/
|
|
1836
|
-
#checkVariants(request, parentPath) {
|
|
1837
|
-
const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
|
|
1838
|
-
let file = this.#checkExtensions(path);
|
|
1839
|
-
if (file) {
|
|
1840
|
-
return file;
|
|
1841
|
-
}
|
|
1842
|
-
file = this.#checkIndex(path);
|
|
1843
|
-
if (file) {
|
|
1844
|
-
return file;
|
|
1845
|
-
}
|
|
1846
|
-
return false;
|
|
1847
|
-
}
|
|
1848
|
-
/**
|
|
1849
|
-
* Check if the index file exists in the given request path.
|
|
1850
|
-
*
|
|
1851
|
-
* @param request - The request path to check.
|
|
1852
|
-
* @returns The index file path if it exists, otherwise false.
|
|
1853
|
-
*/
|
|
1854
|
-
#checkIndex(request) {
|
|
1855
|
-
let file = joinPaths.joinPaths(request, "index");
|
|
1856
|
-
if (this.#existsSync(file)) {
|
|
1857
|
-
return file;
|
|
1858
|
-
}
|
|
1859
|
-
file = this.#checkExtensions(file);
|
|
1860
|
-
if (file) {
|
|
1861
|
-
return file;
|
|
1862
|
-
}
|
|
1863
|
-
return false;
|
|
1864
|
-
}
|
|
1865
|
-
/**
|
|
1866
|
-
* Check if the file exists with different extensions.
|
|
1519
|
+
* Builds a regular expression from a string pattern for path matching.
|
|
1867
1520
|
*
|
|
1868
|
-
* @param
|
|
1869
|
-
* @returns
|
|
1521
|
+
* @param path - The string pattern to convert.
|
|
1522
|
+
* @returns A regular expression for matching paths.
|
|
1870
1523
|
*/
|
|
1871
|
-
#
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
return file;
|
|
1875
|
-
}
|
|
1876
|
-
file = `${request}.mts`;
|
|
1877
|
-
if (this.#existsSync(file)) {
|
|
1878
|
-
return file;
|
|
1879
|
-
}
|
|
1880
|
-
file = `${request}.cts`;
|
|
1881
|
-
if (this.#existsSync(file)) {
|
|
1882
|
-
return file;
|
|
1883
|
-
}
|
|
1884
|
-
file = `${request}.tsx`;
|
|
1885
|
-
if (this.#existsSync(file)) {
|
|
1886
|
-
return file;
|
|
1887
|
-
}
|
|
1888
|
-
file = `${request}.js`;
|
|
1889
|
-
if (this.#existsSync(file)) {
|
|
1890
|
-
return file;
|
|
1891
|
-
}
|
|
1892
|
-
file = `${request}.mjs`;
|
|
1893
|
-
if (this.#existsSync(file)) {
|
|
1894
|
-
return file;
|
|
1895
|
-
}
|
|
1896
|
-
file = `${request}.cjs`;
|
|
1897
|
-
if (this.#existsSync(file)) {
|
|
1898
|
-
return file;
|
|
1899
|
-
}
|
|
1900
|
-
file = `${request}.jsx`;
|
|
1901
|
-
if (this.#existsSync(file)) {
|
|
1902
|
-
return file;
|
|
1903
|
-
}
|
|
1904
|
-
file = `${request}.json`;
|
|
1905
|
-
if (this.#existsSync(file)) {
|
|
1906
|
-
return file;
|
|
1907
|
-
}
|
|
1908
|
-
file = `${request}.d.ts`;
|
|
1909
|
-
if (this.#existsSync(file)) {
|
|
1910
|
-
return file;
|
|
1911
|
-
}
|
|
1912
|
-
return false;
|
|
1524
|
+
#buildRegex(path) {
|
|
1525
|
+
const token = "::GLOBSTAR::";
|
|
1526
|
+
return new RegExp(`^${this.#normalizePath(path).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
1913
1527
|
}
|
|
1914
1528
|
/**
|
|
1915
1529
|
* Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
@@ -1918,8 +1532,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1918
1532
|
* @returns A promise that resolves to a new virtual file system instance.
|
|
1919
1533
|
*/
|
|
1920
1534
|
static async create(context) {
|
|
1921
|
-
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.
|
|
1922
|
-
const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.
|
|
1535
|
+
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.dataPath, "fs.bin"))) {
|
|
1536
|
+
const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.dataPath, "fs.bin"));
|
|
1923
1537
|
const message2 = new $__namespace.Message(buffer$1, false);
|
|
1924
1538
|
return new _VirtualFileSystem(context, message2.getRoot(FileSystem));
|
|
1925
1539
|
}
|
|
@@ -1933,8 +1547,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1933
1547
|
* @returns A new virtual file system instance.
|
|
1934
1548
|
*/
|
|
1935
1549
|
static createSync(context) {
|
|
1936
|
-
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.
|
|
1937
|
-
const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.
|
|
1550
|
+
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.dataPath, "fs.bin"))) {
|
|
1551
|
+
const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.dataPath, "fs.bin"));
|
|
1938
1552
|
const message2 = new $__namespace.Message(buffer$1, false);
|
|
1939
1553
|
return new _VirtualFileSystem(context, message2.getRoot(FileSystem));
|
|
1940
1554
|
}
|
|
@@ -1945,19 +1559,43 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1945
1559
|
* A map of file ids to their metadata.
|
|
1946
1560
|
*/
|
|
1947
1561
|
get metadata() {
|
|
1948
|
-
return this.#metadata
|
|
1562
|
+
return new Proxy(this.#metadata, {
|
|
1563
|
+
get: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
|
|
1564
|
+
return target[this.#normalizeId(prop)];
|
|
1565
|
+
}, "get")
|
|
1566
|
+
});
|
|
1949
1567
|
}
|
|
1950
1568
|
/**
|
|
1951
|
-
* A map of
|
|
1569
|
+
* A map of file paths to their module ids.
|
|
1952
1570
|
*/
|
|
1953
1571
|
get ids() {
|
|
1954
|
-
return this.#
|
|
1572
|
+
return new Proxy(this.#paths, {
|
|
1573
|
+
get: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
|
|
1574
|
+
return target[this.#normalizePath(prop)];
|
|
1575
|
+
}, "get")
|
|
1576
|
+
});
|
|
1955
1577
|
}
|
|
1956
1578
|
/**
|
|
1957
|
-
* A map of
|
|
1579
|
+
* A map of module ids to their file paths.
|
|
1958
1580
|
*/
|
|
1959
1581
|
get paths() {
|
|
1960
|
-
return this.#paths
|
|
1582
|
+
return new Proxy(this.#paths, {
|
|
1583
|
+
get: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
|
|
1584
|
+
return target[this.#normalizeId(prop)];
|
|
1585
|
+
}, "get")
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
get resolverCache() {
|
|
1589
|
+
if (!this.#resolverCache) {
|
|
1590
|
+
this.#resolverCache = flatCache.create({
|
|
1591
|
+
cacheId: "module-resolution",
|
|
1592
|
+
cacheDir: this.#context.cachePath,
|
|
1593
|
+
ttl: 60 * 60 * 1e3,
|
|
1594
|
+
lruSize: 5e3,
|
|
1595
|
+
persistInterval: 100
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
return this.#resolverCache;
|
|
1961
1599
|
}
|
|
1962
1600
|
/**
|
|
1963
1601
|
* Creates a new instance of the {@link VirtualFileSystem}.
|
|
@@ -2002,17 +1640,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2002
1640
|
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
2003
1641
|
*
|
|
2004
1642
|
* @param pathOrId - The path or id to check.
|
|
2005
|
-
* @param options - Optional parameters for resolving the path.
|
|
2006
1643
|
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
2007
1644
|
*/
|
|
2008
|
-
isVirtual(pathOrId, options = {}) {
|
|
1645
|
+
isVirtual(pathOrId, importer, options = {}) {
|
|
2009
1646
|
if (!pathOrId) {
|
|
2010
1647
|
return false;
|
|
2011
1648
|
}
|
|
2012
|
-
const resolvedPath = this.
|
|
2013
|
-
...options,
|
|
2014
|
-
pathType: "file"
|
|
2015
|
-
});
|
|
1649
|
+
const resolvedPath = this.resolveSync(pathOrId, importer, options);
|
|
2016
1650
|
if (!resolvedPath) {
|
|
2017
1651
|
return false;
|
|
2018
1652
|
}
|
|
@@ -2022,17 +1656,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2022
1656
|
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
2023
1657
|
*
|
|
2024
1658
|
* @param pathOrId - The path or id to check.
|
|
2025
|
-
* @param options - Optional parameters for resolving the path.
|
|
2026
1659
|
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
2027
1660
|
*/
|
|
2028
|
-
isPhysical(pathOrId, options = {}) {
|
|
1661
|
+
isPhysical(pathOrId, importer, options = {}) {
|
|
2029
1662
|
if (!pathOrId) {
|
|
2030
1663
|
return false;
|
|
2031
1664
|
}
|
|
2032
|
-
const resolvedPath = this.
|
|
2033
|
-
...options,
|
|
2034
|
-
pathType: "file"
|
|
2035
|
-
});
|
|
1665
|
+
const resolvedPath = this.resolveSync(pathOrId, importer, options);
|
|
2036
1666
|
if (!resolvedPath) {
|
|
2037
1667
|
return false;
|
|
2038
1668
|
}
|
|
@@ -2054,16 +1684,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2054
1684
|
* @param path - The path to create the directory at.
|
|
2055
1685
|
*/
|
|
2056
1686
|
unlinkSync(path, options) {
|
|
2057
|
-
|
|
2058
|
-
if (!this.isFile(formattedPath)) {
|
|
1687
|
+
if (!this.isFile(this.#normalizePath(path))) {
|
|
2059
1688
|
return;
|
|
2060
1689
|
}
|
|
2061
|
-
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${
|
|
2062
|
-
this.#unifiedFS.resolveFS(path, options).unlinkSync(
|
|
2063
|
-
if (this
|
|
2064
|
-
delete this
|
|
1690
|
+
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${this.#normalizePath(path)}`);
|
|
1691
|
+
this.#unifiedFS.resolveFS(path, options).unlinkSync(this.#normalizePath(path));
|
|
1692
|
+
if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
|
|
1693
|
+
delete this.#metadata[this.#ids[this.#normalizePath(path)]];
|
|
1694
|
+
delete this.#ids[this.#normalizePath(path)];
|
|
1695
|
+
delete this.#paths[this.#normalizeId(path)];
|
|
1696
|
+
this.#resolverCache.delete(this.#normalizePath(path));
|
|
2065
1697
|
}
|
|
2066
|
-
this.#clearResolverCache(formattedPath);
|
|
2067
1698
|
}
|
|
2068
1699
|
/**
|
|
2069
1700
|
* Removes a file in the virtual file system (VFS).
|
|
@@ -2071,19 +1702,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2071
1702
|
* @param path - The path to create the directory at.
|
|
2072
1703
|
*/
|
|
2073
1704
|
async unlink(path, options) {
|
|
2074
|
-
|
|
2075
|
-
if (!this.isFile(formattedPath)) {
|
|
1705
|
+
if (!this.isFile(this.#normalizePath(path))) {
|
|
2076
1706
|
return;
|
|
2077
1707
|
}
|
|
2078
|
-
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${
|
|
1708
|
+
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${this.#normalizePath(path)}`);
|
|
2079
1709
|
if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
|
|
2080
|
-
await this.#unifiedFS.resolveFS(path, options).promises.unlink(
|
|
2081
|
-
if (this
|
|
2082
|
-
delete this
|
|
1710
|
+
await this.#unifiedFS.resolveFS(path, options).promises.unlink(this.#normalizePath(path));
|
|
1711
|
+
if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
|
|
1712
|
+
delete this.#metadata[this.#ids[this.#normalizePath(path)]];
|
|
2083
1713
|
}
|
|
2084
|
-
this.#clearResolverCache(formattedPath);
|
|
2085
1714
|
} else {
|
|
2086
|
-
this.unlinkSync(
|
|
1715
|
+
this.unlinkSync(this.#normalizePath(path), options);
|
|
2087
1716
|
}
|
|
2088
1717
|
}
|
|
2089
1718
|
/**
|
|
@@ -2093,15 +1722,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2093
1722
|
* @param options - Options for creating the directory.
|
|
2094
1723
|
*/
|
|
2095
1724
|
rmdirSync(path, options = {}) {
|
|
2096
|
-
|
|
2097
|
-
if (!this.isDirectory(formattedPath)) {
|
|
1725
|
+
if (!this.isDirectory(this.#normalizePath(path))) {
|
|
2098
1726
|
return;
|
|
2099
1727
|
}
|
|
2100
|
-
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${
|
|
2101
|
-
this.#unifiedFS.resolveFS(path, options).rmdirSync(
|
|
1728
|
+
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${this.#normalizePath(path)}`);
|
|
1729
|
+
this.#unifiedFS.resolveFS(path, options).rmdirSync(this.#normalizePath(path), defu6__default.default(options, {
|
|
2102
1730
|
recursive: true
|
|
2103
1731
|
}));
|
|
2104
|
-
this.#clearResolverCache(formattedPath);
|
|
2105
1732
|
}
|
|
2106
1733
|
/**
|
|
2107
1734
|
* Removes a directory in the virtual file system (VFS).
|
|
@@ -2111,19 +1738,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2111
1738
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
2112
1739
|
*/
|
|
2113
1740
|
async rmdir(path, options = {}) {
|
|
2114
|
-
|
|
2115
|
-
if (!this.isDirectory(formattedPath)) {
|
|
1741
|
+
if (!this.isDirectory(this.#normalizePath(path))) {
|
|
2116
1742
|
return;
|
|
2117
1743
|
}
|
|
2118
|
-
this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${
|
|
1744
|
+
this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${this.#normalizePath(path)}`);
|
|
2119
1745
|
if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
|
|
2120
|
-
await this.#unifiedFS.resolveFS(path, options).promises.rm(
|
|
1746
|
+
await this.#unifiedFS.resolveFS(path, options).promises.rm(this.#normalizePath(path), defu6__default.default(options, {
|
|
2121
1747
|
force: true,
|
|
2122
1748
|
recursive: true
|
|
2123
1749
|
}));
|
|
2124
|
-
this.#clearResolverCache(formattedPath);
|
|
2125
1750
|
} else {
|
|
2126
|
-
this.rmdirSync(
|
|
1751
|
+
this.rmdirSync(this.#normalizePath(path), defu6__default.default(options ?? {}, {
|
|
2127
1752
|
force: true,
|
|
2128
1753
|
recursive: true
|
|
2129
1754
|
}));
|
|
@@ -2137,11 +1762,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2137
1762
|
* @returns A promise that resolves when the file is removed.
|
|
2138
1763
|
*/
|
|
2139
1764
|
async rm(path, options = {}) {
|
|
2140
|
-
this.#log(types.LogLevelLabel.TRACE, `Removing: ${
|
|
2141
|
-
if (this.isDirectory(path)) {
|
|
2142
|
-
return this.rmdir(path, options);
|
|
1765
|
+
this.#log(types.LogLevelLabel.TRACE, `Removing: ${this.#normalizePath(path)}`);
|
|
1766
|
+
if (this.isDirectory(this.#normalizePath(path))) {
|
|
1767
|
+
return this.rmdir(this.#normalizePath(path), options);
|
|
2143
1768
|
}
|
|
2144
|
-
return this.unlink(path, options);
|
|
1769
|
+
return this.unlink(this.#normalizePath(path), options);
|
|
2145
1770
|
}
|
|
2146
1771
|
/**
|
|
2147
1772
|
* Synchronously removes a file or directory in the virtual file system (VFS).
|
|
@@ -2150,11 +1775,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2150
1775
|
* @param options - Options for removing the file or directory.
|
|
2151
1776
|
*/
|
|
2152
1777
|
rmSync(path, options = {}) {
|
|
2153
|
-
this.#log(types.LogLevelLabel.TRACE, `Removing: ${
|
|
2154
|
-
if (this.isDirectory(path)) {
|
|
2155
|
-
return this.rmdirSync(path, options);
|
|
1778
|
+
this.#log(types.LogLevelLabel.TRACE, `Removing: ${this.#normalizePath(path)}`);
|
|
1779
|
+
if (this.isDirectory(this.#normalizePath(path))) {
|
|
1780
|
+
return this.rmdirSync(this.#normalizePath(path), options);
|
|
2156
1781
|
}
|
|
2157
|
-
return this.unlinkSync(path, options);
|
|
1782
|
+
return this.unlinkSync(this.#normalizePath(path), options);
|
|
2158
1783
|
}
|
|
2159
1784
|
/**
|
|
2160
1785
|
* Creates a directory in the virtual file system (VFS).
|
|
@@ -2164,9 +1789,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2164
1789
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
2165
1790
|
*/
|
|
2166
1791
|
mkdirSync(path, options = {}) {
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
1792
|
+
return this.#unifiedFS.resolveFS(this.#normalizePath(path), options).mkdirSync(this.#normalizePath(path), defu6__default.default(omit.omit(options, [
|
|
1793
|
+
"mode"
|
|
1794
|
+
]), {
|
|
2170
1795
|
recursive: true
|
|
2171
1796
|
}));
|
|
2172
1797
|
}
|
|
@@ -2179,17 +1804,19 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2179
1804
|
*/
|
|
2180
1805
|
async mkdir(path, options = {}) {
|
|
2181
1806
|
let result;
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
1807
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(this.#normalizePath(path), options).promises.mkdir)) {
|
|
1808
|
+
result = await this.#unifiedFS.resolveFS(this.#normalizePath(path), options).promises.mkdir(this.#normalizePath(path), defu6__default.default(omit.omit(options, [
|
|
1809
|
+
"mode"
|
|
1810
|
+
]), {
|
|
2185
1811
|
recursive: true
|
|
2186
1812
|
}));
|
|
2187
1813
|
} else {
|
|
2188
|
-
result = this.#unifiedFS.resolveFS(
|
|
1814
|
+
result = this.#unifiedFS.resolveFS(this.#normalizePath(path), options).mkdirSync(this.#normalizePath(path), defu6__default.default(omit.omit(options, [
|
|
1815
|
+
"mode"
|
|
1816
|
+
]), {
|
|
2189
1817
|
recursive: true
|
|
2190
1818
|
}));
|
|
2191
1819
|
}
|
|
2192
|
-
this.#clearResolverCache(filePath);
|
|
2193
1820
|
return result;
|
|
2194
1821
|
}
|
|
2195
1822
|
/**
|
|
@@ -2201,17 +1828,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2201
1828
|
async glob(patterns) {
|
|
2202
1829
|
const results = [];
|
|
2203
1830
|
for (const pattern of toArray.toArray(patterns)) {
|
|
2204
|
-
const normalized = this
|
|
1831
|
+
const normalized = this.#normalizePath(pattern);
|
|
2205
1832
|
if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
|
|
2206
|
-
const resolved = this.
|
|
2207
|
-
pathType: "file"
|
|
2208
|
-
});
|
|
1833
|
+
const resolved = this.resolveSync(normalized);
|
|
2209
1834
|
if (resolved && !results.includes(resolved)) {
|
|
2210
1835
|
results.push(resolved);
|
|
2211
1836
|
}
|
|
2212
1837
|
continue;
|
|
2213
1838
|
}
|
|
2214
|
-
const absPattern = isType.isAbsolutePath(normalized) ? normalized : this
|
|
1839
|
+
const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
|
|
2215
1840
|
const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
|
|
2216
1841
|
const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
|
|
2217
1842
|
const stack = [
|
|
@@ -2226,7 +1851,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2226
1851
|
continue;
|
|
2227
1852
|
}
|
|
2228
1853
|
for (const entry of entries) {
|
|
2229
|
-
const full = this
|
|
1854
|
+
const full = this.#normalizePath(joinPaths.joinPaths(dir, entry));
|
|
2230
1855
|
let stats;
|
|
2231
1856
|
try {
|
|
2232
1857
|
stats = this.#unifiedFS.lstatSync(full);
|
|
@@ -2238,9 +1863,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2238
1863
|
stack.push(full);
|
|
2239
1864
|
} else if (stats.isFile()) {
|
|
2240
1865
|
if (this.#buildRegex(absPattern).test(full)) {
|
|
2241
|
-
const resolved = this.
|
|
2242
|
-
pathType: "file"
|
|
2243
|
-
});
|
|
1866
|
+
const resolved = this.resolveSync(full);
|
|
2244
1867
|
if (resolved && !results.includes(resolved)) {
|
|
2245
1868
|
results.push(resolved);
|
|
2246
1869
|
}
|
|
@@ -2260,17 +1883,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2260
1883
|
globSync(patterns) {
|
|
2261
1884
|
const results = [];
|
|
2262
1885
|
for (const pattern of toArray.toArray(patterns)) {
|
|
2263
|
-
const normalized = this
|
|
1886
|
+
const normalized = this.#normalizePath(pattern);
|
|
2264
1887
|
if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
|
|
2265
|
-
const resolved = this.
|
|
2266
|
-
pathType: "file"
|
|
2267
|
-
});
|
|
1888
|
+
const resolved = this.resolveSync(normalized);
|
|
2268
1889
|
if (resolved && !results.includes(resolved)) {
|
|
2269
1890
|
results.push(resolved);
|
|
2270
1891
|
}
|
|
2271
1892
|
continue;
|
|
2272
1893
|
}
|
|
2273
|
-
const absPattern = isType.isAbsolutePath(normalized) ? normalized : this
|
|
1894
|
+
const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
|
|
2274
1895
|
const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
|
|
2275
1896
|
const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
|
|
2276
1897
|
const stack = [
|
|
@@ -2285,7 +1906,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2285
1906
|
continue;
|
|
2286
1907
|
}
|
|
2287
1908
|
for (const entry of entries) {
|
|
2288
|
-
const full = this
|
|
1909
|
+
const full = this.#normalizePath(joinPaths.joinPaths(dir, entry));
|
|
2289
1910
|
let stats;
|
|
2290
1911
|
try {
|
|
2291
1912
|
stats = this.#unifiedFS.lstatSync(full);
|
|
@@ -2297,9 +1918,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2297
1918
|
stack.push(full);
|
|
2298
1919
|
} else if (stats.isFile()) {
|
|
2299
1920
|
if (this.#buildRegex(absPattern).test(full)) {
|
|
2300
|
-
const resolved = this.
|
|
2301
|
-
pathType: "file"
|
|
2302
|
-
});
|
|
1921
|
+
const resolved = this.resolveSync(full);
|
|
2303
1922
|
if (resolved && !results.includes(resolved)) {
|
|
2304
1923
|
results.push(resolved);
|
|
2305
1924
|
}
|
|
@@ -2369,21 +1988,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2369
1988
|
* @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
|
|
2370
1989
|
*/
|
|
2371
1990
|
async readFile(pathOrId, options = "utf8") {
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
}
|
|
2375
|
-
const filePath = this.resolve(toFilePath(pathOrId), {
|
|
2376
|
-
pathType: "file"
|
|
2377
|
-
});
|
|
2378
|
-
if (filePath) {
|
|
1991
|
+
const filePath = await this.resolve(pathOrId);
|
|
1992
|
+
if (filePath && this.isFile(filePath)) {
|
|
2379
1993
|
let result;
|
|
2380
1994
|
if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
|
|
2381
1995
|
result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
|
|
2382
1996
|
} else {
|
|
2383
1997
|
result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
2384
1998
|
}
|
|
2385
|
-
|
|
2386
|
-
return content;
|
|
1999
|
+
return isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
|
|
2387
2000
|
}
|
|
2388
2001
|
return void 0;
|
|
2389
2002
|
}
|
|
@@ -2394,16 +2007,10 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2394
2007
|
* @returns The contents of the file as a string, or undefined if the file does not exist.
|
|
2395
2008
|
*/
|
|
2396
2009
|
readFileSync(pathOrId, options = "utf8") {
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
}
|
|
2400
|
-
const filePath = this.resolve(toFilePath(pathOrId), {
|
|
2401
|
-
pathType: "file"
|
|
2402
|
-
});
|
|
2403
|
-
if (filePath) {
|
|
2010
|
+
const filePath = this.resolveSync(pathOrId);
|
|
2011
|
+
if (filePath && this.isFile(filePath)) {
|
|
2404
2012
|
const result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
2405
|
-
|
|
2406
|
-
return content;
|
|
2013
|
+
return isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
|
|
2407
2014
|
}
|
|
2408
2015
|
return void 0;
|
|
2409
2016
|
}
|
|
@@ -2416,34 +2023,40 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2416
2023
|
* @returns A promise that resolves when the file is written.
|
|
2417
2024
|
*/
|
|
2418
2025
|
async writeFile(path, data = "", options = "utf8") {
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
await this.mkdir(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2026
|
+
if (!this.isDirectory(filePathFns.findFilePath(this.#normalizePath(path)))) {
|
|
2027
|
+
await this.mkdir(filePathFns.findFilePath(this.#normalizePath(path)), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2422
2028
|
}
|
|
2423
|
-
|
|
2029
|
+
const metadata = isVirtualFileData(data) ? data : {};
|
|
2030
|
+
metadata.id = this.#normalizeId(path);
|
|
2031
|
+
let code = isVirtualFileData(data) ? metadata.code : data;
|
|
2424
2032
|
if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString.isSetString(code)) {
|
|
2425
|
-
const resolvedConfig = await prettier.resolveConfig(
|
|
2033
|
+
const resolvedConfig = await prettier.resolveConfig(this.#normalizePath(path));
|
|
2426
2034
|
if (resolvedConfig) {
|
|
2427
2035
|
code = await prettier.format(code, {
|
|
2428
|
-
absolutePath:
|
|
2036
|
+
absolutePath: this.#normalizePath(path),
|
|
2429
2037
|
...resolvedConfig
|
|
2430
2038
|
});
|
|
2431
2039
|
}
|
|
2432
2040
|
}
|
|
2433
|
-
const outputMode = this.#unifiedFS.resolveMode(
|
|
2434
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${
|
|
2435
|
-
this
|
|
2041
|
+
const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2042
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
2043
|
+
this.#metadata[metadata.id] = {
|
|
2436
2044
|
mode: outputMode,
|
|
2437
2045
|
variant: "normal",
|
|
2438
2046
|
timestamp: Date.now(),
|
|
2439
|
-
...
|
|
2047
|
+
...metadata
|
|
2440
2048
|
};
|
|
2441
|
-
this.#
|
|
2442
|
-
|
|
2049
|
+
this.#paths[metadata.id] = this.#normalizePath(path);
|
|
2050
|
+
this.#ids[this.#normalizePath(path)] = metadata.id;
|
|
2051
|
+
const ifs = this.#unifiedFS.resolveFS(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2443
2052
|
if (isFunction.isFunction(ifs.promises.writeFile)) {
|
|
2444
|
-
return ifs.promises.writeFile(
|
|
2053
|
+
return ifs.promises.writeFile(this.#normalizePath(path), code, isSetObject.isSetObject(options) ? omit.omit(options, [
|
|
2054
|
+
"mode"
|
|
2055
|
+
]) : "utf8");
|
|
2445
2056
|
}
|
|
2446
|
-
return ifs.writeFileSync(
|
|
2057
|
+
return ifs.writeFileSync(this.#normalizePath(path), code, isSetObject.isSetObject(options) ? omit.omit(options, [
|
|
2058
|
+
"mode"
|
|
2059
|
+
]) : "utf8");
|
|
2447
2060
|
}
|
|
2448
2061
|
/**
|
|
2449
2062
|
* Synchronously writes a file to the virtual file system (VFS).
|
|
@@ -2453,21 +2066,23 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2453
2066
|
* @param options - Optional parameters for writing the file.
|
|
2454
2067
|
*/
|
|
2455
2068
|
writeFileSync(path, data = "", options = "utf8") {
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
|
-
const
|
|
2462
|
-
this.#
|
|
2463
|
-
this.
|
|
2069
|
+
if (!this.isDirectory(filePathFns.findFilePath(this.#normalizePath(path)))) {
|
|
2070
|
+
this.mkdirSync(filePathFns.findFilePath(this.#normalizePath(path)), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2071
|
+
}
|
|
2072
|
+
const metadata = isVirtualFileData(data) ? data : {};
|
|
2073
|
+
metadata.id = this.#normalizeId(path);
|
|
2074
|
+
const code = isVirtualFileData(data) ? metadata.code : data;
|
|
2075
|
+
const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2076
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
2077
|
+
this.#metadata[metadata.id] = {
|
|
2464
2078
|
mode: outputMode,
|
|
2465
2079
|
variant: "normal",
|
|
2466
2080
|
timestamp: Date.now(),
|
|
2467
|
-
...
|
|
2081
|
+
...metadata
|
|
2468
2082
|
};
|
|
2469
|
-
this.#
|
|
2470
|
-
|
|
2083
|
+
this.#paths[metadata.id] = this.#normalizePath(path);
|
|
2084
|
+
this.#ids[this.#normalizePath(path)] = metadata.id;
|
|
2085
|
+
const writeStream = this.#unifiedFS.resolveFS(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(this.#normalizePath(path));
|
|
2471
2086
|
try {
|
|
2472
2087
|
writeStream.write(code);
|
|
2473
2088
|
} finally {
|
|
@@ -2481,7 +2096,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2481
2096
|
* @returns `true` if the file exists, otherwise `false`.
|
|
2482
2097
|
*/
|
|
2483
2098
|
existsSync(pathOrId) {
|
|
2484
|
-
return this.
|
|
2099
|
+
return !!this.resolveSync(pathOrId);
|
|
2485
2100
|
}
|
|
2486
2101
|
/**
|
|
2487
2102
|
* Retrieves the metadata of a file in the virtual file system (VFS).
|
|
@@ -2490,7 +2105,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2490
2105
|
* @returns The metadata of the file, or undefined if the file does not exist.
|
|
2491
2106
|
*/
|
|
2492
2107
|
getMetadata(pathOrId) {
|
|
2493
|
-
const resolved = this.
|
|
2108
|
+
const resolved = this.resolveSync(pathOrId);
|
|
2494
2109
|
if (resolved && this.metadata[resolved]) {
|
|
2495
2110
|
return this.metadata[resolved];
|
|
2496
2111
|
}
|
|
@@ -2506,7 +2121,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2506
2121
|
* @returns `true` if the file exists, otherwise `false`.
|
|
2507
2122
|
*/
|
|
2508
2123
|
isFile(pathOrId) {
|
|
2509
|
-
const resolved = this.
|
|
2124
|
+
const resolved = this.resolveSync(pathOrId);
|
|
2510
2125
|
return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isFile() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isFile() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isFile()));
|
|
2511
2126
|
}
|
|
2512
2127
|
/**
|
|
@@ -2516,7 +2131,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2516
2131
|
* @returns `true` if the directory exists, otherwise `false`.
|
|
2517
2132
|
*/
|
|
2518
2133
|
isDirectory(pathOrId) {
|
|
2519
|
-
const resolved = this.
|
|
2134
|
+
const resolved = this.resolveSync(pathOrId);
|
|
2520
2135
|
return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isDirectory() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isDirectory() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isDirectory()));
|
|
2521
2136
|
}
|
|
2522
2137
|
/**
|
|
@@ -2526,7 +2141,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2526
2141
|
* @returns A promise that resolves to the file's status information, or false if the file does not exist.
|
|
2527
2142
|
*/
|
|
2528
2143
|
async stat(pathOrId, options) {
|
|
2529
|
-
return this.#unifiedFS.resolveFS(pathOrId).promises.stat(this.resolve(
|
|
2144
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.stat(await this.resolve(pathOrId) || pathOrId, options);
|
|
2530
2145
|
}
|
|
2531
2146
|
/**
|
|
2532
2147
|
* Synchronously retrieves the status of a file in the virtual file system (VFS).
|
|
@@ -2535,7 +2150,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2535
2150
|
* @returns The file's status information, or false if the file does not exist.
|
|
2536
2151
|
*/
|
|
2537
2152
|
statSync(pathOrId) {
|
|
2538
|
-
return this.#unifiedFS.resolveFS(pathOrId).statSync(this.
|
|
2153
|
+
return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolveSync(pathOrId) || pathOrId);
|
|
2539
2154
|
}
|
|
2540
2155
|
/**
|
|
2541
2156
|
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
@@ -2544,7 +2159,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2544
2159
|
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
2545
2160
|
*/
|
|
2546
2161
|
async lstat(pathOrId, options) {
|
|
2547
|
-
return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(this.resolve(
|
|
2162
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(await this.resolve(pathOrId) || pathOrId, options);
|
|
2548
2163
|
}
|
|
2549
2164
|
/**
|
|
2550
2165
|
* Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
@@ -2553,7 +2168,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2553
2168
|
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
2554
2169
|
*/
|
|
2555
2170
|
lstatSync(pathOrId, options) {
|
|
2556
|
-
return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.
|
|
2171
|
+
return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolveSync(pathOrId) || pathOrId, options);
|
|
2557
2172
|
}
|
|
2558
2173
|
/**
|
|
2559
2174
|
* Resolves a path or ID to its real path in the virtual file system (VFS).
|
|
@@ -2562,52 +2177,113 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2562
2177
|
* @returns The resolved real path if it exists, otherwise undefined.
|
|
2563
2178
|
*/
|
|
2564
2179
|
realpathSync(pathOrId) {
|
|
2565
|
-
const filePath = this.
|
|
2180
|
+
const filePath = this.resolveSync(pathOrId);
|
|
2566
2181
|
if (!filePath) {
|
|
2567
|
-
throw new Error(`File not found: ${
|
|
2182
|
+
throw new Error(`File not found: ${pathOrId}`);
|
|
2568
2183
|
}
|
|
2569
2184
|
return filePath;
|
|
2570
2185
|
}
|
|
2571
2186
|
/**
|
|
2572
|
-
*
|
|
2187
|
+
* A helper function to resolve modules in the virtual file system (VFS).
|
|
2573
2188
|
*
|
|
2574
|
-
* @
|
|
2575
|
-
*
|
|
2576
|
-
*
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2189
|
+
* @remarks
|
|
2190
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
2191
|
+
*
|
|
2192
|
+
* @example
|
|
2193
|
+
* ```ts
|
|
2194
|
+
* const resolved = await context.resolvePath("some-module", "/path/to/importer");
|
|
2195
|
+
* ```
|
|
2196
|
+
*
|
|
2197
|
+
* @param id - The module to resolve.
|
|
2198
|
+
* @param importer - An optional path to the importer module.
|
|
2199
|
+
* @param options - Additional resolution options.
|
|
2200
|
+
* @returns A promise that resolves to the resolved module path.
|
|
2201
|
+
*/
|
|
2202
|
+
async resolve(id, importer, options = {}) {
|
|
2203
|
+
let result = this.resolverCache.get(this.#normalizeId(id));
|
|
2204
|
+
if (result) {
|
|
2205
|
+
return result;
|
|
2587
2206
|
}
|
|
2207
|
+
result = this.paths[this.#normalizeId(id)];
|
|
2588
2208
|
if (!result) {
|
|
2589
|
-
|
|
2209
|
+
const paths = options.paths ?? [];
|
|
2210
|
+
if (importer && !paths.includes(importer)) {
|
|
2211
|
+
paths.push(importer);
|
|
2212
|
+
}
|
|
2213
|
+
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2214
|
+
paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot));
|
|
2215
|
+
paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.sourceRoot));
|
|
2216
|
+
paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2217
|
+
for (const combination of resolve.getResolutionCombinations(id, {
|
|
2218
|
+
paths
|
|
2219
|
+
})) {
|
|
2220
|
+
if (this.#existsSync(combination)) {
|
|
2221
|
+
result = combination;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
try {
|
|
2225
|
+
result = await resolve.resolve(id, {
|
|
2226
|
+
paths
|
|
2227
|
+
});
|
|
2228
|
+
} catch {
|
|
2229
|
+
}
|
|
2590
2230
|
}
|
|
2591
|
-
if (result
|
|
2592
|
-
|
|
2231
|
+
if (result) {
|
|
2232
|
+
result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
|
|
2233
|
+
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2593
2234
|
}
|
|
2594
|
-
this.#cachedResolver.set(resolverKey, result);
|
|
2595
2235
|
return result;
|
|
2596
2236
|
}
|
|
2597
2237
|
/**
|
|
2598
|
-
*
|
|
2238
|
+
* A synchronous helper function to resolve modules using the Jiti resolver
|
|
2599
2239
|
*
|
|
2600
|
-
* @
|
|
2601
|
-
*
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2240
|
+
* @remarks
|
|
2241
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
2242
|
+
*
|
|
2243
|
+
* @example
|
|
2244
|
+
* ```ts
|
|
2245
|
+
* const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
|
|
2246
|
+
* ```
|
|
2247
|
+
*
|
|
2248
|
+
* @param id - The module to resolve.
|
|
2249
|
+
* @param importer - An optional path to the importer module.
|
|
2250
|
+
* @param options - Additional resolution options.
|
|
2251
|
+
* @returns The resolved module path.
|
|
2252
|
+
*/
|
|
2253
|
+
resolveSync(id, importer, options = {}) {
|
|
2254
|
+
let result = this.resolverCache.get(this.#normalizeId(id));
|
|
2255
|
+
if (result) {
|
|
2256
|
+
return result;
|
|
2257
|
+
}
|
|
2258
|
+
result = this.paths[this.#normalizeId(id)];
|
|
2259
|
+
if (!result) {
|
|
2260
|
+
const paths = options.paths ?? [];
|
|
2261
|
+
if (importer && !paths.includes(importer)) {
|
|
2262
|
+
paths.push(importer);
|
|
2263
|
+
}
|
|
2264
|
+
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2265
|
+
paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot));
|
|
2266
|
+
paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.sourceRoot));
|
|
2267
|
+
paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2268
|
+
for (const combination of resolve.getResolutionCombinations(id, {
|
|
2269
|
+
paths
|
|
2270
|
+
})) {
|
|
2271
|
+
if (this.#existsSync(combination)) {
|
|
2272
|
+
result = combination;
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
try {
|
|
2276
|
+
result = resolve.resolveSync(id, {
|
|
2277
|
+
paths
|
|
2278
|
+
});
|
|
2279
|
+
} catch {
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
if (result) {
|
|
2283
|
+
result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
|
|
2284
|
+
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2609
2285
|
}
|
|
2610
|
-
return
|
|
2286
|
+
return result;
|
|
2611
2287
|
}
|
|
2612
2288
|
/**
|
|
2613
2289
|
* Disposes of the virtual file system (VFS) by saving its state to disk.
|
|
@@ -2616,7 +2292,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2616
2292
|
if (!this.#isDisposed) {
|
|
2617
2293
|
this.#isDisposed = true;
|
|
2618
2294
|
this.#log(types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
|
|
2619
|
-
await this.unlink(joinPaths.joinPaths(this.#context.
|
|
2295
|
+
await this.unlink(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"));
|
|
2620
2296
|
const message = new $__namespace.Message();
|
|
2621
2297
|
const fs2 = message.initRoot(FileSystem);
|
|
2622
2298
|
const virtualFS = this.#unifiedFS.toJSON();
|
|
@@ -2625,7 +2301,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2625
2301
|
virtualFiles.forEach(([path, code], index) => {
|
|
2626
2302
|
const fd = files.get(index);
|
|
2627
2303
|
fd.path = path;
|
|
2628
|
-
fd.code = code;
|
|
2304
|
+
fd.code = code || "";
|
|
2629
2305
|
});
|
|
2630
2306
|
const ids = fs2._initIds(Object.keys(this.ids).length);
|
|
2631
2307
|
Object.entries(this.ids).forEach(([id, path], index) => {
|
|
@@ -2649,7 +2325,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2649
2325
|
});
|
|
2650
2326
|
}
|
|
2651
2327
|
});
|
|
2652
|
-
await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.
|
|
2328
|
+
await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
|
|
2329
|
+
this.#resolverCache.save(true);
|
|
2330
|
+
this.#log(types.LogLevelLabel.DEBUG, "Virtual file system disposed.");
|
|
2653
2331
|
}
|
|
2654
2332
|
}
|
|
2655
2333
|
/**
|
|
@@ -2677,6 +2355,105 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2677
2355
|
return this.dispose();
|
|
2678
2356
|
}
|
|
2679
2357
|
};
|
|
2358
|
+
var VirtualFileSystemHost = class VirtualFileSystemHost2 extends tsMorph.InMemoryFileSystemHost {
|
|
2359
|
+
static {
|
|
2360
|
+
chunkUSNT2KNT_cjs.__name(this, "VirtualFileSystemHost");
|
|
2361
|
+
}
|
|
2362
|
+
#fs;
|
|
2363
|
+
constructor(fs2) {
|
|
2364
|
+
super();
|
|
2365
|
+
this.#fs = fs2;
|
|
2366
|
+
}
|
|
2367
|
+
deleteSync(path) {
|
|
2368
|
+
this.#fs.rmSync(path);
|
|
2369
|
+
}
|
|
2370
|
+
readDirSync(dirPath) {
|
|
2371
|
+
return this.#fs.readdirSync(dirPath).reduce((ret, entry) => {
|
|
2372
|
+
const fullPath = this.#fs.resolveSync(join.joinPaths(dirPath, entry));
|
|
2373
|
+
if (fullPath) {
|
|
2374
|
+
ret.push({
|
|
2375
|
+
name: entry,
|
|
2376
|
+
isDirectory: this.#fs.isDirectory(fullPath),
|
|
2377
|
+
isFile: this.#fs.isFile(fullPath),
|
|
2378
|
+
isSymlink: false
|
|
2379
|
+
});
|
|
2380
|
+
}
|
|
2381
|
+
return ret;
|
|
2382
|
+
}, []);
|
|
2383
|
+
}
|
|
2384
|
+
async readFile(filePath) {
|
|
2385
|
+
if (!this.#fs.existsSync(filePath)) {
|
|
2386
|
+
throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
|
|
2387
|
+
}
|
|
2388
|
+
return await this.#fs.readFile(filePath);
|
|
2389
|
+
}
|
|
2390
|
+
readFileSync(filePath) {
|
|
2391
|
+
if (!this.#fs.existsSync(filePath)) {
|
|
2392
|
+
throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
|
|
2393
|
+
}
|
|
2394
|
+
return this.#fs.readFileSync(filePath);
|
|
2395
|
+
}
|
|
2396
|
+
async writeFile(filePath, fileText) {
|
|
2397
|
+
return this.#fs.writeFile(filePath, fileText);
|
|
2398
|
+
}
|
|
2399
|
+
writeFileSync(filePath, fileText) {
|
|
2400
|
+
this.#fs.writeFileSync(filePath, fileText);
|
|
2401
|
+
}
|
|
2402
|
+
async mkdir(dirPath) {
|
|
2403
|
+
await this.#fs.mkdir(dirPath);
|
|
2404
|
+
}
|
|
2405
|
+
mkdirSync(dirPath) {
|
|
2406
|
+
this.#fs.mkdirSync(dirPath);
|
|
2407
|
+
}
|
|
2408
|
+
async move(srcPath, destPath) {
|
|
2409
|
+
await this.#fs.move(srcPath, destPath);
|
|
2410
|
+
}
|
|
2411
|
+
moveSync(srcPath, destPath) {
|
|
2412
|
+
this.#fs.moveSync(srcPath, destPath);
|
|
2413
|
+
}
|
|
2414
|
+
async copy(srcPath, destPath) {
|
|
2415
|
+
await this.#fs.copy(srcPath, destPath);
|
|
2416
|
+
}
|
|
2417
|
+
copySync(srcPath, destPath) {
|
|
2418
|
+
this.#fs.copySync(srcPath, destPath);
|
|
2419
|
+
}
|
|
2420
|
+
async fileExists(filePath) {
|
|
2421
|
+
return this.#fs.isFile(filePath);
|
|
2422
|
+
}
|
|
2423
|
+
fileExistsSync(filePath) {
|
|
2424
|
+
return this.#fs.isFile(filePath);
|
|
2425
|
+
}
|
|
2426
|
+
async directoryExists(dirPath) {
|
|
2427
|
+
return this.#fs.isDirectory(dirPath);
|
|
2428
|
+
}
|
|
2429
|
+
directoryExistsSync(dirPath) {
|
|
2430
|
+
return this.#fs.isDirectory(dirPath);
|
|
2431
|
+
}
|
|
2432
|
+
realpathSync(path) {
|
|
2433
|
+
return this.#fs.resolveSync(path) || path;
|
|
2434
|
+
}
|
|
2435
|
+
getCurrentDirectory() {
|
|
2436
|
+
return "/";
|
|
2437
|
+
}
|
|
2438
|
+
async glob(patterns) {
|
|
2439
|
+
return this.#fs.glob(patterns);
|
|
2440
|
+
}
|
|
2441
|
+
globSync(patterns) {
|
|
2442
|
+
return this.#fs.globSync(patterns);
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
function createProgram(context, override) {
|
|
2446
|
+
const project = new tsMorph.Project({
|
|
2447
|
+
compilerOptions: {
|
|
2448
|
+
...context.tsconfig.options
|
|
2449
|
+
},
|
|
2450
|
+
tsConfigFilePath: context.tsconfig.tsconfigFilePath,
|
|
2451
|
+
fileSystem: new VirtualFileSystemHost(context.fs),
|
|
2452
|
+
...override
|
|
2453
|
+
});
|
|
2454
|
+
return project;
|
|
2455
|
+
}
|
|
2456
|
+
chunkUSNT2KNT_cjs.__name(createProgram, "createProgram");
|
|
2680
2457
|
var PROJECT_ROOT_HASH_LENGTH = 45;
|
|
2681
2458
|
var CACHE_HASH_LENGTH = 62;
|
|
2682
2459
|
function getPrefixedProjectRootHash(name, projectRootHash) {
|
|
@@ -2713,6 +2490,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2713
2490
|
#envPaths;
|
|
2714
2491
|
#fs;
|
|
2715
2492
|
#tsconfig;
|
|
2493
|
+
#program;
|
|
2494
|
+
#resolvePatterns = [];
|
|
2716
2495
|
#getConfigProps(config = {}) {
|
|
2717
2496
|
return {
|
|
2718
2497
|
variant: config.build?.variant,
|
|
@@ -2804,7 +2583,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2804
2583
|
*/
|
|
2805
2584
|
get tsconfig() {
|
|
2806
2585
|
if (!this.#tsconfig) {
|
|
2807
|
-
this
|
|
2586
|
+
this.tsconfig = {
|
|
2808
2587
|
tsconfigFilePath: this.config.tsconfig
|
|
2809
2588
|
};
|
|
2810
2589
|
}
|
|
@@ -2815,6 +2594,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2815
2594
|
*/
|
|
2816
2595
|
set tsconfig(value) {
|
|
2817
2596
|
this.#tsconfig = value;
|
|
2597
|
+
this.#resolvePatterns = bundleRequire.tsconfigPathsToRegExp(value?.options?.paths ?? {});
|
|
2818
2598
|
}
|
|
2819
2599
|
/**
|
|
2820
2600
|
* The virtual file system interface for the project
|
|
@@ -2939,6 +2719,106 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2939
2719
|
return Object.values(this.fs.metadata).filter((meta) => meta && meta.type === "builtin").map((meta) => meta?.id).filter(Boolean);
|
|
2940
2720
|
}
|
|
2941
2721
|
/**
|
|
2722
|
+
* The {@link Project} instance used for type reflection and module manipulation
|
|
2723
|
+
*
|
|
2724
|
+
* @see https://ts-morph.com/
|
|
2725
|
+
*
|
|
2726
|
+
* @remarks
|
|
2727
|
+
* This instance is created lazily on first access.
|
|
2728
|
+
*/
|
|
2729
|
+
get program() {
|
|
2730
|
+
if (!this.#program) {
|
|
2731
|
+
this.#program = createProgram(this, {
|
|
2732
|
+
skipAddingFilesFromTsConfig: true
|
|
2733
|
+
});
|
|
2734
|
+
}
|
|
2735
|
+
return this.#program;
|
|
2736
|
+
}
|
|
2737
|
+
/**
|
|
2738
|
+
* A helper function to resolve modules in the Virtual File System
|
|
2739
|
+
*
|
|
2740
|
+
* @remarks
|
|
2741
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
2742
|
+
*
|
|
2743
|
+
* @example
|
|
2744
|
+
* ```ts
|
|
2745
|
+
* const resolved = await context.resolve("some-module", "/path/to/importer");
|
|
2746
|
+
* ```
|
|
2747
|
+
*
|
|
2748
|
+
* @param id - The module to resolve.
|
|
2749
|
+
* @param importer - An optional path to the importer module.
|
|
2750
|
+
* @param options - Additional resolution options.
|
|
2751
|
+
* @returns A promise that resolves to the resolved module path.
|
|
2752
|
+
*/
|
|
2753
|
+
async resolveId(id, importer, options = {}) {
|
|
2754
|
+
if (this.fs.isVirtual(id)) {
|
|
2755
|
+
const result = await this.fs.resolve(id, importer, options);
|
|
2756
|
+
if (!result) {
|
|
2757
|
+
return void 0;
|
|
2758
|
+
}
|
|
2759
|
+
return {
|
|
2760
|
+
id: `\0${result}`,
|
|
2761
|
+
external: this.config.projectType !== "application"
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
if (this.config.build.skipNodeModulesBundle) {
|
|
2765
|
+
if (bundleRequire.match(id, this.#resolvePatterns) || bundleRequire.match(id, this.config.build.noExternal)) {
|
|
2766
|
+
return void 0;
|
|
2767
|
+
}
|
|
2768
|
+
if (bundleRequire.match(id, this.config.build.external) || id.startsWith("node:")) {
|
|
2769
|
+
return {
|
|
2770
|
+
id,
|
|
2771
|
+
external: true
|
|
2772
|
+
};
|
|
2773
|
+
}
|
|
2774
|
+
if (!/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(id)) {
|
|
2775
|
+
return {
|
|
2776
|
+
id,
|
|
2777
|
+
external: true
|
|
2778
|
+
};
|
|
2779
|
+
}
|
|
2780
|
+
} else {
|
|
2781
|
+
if (bundleRequire.match(id, this.config.build.noExternal)) {
|
|
2782
|
+
return void 0;
|
|
2783
|
+
}
|
|
2784
|
+
if (bundleRequire.match(id, this.config.build.external) || id.startsWith("node:")) {
|
|
2785
|
+
return {
|
|
2786
|
+
id,
|
|
2787
|
+
external: true
|
|
2788
|
+
};
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
return void 0;
|
|
2792
|
+
}
|
|
2793
|
+
/**
|
|
2794
|
+
* A helper function to load modules from the Virtual File System
|
|
2795
|
+
*
|
|
2796
|
+
* @remarks
|
|
2797
|
+
* This function can be used to load modules relative to the project root directory.
|
|
2798
|
+
*
|
|
2799
|
+
* @example
|
|
2800
|
+
* ```ts
|
|
2801
|
+
* const module = await context.load("some-module", "/path/to/importer");
|
|
2802
|
+
* ```
|
|
2803
|
+
*
|
|
2804
|
+
* @param id - The module to load.
|
|
2805
|
+
* @returns A promise that resolves to the loaded module.
|
|
2806
|
+
*/
|
|
2807
|
+
async load(id) {
|
|
2808
|
+
const resolvedId = await this.fs.resolve(id);
|
|
2809
|
+
if (!resolvedId) {
|
|
2810
|
+
return void 0;
|
|
2811
|
+
}
|
|
2812
|
+
const code = await this.fs.readFile(resolvedId);
|
|
2813
|
+
if (!code) {
|
|
2814
|
+
return void 0;
|
|
2815
|
+
}
|
|
2816
|
+
return {
|
|
2817
|
+
code,
|
|
2818
|
+
map: null
|
|
2819
|
+
};
|
|
2820
|
+
}
|
|
2821
|
+
/**
|
|
2942
2822
|
* Get the builtin virtual files that exist in the Powerlines virtual file system
|
|
2943
2823
|
*/
|
|
2944
2824
|
async getBuiltins() {
|
|
@@ -3275,6 +3155,24 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3275
3155
|
ret.push(plugin);
|
|
3276
3156
|
return ret;
|
|
3277
3157
|
}, []);
|
|
3158
|
+
if (this.config.tsconfig) {
|
|
3159
|
+
this.config.tsconfig = replacePathTokens(this, this.config.tsconfig);
|
|
3160
|
+
}
|
|
3161
|
+
if (this.config.output.dts) {
|
|
3162
|
+
this.config.output.dts = replacePathTokens(this, this.config.output.dts);
|
|
3163
|
+
}
|
|
3164
|
+
if (this.config.build.polyfill) {
|
|
3165
|
+
this.config.build.polyfill = this.config.build.polyfill.map((polyfill) => replacePathTokens(this, polyfill));
|
|
3166
|
+
}
|
|
3167
|
+
if (this.config.output.assets) {
|
|
3168
|
+
this.config.output.assets = this.config.output.assets.map((asset) => ({
|
|
3169
|
+
...asset,
|
|
3170
|
+
glob: replacePathTokens(this, asset.glob),
|
|
3171
|
+
ignore: asset.ignore ? asset.ignore.map((ignore) => replacePathTokens(this, ignore)) : void 0,
|
|
3172
|
+
input: replacePathTokens(this, asset.input),
|
|
3173
|
+
output: replacePathTokens(this, asset.output)
|
|
3174
|
+
}));
|
|
3175
|
+
}
|
|
3278
3176
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
3279
3177
|
}
|
|
3280
3178
|
mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
|
|
@@ -3695,13 +3593,9 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
|
|
|
3695
3593
|
await resolveTsconfig(context);
|
|
3696
3594
|
await installDependencies(context);
|
|
3697
3595
|
await this.callPostHook(context, "configResolved");
|
|
3698
|
-
if (context.config.build.polyfill) {
|
|
3699
|
-
context.config.build.polyfill = context.config.build.polyfill.map((polyfill) => replacePathTokens(context, polyfill));
|
|
3700
|
-
}
|
|
3701
3596
|
context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
|
|
3702
3597
|
|
|
3703
3598
|
${console.formatLogMessage(context.config)}`);
|
|
3704
|
-
context.fs[chunkAYKZK666_cjs.__VFS_PATCH__]();
|
|
3705
3599
|
await writeMetaFile(context);
|
|
3706
3600
|
context.persistedMeta = context.meta;
|
|
3707
3601
|
if (!exists.existsSync(context.cachePath)) {
|
|
@@ -3751,35 +3645,19 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3751
3645
|
if (!typescriptPath) {
|
|
3752
3646
|
throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
|
|
3753
3647
|
}
|
|
3754
|
-
const files = builtinFilePaths.reduce(
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
ret.
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
joinPaths.joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")
|
|
3762
|
-
]);
|
|
3763
|
-
context.log(types.LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
|
|
3764
|
-
const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu6__default.default({
|
|
3765
|
-
compilerOptions: {
|
|
3766
|
-
strict: false,
|
|
3767
|
-
noEmit: false,
|
|
3768
|
-
declaration: true,
|
|
3769
|
-
declarationMap: false,
|
|
3770
|
-
emitDeclarationOnly: true,
|
|
3771
|
-
skipLibCheck: true
|
|
3648
|
+
const files = builtinFilePaths.reduce(
|
|
3649
|
+
(ret, fileName) => {
|
|
3650
|
+
const formatted = replace.replacePath(fileName, context.workspaceConfig.workspaceRoot);
|
|
3651
|
+
if (!ret.includes(formatted)) {
|
|
3652
|
+
ret.push(formatted);
|
|
3653
|
+
}
|
|
3654
|
+
return ret;
|
|
3772
3655
|
},
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
}, context.config.tsconfigRaw ?? {}));
|
|
3779
|
-
resolvedTsconfig.options.configFilePath = joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.tsconfig.tsconfigFilePath);
|
|
3780
|
-
resolvedTsconfig.options.pathsBasePath = context.workspaceConfig.workspaceRoot;
|
|
3781
|
-
resolvedTsconfig.options.suppressOutputPathCheck = true;
|
|
3782
|
-
let generatedTypes = await emitTypes(context, resolvedTsconfig, files);
|
|
3656
|
+
[]
|
|
3657
|
+
// [joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")]
|
|
3658
|
+
);
|
|
3659
|
+
context.log(types.LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
|
|
3660
|
+
let generatedTypes = await emitTypes(context, files);
|
|
3783
3661
|
context.log(types.LogLevelLabel.TRACE, `Generating TypeScript declaration file in ${context.config.output.dts}.`);
|
|
3784
3662
|
const directives = [];
|
|
3785
3663
|
let result = await this.callPreHook(context, "generateTypes", generatedTypes);
|
|
@@ -3833,7 +3711,6 @@ ${formatTypes(generatedTypes)}
|
|
|
3833
3711
|
}
|
|
3834
3712
|
await this.callPostHook(context, "prepare");
|
|
3835
3713
|
await writeMetaFile(context);
|
|
3836
|
-
context.fs[chunkAYKZK666_cjs.__VFS_REVERT__]();
|
|
3837
3714
|
});
|
|
3838
3715
|
this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
|
|
3839
3716
|
}
|
|
@@ -4272,8 +4149,6 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
4272
4149
|
}
|
|
4273
4150
|
};
|
|
4274
4151
|
|
|
4275
|
-
exports.AssetData = AssetData;
|
|
4276
|
-
exports.ChunkData = ChunkData;
|
|
4277
4152
|
exports.FileData = FileData;
|
|
4278
4153
|
exports.FileId = FileId;
|
|
4279
4154
|
exports.FileMetadata = FileMetadata;
|
|
@@ -4281,7 +4156,6 @@ exports.FileMetadata_KeyValuePair = FileMetadata_KeyValuePair;
|
|
|
4281
4156
|
exports.FileSystem = FileSystem;
|
|
4282
4157
|
exports.FileType = FileType;
|
|
4283
4158
|
exports.PowerlinesAPI = PowerlinesAPI;
|
|
4284
|
-
exports.PrebuiltData = PrebuiltData;
|
|
4285
4159
|
exports.PreserveSignatureType = PreserveSignatureType;
|
|
4286
4160
|
exports._capnpFileId = _capnpFileId;
|
|
4287
4161
|
exports.createLog = createLog;
|