powerlines 0.23.10 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +16 -15
- 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
|
@@ -12,7 +12,7 @@ import { createDirectory } from '@stryke/fs/helpers';
|
|
|
12
12
|
import { install } from '@stryke/fs/install';
|
|
13
13
|
import { listFiles, listFilesSync } from '@stryke/fs/list-files';
|
|
14
14
|
import { isPackageExists, isPackageListed, doesPackageMatch, getPackageListing } from '@stryke/fs/package-fns';
|
|
15
|
-
import { resolvePackage } from '@stryke/fs/resolve';
|
|
15
|
+
import { getResolutionCombinations, resolve, resolveSync, resolvePackage } from '@stryke/fs/resolve';
|
|
16
16
|
import { appendPath } from '@stryke/path/append';
|
|
17
17
|
import { joinPaths as joinPaths$1 } from '@stryke/path/join-paths';
|
|
18
18
|
import { replacePath, replaceExtension } from '@stryke/path/replace';
|
|
@@ -24,17 +24,17 @@ import { isSet } from '@stryke/type-checks/is-set';
|
|
|
24
24
|
import { isSetObject } from '@stryke/type-checks/is-set-object';
|
|
25
25
|
import { isSetString } from '@stryke/type-checks/is-set-string';
|
|
26
26
|
import chalk5 from 'chalk';
|
|
27
|
-
import defu6, { defu } from 'defu';
|
|
28
27
|
import Handlebars from 'handlebars';
|
|
29
28
|
import { declare } from '@babel/helper-plugin-utils';
|
|
30
29
|
import * as t from '@babel/types';
|
|
31
|
-
import ts2, {
|
|
30
|
+
import ts2, { flattenDiagnosticMessageText } from 'typescript';
|
|
31
|
+
import defu6, { defu } from 'defu';
|
|
32
32
|
import { getPackageName, hasPackageVersion, getPackageVersion } from '@stryke/string-format/package';
|
|
33
33
|
import { getObjectDiff } from '@donedeal0/superdiff';
|
|
34
34
|
import { readJsonFile, readJsonFileSync } from '@stryke/fs/json';
|
|
35
35
|
import { loadTsConfig } from '@stryke/fs/tsconfig';
|
|
36
36
|
import { StormJSON } from '@stryke/json/storm-json';
|
|
37
|
-
import {
|
|
37
|
+
import { findFilePath, relativePath, findFileName, findFileDotExtensionSafe } from '@stryke/path/file-path-fns';
|
|
38
38
|
import { titleCase } from '@stryke/string-format/title-case';
|
|
39
39
|
import { writeFile as writeFile$1 } from '@stryke/fs/write-file';
|
|
40
40
|
import { resolveConfig, format } from 'prettier';
|
|
@@ -51,6 +51,7 @@ import { joinPaths } from '@stryke/path/join';
|
|
|
51
51
|
import { isNull } from '@stryke/type-checks/is-null';
|
|
52
52
|
import { isString } from '@stryke/type-checks/is-string';
|
|
53
53
|
import { uuid } from '@stryke/unique-id/uuid';
|
|
54
|
+
import { tsconfigPathsToRegExp, match } from 'bundle-require';
|
|
54
55
|
import { createJiti } from 'jiti';
|
|
55
56
|
import { isUndefined } from '@stryke/type-checks/is-undefined';
|
|
56
57
|
import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
|
|
@@ -58,8 +59,10 @@ import { isFile } from '@stryke/fs/is-file';
|
|
|
58
59
|
import * as $ from '@stryke/capnp';
|
|
59
60
|
import { bufferToString } from '@stryke/convert/buffer-to-string';
|
|
60
61
|
import { readFileBuffer, readFileBufferSync, writeFileBuffer } from '@stryke/fs/buffer';
|
|
62
|
+
import { toAbsolutePath } from '@stryke/path/correct-path';
|
|
61
63
|
import { prettyBytes } from '@stryke/string-format/pretty-bytes';
|
|
62
64
|
import { isBuffer } from '@stryke/type-checks/is-buffer';
|
|
65
|
+
import { create } from 'flat-cache';
|
|
63
66
|
import { Blob } from 'node:buffer';
|
|
64
67
|
import _fs from 'node:fs';
|
|
65
68
|
import { getLogFn, getLogLevel } from '@storm-software/config-tools/logger';
|
|
@@ -68,6 +71,7 @@ import { noop } from '@stryke/helpers/noop';
|
|
|
68
71
|
import { isParentPath } from '@stryke/path/is-parent-path';
|
|
69
72
|
import { Volume } from 'memfs';
|
|
70
73
|
import { Union } from 'unionfs';
|
|
74
|
+
import { InMemoryFileSystemHost, Project } from 'ts-morph';
|
|
71
75
|
import '@stryke/fs/remove-file';
|
|
72
76
|
import { kebabCase } from '@stryke/string-format/kebab-case';
|
|
73
77
|
import { isObject } from '@stryke/type-checks/is-object';
|
|
@@ -77,7 +81,7 @@ function resolveModulePath(nodePath, state) {
|
|
|
77
81
|
return;
|
|
78
82
|
}
|
|
79
83
|
const sourcePath = nodePath.node.value;
|
|
80
|
-
const resolvedPath = state.context?.fs.
|
|
84
|
+
const resolvedPath = state.context?.fs.resolveSync(sourcePath);
|
|
81
85
|
if (resolvedPath) {
|
|
82
86
|
nodePath.replaceWith(t.stringLiteral(
|
|
83
87
|
// Remove the file extension if it exists
|
|
@@ -181,33 +185,31 @@ function formatTypes(code) {
|
|
|
181
185
|
).replaceAll("#private;", "").replace(/__Ω/g, "");
|
|
182
186
|
}
|
|
183
187
|
__name(formatTypes, "formatTypes");
|
|
184
|
-
async function emitTypes(context,
|
|
185
|
-
context.log(LogLevelLabel.TRACE,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
async function emitTypes(context, files) {
|
|
189
|
+
context.log(LogLevelLabel.TRACE, `Running the TypeScript compiler for ${files.length} generated runtime files.`);
|
|
190
|
+
context.program.addSourceFilesAtPaths(files);
|
|
191
|
+
const result = context.program.emitToMemory({
|
|
192
|
+
emitOnlyDtsFiles: true
|
|
193
|
+
});
|
|
188
194
|
let builtinModules = "";
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
195
|
+
for (const file of result.getFiles()) {
|
|
196
|
+
if (!file.filePath.endsWith(".map")) {
|
|
197
|
+
if (context.builtins.some((builtin) => builtin === file.filePath || context.fs.metadata[builtin]?.id && context.fs.metadata[builtin]?.id === file.filePath)) {
|
|
198
|
+
const module = await context.fs.resolve(file.filePath);
|
|
193
199
|
builtinModules += `
|
|
194
|
-
declare module "${
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
`;
|
|
200
|
+
declare module "${module}" {
|
|
201
|
+
${file.text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
|
-
}
|
|
201
|
-
const diagnostics = getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
206
|
+
}
|
|
202
207
|
const diagnosticMessages = [];
|
|
203
|
-
|
|
204
|
-
if (diagnostic.
|
|
205
|
-
|
|
206
|
-
const message = flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
207
|
-
diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
208
|
+
result.getDiagnostics().forEach((diagnostic) => {
|
|
209
|
+
if (diagnostic.getSourceFile()?.getBaseName()) {
|
|
210
|
+
diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n")}`);
|
|
208
211
|
} else {
|
|
209
|
-
|
|
210
|
-
diagnosticMessages.push(message);
|
|
212
|
+
diagnosticMessages.push(flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n"));
|
|
211
213
|
}
|
|
212
214
|
});
|
|
213
215
|
const diagnosticMessage = diagnosticMessages.join("\n");
|
|
@@ -522,6 +524,7 @@ async function initializeTsconfig(context) {
|
|
|
522
524
|
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
523
525
|
context.tsconfig.originalTsconfigJson = await readJsonFile(tsconfigFilePath);
|
|
524
526
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
527
|
+
context.log(LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
525
528
|
await context.fs.writeFile(tsconfigFilePath, StormJSON.stringify(context.tsconfig.tsconfigJson), {
|
|
526
529
|
mode: "fs"
|
|
527
530
|
});
|
|
@@ -763,8 +766,6 @@ function replacePathTokens(context, path) {
|
|
|
763
766
|
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}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
764
767
|
}
|
|
765
768
|
__name(replacePathTokens, "replacePathTokens");
|
|
766
|
-
|
|
767
|
-
// src/lib/entry.ts
|
|
768
769
|
function resolveEntryInputFile(context, typeDefinition) {
|
|
769
770
|
return replacePath(typeDefinition.file, joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
|
|
770
771
|
}
|
|
@@ -925,187 +926,6 @@ var FileMetadata = class _FileMetadata extends $.Struct {
|
|
|
925
926
|
return "FileMetadata_" + super.toString();
|
|
926
927
|
}
|
|
927
928
|
};
|
|
928
|
-
var ChunkData = class extends $.Struct {
|
|
929
|
-
static {
|
|
930
|
-
__name(this, "ChunkData");
|
|
931
|
-
}
|
|
932
|
-
static _capnp = {
|
|
933
|
-
displayName: "ChunkData",
|
|
934
|
-
id: "84076f13b057f83a",
|
|
935
|
-
size: new $.ObjectSize(8, 4)
|
|
936
|
-
};
|
|
937
|
-
/**
|
|
938
|
-
* An additional name for the file.
|
|
939
|
-
*
|
|
940
|
-
*/
|
|
941
|
-
get id() {
|
|
942
|
-
return $.utils.getText(0, this);
|
|
943
|
-
}
|
|
944
|
-
set id(value) {
|
|
945
|
-
$.utils.setText(0, value, this);
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* Files that are implicitly loaded after one of the specified files.
|
|
949
|
-
*
|
|
950
|
-
*/
|
|
951
|
-
get name() {
|
|
952
|
-
return $.utils.getText(1, this);
|
|
953
|
-
}
|
|
954
|
-
set name(value) {
|
|
955
|
-
$.utils.setText(1, value, this);
|
|
956
|
-
}
|
|
957
|
-
_adoptImplicitlyLoadedAfterOneOf(value) {
|
|
958
|
-
$.utils.adopt(value, $.utils.getPointer(2, this));
|
|
959
|
-
}
|
|
960
|
-
_disownImplicitlyLoadedAfterOneOf() {
|
|
961
|
-
return $.utils.disown(this.implicitlyLoadedAfterOneOf);
|
|
962
|
-
}
|
|
963
|
-
/**
|
|
964
|
-
* The importer of the file.
|
|
965
|
-
*
|
|
966
|
-
*/
|
|
967
|
-
get implicitlyLoadedAfterOneOf() {
|
|
968
|
-
return $.utils.getList(2, $.TextList, this);
|
|
969
|
-
}
|
|
970
|
-
_hasImplicitlyLoadedAfterOneOf() {
|
|
971
|
-
return !$.utils.isNull($.utils.getPointer(2, this));
|
|
972
|
-
}
|
|
973
|
-
_initImplicitlyLoadedAfterOneOf(length) {
|
|
974
|
-
return $.utils.initList(2, $.TextList, length, this);
|
|
975
|
-
}
|
|
976
|
-
set implicitlyLoadedAfterOneOf(value) {
|
|
977
|
-
$.utils.copyFrom(value, $.utils.getPointer(2, this));
|
|
978
|
-
}
|
|
979
|
-
/**
|
|
980
|
-
* The signature preservation mode for the file.
|
|
981
|
-
*
|
|
982
|
-
*/
|
|
983
|
-
get importer() {
|
|
984
|
-
return $.utils.getText(3, this);
|
|
985
|
-
}
|
|
986
|
-
set importer(value) {
|
|
987
|
-
$.utils.setText(3, value, this);
|
|
988
|
-
}
|
|
989
|
-
get preserveSignature() {
|
|
990
|
-
return $.utils.getUint16(0, this);
|
|
991
|
-
}
|
|
992
|
-
set preserveSignature(value) {
|
|
993
|
-
$.utils.setUint16(0, value, this);
|
|
994
|
-
}
|
|
995
|
-
toString() {
|
|
996
|
-
return "ChunkData_" + super.toString();
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
var PrebuiltData = class extends $.Struct {
|
|
1000
|
-
static {
|
|
1001
|
-
__name(this, "PrebuiltData");
|
|
1002
|
-
}
|
|
1003
|
-
static _capnp = {
|
|
1004
|
-
displayName: "PrebuiltData",
|
|
1005
|
-
id: "c5b1a6ca696328ee",
|
|
1006
|
-
size: new $.ObjectSize(0, 4)
|
|
1007
|
-
};
|
|
1008
|
-
/**
|
|
1009
|
-
* An additional name for the file.
|
|
1010
|
-
*
|
|
1011
|
-
*/
|
|
1012
|
-
get id() {
|
|
1013
|
-
return $.utils.getText(0, this);
|
|
1014
|
-
}
|
|
1015
|
-
set id(value) {
|
|
1016
|
-
$.utils.setText(0, value, this);
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* The file exports.
|
|
1020
|
-
*
|
|
1021
|
-
*/
|
|
1022
|
-
get name() {
|
|
1023
|
-
return $.utils.getText(1, this);
|
|
1024
|
-
}
|
|
1025
|
-
set name(value) {
|
|
1026
|
-
$.utils.setText(1, value, this);
|
|
1027
|
-
}
|
|
1028
|
-
_adoptExports(value) {
|
|
1029
|
-
$.utils.adopt(value, $.utils.getPointer(2, this));
|
|
1030
|
-
}
|
|
1031
|
-
_disownExports() {
|
|
1032
|
-
return $.utils.disown(this.exports);
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* The source map for the file.
|
|
1036
|
-
*
|
|
1037
|
-
*/
|
|
1038
|
-
get exports() {
|
|
1039
|
-
return $.utils.getList(2, $.TextList, this);
|
|
1040
|
-
}
|
|
1041
|
-
_hasExports() {
|
|
1042
|
-
return !$.utils.isNull($.utils.getPointer(2, this));
|
|
1043
|
-
}
|
|
1044
|
-
_initExports(length) {
|
|
1045
|
-
return $.utils.initList(2, $.TextList, length, this);
|
|
1046
|
-
}
|
|
1047
|
-
set exports(value) {
|
|
1048
|
-
$.utils.copyFrom(value, $.utils.getPointer(2, this));
|
|
1049
|
-
}
|
|
1050
|
-
get map() {
|
|
1051
|
-
return $.utils.getText(3, this);
|
|
1052
|
-
}
|
|
1053
|
-
set map(value) {
|
|
1054
|
-
$.utils.setText(3, value, this);
|
|
1055
|
-
}
|
|
1056
|
-
toString() {
|
|
1057
|
-
return "PrebuiltData_" + super.toString();
|
|
1058
|
-
}
|
|
1059
|
-
};
|
|
1060
|
-
var AssetData = class extends $.Struct {
|
|
1061
|
-
static {
|
|
1062
|
-
__name(this, "AssetData");
|
|
1063
|
-
}
|
|
1064
|
-
static _capnp = {
|
|
1065
|
-
displayName: "AssetData",
|
|
1066
|
-
id: "da660c6c1fa4c830",
|
|
1067
|
-
size: new $.ObjectSize(8, 3)
|
|
1068
|
-
};
|
|
1069
|
-
/**
|
|
1070
|
-
* An additional name for the file.
|
|
1071
|
-
*
|
|
1072
|
-
*/
|
|
1073
|
-
get id() {
|
|
1074
|
-
return $.utils.getText(0, this);
|
|
1075
|
-
}
|
|
1076
|
-
set id(value) {
|
|
1077
|
-
$.utils.setText(0, value, this);
|
|
1078
|
-
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Indicates whether the file needs a code reference.
|
|
1081
|
-
*
|
|
1082
|
-
*/
|
|
1083
|
-
get name() {
|
|
1084
|
-
return $.utils.getText(1, this);
|
|
1085
|
-
}
|
|
1086
|
-
set name(value) {
|
|
1087
|
-
$.utils.setText(1, value, this);
|
|
1088
|
-
}
|
|
1089
|
-
/**
|
|
1090
|
-
* The original file name before any transformations.
|
|
1091
|
-
*
|
|
1092
|
-
*/
|
|
1093
|
-
get needsCodeReference() {
|
|
1094
|
-
return $.utils.getBit(0, this);
|
|
1095
|
-
}
|
|
1096
|
-
set needsCodeReference(value) {
|
|
1097
|
-
$.utils.setBit(0, value, this);
|
|
1098
|
-
}
|
|
1099
|
-
get originalFileName() {
|
|
1100
|
-
return $.utils.getText(2, this);
|
|
1101
|
-
}
|
|
1102
|
-
set originalFileName(value) {
|
|
1103
|
-
$.utils.setText(2, value, this);
|
|
1104
|
-
}
|
|
1105
|
-
toString() {
|
|
1106
|
-
return "AssetData_" + super.toString();
|
|
1107
|
-
}
|
|
1108
|
-
};
|
|
1109
929
|
var FileId = class extends $.Struct {
|
|
1110
930
|
static {
|
|
1111
931
|
__name(this, "FileId");
|
|
@@ -1171,14 +991,11 @@ var FileSystem = class _FileSystem extends $.Struct {
|
|
|
1171
991
|
static _capnp = {
|
|
1172
992
|
displayName: "FileSystem",
|
|
1173
993
|
id: "ae0c23d43e56abcf",
|
|
1174
|
-
size: new $.ObjectSize(0,
|
|
994
|
+
size: new $.ObjectSize(0, 3)
|
|
1175
995
|
};
|
|
1176
996
|
static _Ids;
|
|
1177
997
|
static _Files;
|
|
1178
998
|
static _Metadata;
|
|
1179
|
-
static _Assets;
|
|
1180
|
-
static _Chunks;
|
|
1181
|
-
static _Prebuilt;
|
|
1182
999
|
_adoptIds(value) {
|
|
1183
1000
|
$.utils.adopt(value, $.utils.getPointer(0, this));
|
|
1184
1001
|
}
|
|
@@ -1233,60 +1050,6 @@ var FileSystem = class _FileSystem extends $.Struct {
|
|
|
1233
1050
|
set metadata(value) {
|
|
1234
1051
|
$.utils.copyFrom(value, $.utils.getPointer(2, this));
|
|
1235
1052
|
}
|
|
1236
|
-
_adoptAssets(value) {
|
|
1237
|
-
$.utils.adopt(value, $.utils.getPointer(3, this));
|
|
1238
|
-
}
|
|
1239
|
-
_disownAssets() {
|
|
1240
|
-
return $.utils.disown(this.assets);
|
|
1241
|
-
}
|
|
1242
|
-
get assets() {
|
|
1243
|
-
return $.utils.getList(3, _FileSystem._Assets, this);
|
|
1244
|
-
}
|
|
1245
|
-
_hasAssets() {
|
|
1246
|
-
return !$.utils.isNull($.utils.getPointer(3, this));
|
|
1247
|
-
}
|
|
1248
|
-
_initAssets(length) {
|
|
1249
|
-
return $.utils.initList(3, _FileSystem._Assets, length, this);
|
|
1250
|
-
}
|
|
1251
|
-
set assets(value) {
|
|
1252
|
-
$.utils.copyFrom(value, $.utils.getPointer(3, this));
|
|
1253
|
-
}
|
|
1254
|
-
_adoptChunks(value) {
|
|
1255
|
-
$.utils.adopt(value, $.utils.getPointer(4, this));
|
|
1256
|
-
}
|
|
1257
|
-
_disownChunks() {
|
|
1258
|
-
return $.utils.disown(this.chunks);
|
|
1259
|
-
}
|
|
1260
|
-
get chunks() {
|
|
1261
|
-
return $.utils.getList(4, _FileSystem._Chunks, this);
|
|
1262
|
-
}
|
|
1263
|
-
_hasChunks() {
|
|
1264
|
-
return !$.utils.isNull($.utils.getPointer(4, this));
|
|
1265
|
-
}
|
|
1266
|
-
_initChunks(length) {
|
|
1267
|
-
return $.utils.initList(4, _FileSystem._Chunks, length, this);
|
|
1268
|
-
}
|
|
1269
|
-
set chunks(value) {
|
|
1270
|
-
$.utils.copyFrom(value, $.utils.getPointer(4, this));
|
|
1271
|
-
}
|
|
1272
|
-
_adoptPrebuilt(value) {
|
|
1273
|
-
$.utils.adopt(value, $.utils.getPointer(5, this));
|
|
1274
|
-
}
|
|
1275
|
-
_disownPrebuilt() {
|
|
1276
|
-
return $.utils.disown(this.prebuilt);
|
|
1277
|
-
}
|
|
1278
|
-
get prebuilt() {
|
|
1279
|
-
return $.utils.getList(5, _FileSystem._Prebuilt, this);
|
|
1280
|
-
}
|
|
1281
|
-
_hasPrebuilt() {
|
|
1282
|
-
return !$.utils.isNull($.utils.getPointer(5, this));
|
|
1283
|
-
}
|
|
1284
|
-
_initPrebuilt(length) {
|
|
1285
|
-
return $.utils.initList(5, _FileSystem._Prebuilt, length, this);
|
|
1286
|
-
}
|
|
1287
|
-
set prebuilt(value) {
|
|
1288
|
-
$.utils.copyFrom(value, $.utils.getPointer(5, this));
|
|
1289
|
-
}
|
|
1290
1053
|
toString() {
|
|
1291
1054
|
return "FileSystem_" + super.toString();
|
|
1292
1055
|
}
|
|
@@ -1295,9 +1058,6 @@ FileMetadata._Properties = $.CompositeList(FileMetadata_KeyValuePair);
|
|
|
1295
1058
|
FileSystem._Ids = $.CompositeList(FileId);
|
|
1296
1059
|
FileSystem._Files = $.CompositeList(FileData);
|
|
1297
1060
|
FileSystem._Metadata = $.CompositeList(FileMetadata);
|
|
1298
|
-
FileSystem._Assets = $.CompositeList(AssetData);
|
|
1299
|
-
FileSystem._Chunks = $.CompositeList(ChunkData);
|
|
1300
|
-
FileSystem._Prebuilt = $.CompositeList(PrebuiltData);
|
|
1301
1061
|
var createLog = /* @__PURE__ */ __name((name, options = {}) => {
|
|
1302
1062
|
const logLevel = options.logLevel === null ? LogLevelLabel.SILENT : options.logLevel || LogLevelLabel.INFO;
|
|
1303
1063
|
if (logLevel === LogLevelLabel.SILENT) {
|
|
@@ -1341,13 +1101,9 @@ function isBufferEncoding(options) {
|
|
|
1341
1101
|
}
|
|
1342
1102
|
__name(isBufferEncoding, "isBufferEncoding");
|
|
1343
1103
|
function isPowerlinesWriteFileOptions(options) {
|
|
1344
|
-
return !isBufferEncoding(options) && isSetObject(options) &&
|
|
1104
|
+
return !isBufferEncoding(options) && isSetObject(options) && "mode" in options && (options.mode === "fs" || options.mode === "virtual");
|
|
1345
1105
|
}
|
|
1346
1106
|
__name(isPowerlinesWriteFileOptions, "isPowerlinesWriteFileOptions");
|
|
1347
|
-
function isNodeWriteFileOptions(options) {
|
|
1348
|
-
return !isUndefined(options) && (isBufferEncoding(options) || !isPowerlinesWriteFileOptions(options));
|
|
1349
|
-
}
|
|
1350
|
-
__name(isNodeWriteFileOptions, "isNodeWriteFileOptions");
|
|
1351
1107
|
function isVirtualFileData(obj) {
|
|
1352
1108
|
return !!(isSetObject(obj) && "code" in obj && obj.code);
|
|
1353
1109
|
}
|
|
@@ -1484,6 +1240,18 @@ function patchFS(originalFS, vfs) {
|
|
|
1484
1240
|
};
|
|
1485
1241
|
}
|
|
1486
1242
|
__name(patchFS, "patchFS");
|
|
1243
|
+
function isValidId(id, prefix = "powerlines") {
|
|
1244
|
+
return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
|
|
1245
|
+
}
|
|
1246
|
+
__name(isValidId, "isValidId");
|
|
1247
|
+
function normalizeId(id, prefix = "powerlines") {
|
|
1248
|
+
return `${prefix.replace(/:$/, "")}:${toFilePath(id).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "").replace(/^\\0/, "").replace(findFileDotExtensionSafe(toFilePath(id)), "")}`;
|
|
1249
|
+
}
|
|
1250
|
+
__name(normalizeId, "normalizeId");
|
|
1251
|
+
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
1252
|
+
return isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1253
|
+
}
|
|
1254
|
+
__name(normalizePath, "normalizePath");
|
|
1487
1255
|
var UnifiedFS = class _UnifiedFS extends Union {
|
|
1488
1256
|
static {
|
|
1489
1257
|
__name(this, "UnifiedFS");
|
|
@@ -1660,9 +1428,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1660
1428
|
*/
|
|
1661
1429
|
#paths;
|
|
1662
1430
|
/**
|
|
1663
|
-
* A
|
|
1431
|
+
* A cache for module resolution results.
|
|
1664
1432
|
*/
|
|
1665
|
-
#
|
|
1433
|
+
#resolverCache;
|
|
1666
1434
|
/**
|
|
1667
1435
|
* The unified volume that combines the virtual file system with the real file system.
|
|
1668
1436
|
*
|
|
@@ -1697,189 +1465,35 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1697
1465
|
* @returns `true` if the path exists, otherwise `false`.
|
|
1698
1466
|
*/
|
|
1699
1467
|
#existsSync(path) {
|
|
1700
|
-
|
|
1701
|
-
return this.#unifiedFS.virtual.existsSync(formattedPath) || this.#unifiedFS.physical.existsSync(formattedPath) || this.#unifiedFS.resolveFS(path).existsSync(formattedPath);
|
|
1468
|
+
return this.#unifiedFS.virtual.existsSync(this.#normalizePath(path)) || this.#unifiedFS.physical.existsSync(this.#normalizePath(path)) || this.#unifiedFS.resolveFS(path).existsSync(this.#normalizePath(path));
|
|
1702
1469
|
}
|
|
1703
1470
|
/**
|
|
1704
|
-
*
|
|
1471
|
+
* Normalizes a given module id by resolving it against the built-ins path.
|
|
1705
1472
|
*
|
|
1706
|
-
* @param
|
|
1707
|
-
* @returns
|
|
1473
|
+
* @param id - The module id to normalize.
|
|
1474
|
+
* @returns The normalized module id.
|
|
1708
1475
|
*/
|
|
1709
|
-
#
|
|
1710
|
-
|
|
1711
|
-
return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
1476
|
+
#normalizeId(id) {
|
|
1477
|
+
return normalizeId(id, this.#context.config.output.builtinPrefix);
|
|
1712
1478
|
}
|
|
1713
1479
|
/**
|
|
1714
|
-
*
|
|
1480
|
+
* Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
|
|
1715
1481
|
*
|
|
1716
|
-
* @param
|
|
1717
|
-
* @returns The
|
|
1482
|
+
* @param path - The path to normalize.
|
|
1483
|
+
* @returns The normalized path.
|
|
1718
1484
|
*/
|
|
1719
|
-
#
|
|
1720
|
-
|
|
1721
|
-
return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(findFileDotExtensionSafe(formattedId), "")}`;
|
|
1722
|
-
}
|
|
1723
|
-
/**
|
|
1724
|
-
* Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1725
|
-
*
|
|
1726
|
-
* @param id - The id to resolve.
|
|
1727
|
-
* @returns The resolved file id if it exists, otherwise undefined.
|
|
1728
|
-
*/
|
|
1729
|
-
#resolveId(id) {
|
|
1730
|
-
if (this.#ids[this.#formatId(id)]) {
|
|
1731
|
-
return this.#ids[this.#formatId(id)] || false;
|
|
1732
|
-
}
|
|
1733
|
-
return false;
|
|
1734
|
-
}
|
|
1735
|
-
/**
|
|
1736
|
-
* Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1737
|
-
*
|
|
1738
|
-
* @param path - The path to resolve.
|
|
1739
|
-
* @param options - Optional parameters for resolving the path.
|
|
1740
|
-
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1741
|
-
*/
|
|
1742
|
-
#resolvePath(path, options = {}) {
|
|
1743
|
-
if (isAbsolutePath(path)) {
|
|
1744
|
-
if (this.#existsSync(path)) {
|
|
1745
|
-
return path;
|
|
1746
|
-
}
|
|
1747
|
-
const result = this.#checkVariants(path);
|
|
1748
|
-
if (result) {
|
|
1749
|
-
return result;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
for (const parentPath of this.#resolveParentPaths(path, options.paths)) {
|
|
1753
|
-
const request = joinPaths$1(parentPath, path);
|
|
1754
|
-
if (this.#existsSync(request)) {
|
|
1755
|
-
return request;
|
|
1756
|
-
}
|
|
1757
|
-
const result = this.#checkVariants(request);
|
|
1758
|
-
if (result) {
|
|
1759
|
-
return result;
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
return false;
|
|
1485
|
+
#normalizePath(path) {
|
|
1486
|
+
return normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
|
|
1763
1487
|
}
|
|
1764
1488
|
/**
|
|
1765
|
-
*
|
|
1766
|
-
*
|
|
1767
|
-
* @param request - The request path to resolve parent paths for.
|
|
1768
|
-
* @param parents - An optional array of parent paths to consider.
|
|
1769
|
-
* @returns An array of resolved parent paths.
|
|
1770
|
-
*/
|
|
1771
|
-
#resolveParentPaths(request, parents = []) {
|
|
1772
|
-
let paths = [
|
|
1773
|
-
this.#context.workspaceConfig.workspaceRoot,
|
|
1774
|
-
joinPaths$1(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
|
|
1775
|
-
];
|
|
1776
|
-
if (this.#context.tsconfig.options.paths) {
|
|
1777
|
-
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) => {
|
|
1778
|
-
if (path && !ret.includes(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, path))) {
|
|
1779
|
-
ret.push(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, path));
|
|
1780
|
-
}
|
|
1781
|
-
return ret;
|
|
1782
|
-
}, paths) : paths;
|
|
1783
|
-
}
|
|
1784
|
-
return paths.reduce((ret, path) => {
|
|
1785
|
-
if (!ret.includes(path)) {
|
|
1786
|
-
ret.push(path);
|
|
1787
|
-
}
|
|
1788
|
-
return ret;
|
|
1789
|
-
}, parents.filter(Boolean).map((p) => this.formatPath(p)));
|
|
1790
|
-
}
|
|
1791
|
-
/**
|
|
1792
|
-
* Clears the resolver cache for a given path.
|
|
1793
|
-
*
|
|
1794
|
-
* @param path - The path to clear the resolver cache for.
|
|
1795
|
-
*/
|
|
1796
|
-
#clearResolverCache(path) {
|
|
1797
|
-
this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
|
|
1798
|
-
}
|
|
1799
|
-
/**
|
|
1800
|
-
* Check if the file exists with different variants (index, extensions).
|
|
1801
|
-
*
|
|
1802
|
-
* @param request - The request path to check.
|
|
1803
|
-
* @param parentPath - An optional parent path to prepend to the request.
|
|
1804
|
-
* @returns The file path if it exists, otherwise false.
|
|
1805
|
-
*/
|
|
1806
|
-
#checkVariants(request, parentPath) {
|
|
1807
|
-
const path = parentPath ? joinPaths$1(parentPath, request) : request;
|
|
1808
|
-
let file = this.#checkExtensions(path);
|
|
1809
|
-
if (file) {
|
|
1810
|
-
return file;
|
|
1811
|
-
}
|
|
1812
|
-
file = this.#checkIndex(path);
|
|
1813
|
-
if (file) {
|
|
1814
|
-
return file;
|
|
1815
|
-
}
|
|
1816
|
-
return false;
|
|
1817
|
-
}
|
|
1818
|
-
/**
|
|
1819
|
-
* Check if the index file exists in the given request path.
|
|
1820
|
-
*
|
|
1821
|
-
* @param request - The request path to check.
|
|
1822
|
-
* @returns The index file path if it exists, otherwise false.
|
|
1823
|
-
*/
|
|
1824
|
-
#checkIndex(request) {
|
|
1825
|
-
let file = joinPaths$1(request, "index");
|
|
1826
|
-
if (this.#existsSync(file)) {
|
|
1827
|
-
return file;
|
|
1828
|
-
}
|
|
1829
|
-
file = this.#checkExtensions(file);
|
|
1830
|
-
if (file) {
|
|
1831
|
-
return file;
|
|
1832
|
-
}
|
|
1833
|
-
return false;
|
|
1834
|
-
}
|
|
1835
|
-
/**
|
|
1836
|
-
* Check if the file exists with different extensions.
|
|
1489
|
+
* Builds a regular expression from a string pattern for path matching.
|
|
1837
1490
|
*
|
|
1838
|
-
* @param
|
|
1839
|
-
* @returns
|
|
1491
|
+
* @param path - The string pattern to convert.
|
|
1492
|
+
* @returns A regular expression for matching paths.
|
|
1840
1493
|
*/
|
|
1841
|
-
#
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
return file;
|
|
1845
|
-
}
|
|
1846
|
-
file = `${request}.mts`;
|
|
1847
|
-
if (this.#existsSync(file)) {
|
|
1848
|
-
return file;
|
|
1849
|
-
}
|
|
1850
|
-
file = `${request}.cts`;
|
|
1851
|
-
if (this.#existsSync(file)) {
|
|
1852
|
-
return file;
|
|
1853
|
-
}
|
|
1854
|
-
file = `${request}.tsx`;
|
|
1855
|
-
if (this.#existsSync(file)) {
|
|
1856
|
-
return file;
|
|
1857
|
-
}
|
|
1858
|
-
file = `${request}.js`;
|
|
1859
|
-
if (this.#existsSync(file)) {
|
|
1860
|
-
return file;
|
|
1861
|
-
}
|
|
1862
|
-
file = `${request}.mjs`;
|
|
1863
|
-
if (this.#existsSync(file)) {
|
|
1864
|
-
return file;
|
|
1865
|
-
}
|
|
1866
|
-
file = `${request}.cjs`;
|
|
1867
|
-
if (this.#existsSync(file)) {
|
|
1868
|
-
return file;
|
|
1869
|
-
}
|
|
1870
|
-
file = `${request}.jsx`;
|
|
1871
|
-
if (this.#existsSync(file)) {
|
|
1872
|
-
return file;
|
|
1873
|
-
}
|
|
1874
|
-
file = `${request}.json`;
|
|
1875
|
-
if (this.#existsSync(file)) {
|
|
1876
|
-
return file;
|
|
1877
|
-
}
|
|
1878
|
-
file = `${request}.d.ts`;
|
|
1879
|
-
if (this.#existsSync(file)) {
|
|
1880
|
-
return file;
|
|
1881
|
-
}
|
|
1882
|
-
return false;
|
|
1494
|
+
#buildRegex(path) {
|
|
1495
|
+
const token = "::GLOBSTAR::";
|
|
1496
|
+
return new RegExp(`^${this.#normalizePath(path).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
1883
1497
|
}
|
|
1884
1498
|
/**
|
|
1885
1499
|
* Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
@@ -1888,8 +1502,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1888
1502
|
* @returns A promise that resolves to a new virtual file system instance.
|
|
1889
1503
|
*/
|
|
1890
1504
|
static async create(context) {
|
|
1891
|
-
if (!context.config.skipCache && existsSync(joinPaths$1(context.
|
|
1892
|
-
const buffer = await readFileBuffer(joinPaths$1(context.
|
|
1505
|
+
if (!context.config.skipCache && existsSync(joinPaths$1(context.dataPath, "fs.bin"))) {
|
|
1506
|
+
const buffer = await readFileBuffer(joinPaths$1(context.dataPath, "fs.bin"));
|
|
1893
1507
|
const message2 = new $.Message(buffer, false);
|
|
1894
1508
|
return new _VirtualFileSystem(context, message2.getRoot(FileSystem));
|
|
1895
1509
|
}
|
|
@@ -1903,8 +1517,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1903
1517
|
* @returns A new virtual file system instance.
|
|
1904
1518
|
*/
|
|
1905
1519
|
static createSync(context) {
|
|
1906
|
-
if (!context.config.skipCache && existsSync(joinPaths$1(context.
|
|
1907
|
-
const buffer = readFileBufferSync(joinPaths$1(context.
|
|
1520
|
+
if (!context.config.skipCache && existsSync(joinPaths$1(context.dataPath, "fs.bin"))) {
|
|
1521
|
+
const buffer = readFileBufferSync(joinPaths$1(context.dataPath, "fs.bin"));
|
|
1908
1522
|
const message2 = new $.Message(buffer, false);
|
|
1909
1523
|
return new _VirtualFileSystem(context, message2.getRoot(FileSystem));
|
|
1910
1524
|
}
|
|
@@ -1915,19 +1529,43 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1915
1529
|
* A map of file ids to their metadata.
|
|
1916
1530
|
*/
|
|
1917
1531
|
get metadata() {
|
|
1918
|
-
return this.#metadata
|
|
1532
|
+
return new Proxy(this.#metadata, {
|
|
1533
|
+
get: /* @__PURE__ */ __name((target, prop) => {
|
|
1534
|
+
return target[this.#normalizeId(prop)];
|
|
1535
|
+
}, "get")
|
|
1536
|
+
});
|
|
1919
1537
|
}
|
|
1920
1538
|
/**
|
|
1921
|
-
* A map of
|
|
1539
|
+
* A map of file paths to their module ids.
|
|
1922
1540
|
*/
|
|
1923
1541
|
get ids() {
|
|
1924
|
-
return this.#
|
|
1542
|
+
return new Proxy(this.#paths, {
|
|
1543
|
+
get: /* @__PURE__ */ __name((target, prop) => {
|
|
1544
|
+
return target[this.#normalizePath(prop)];
|
|
1545
|
+
}, "get")
|
|
1546
|
+
});
|
|
1925
1547
|
}
|
|
1926
1548
|
/**
|
|
1927
|
-
* A map of
|
|
1549
|
+
* A map of module ids to their file paths.
|
|
1928
1550
|
*/
|
|
1929
1551
|
get paths() {
|
|
1930
|
-
return this.#paths
|
|
1552
|
+
return new Proxy(this.#paths, {
|
|
1553
|
+
get: /* @__PURE__ */ __name((target, prop) => {
|
|
1554
|
+
return target[this.#normalizeId(prop)];
|
|
1555
|
+
}, "get")
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
get resolverCache() {
|
|
1559
|
+
if (!this.#resolverCache) {
|
|
1560
|
+
this.#resolverCache = create({
|
|
1561
|
+
cacheId: "module-resolution",
|
|
1562
|
+
cacheDir: this.#context.cachePath,
|
|
1563
|
+
ttl: 60 * 60 * 1e3,
|
|
1564
|
+
lruSize: 5e3,
|
|
1565
|
+
persistInterval: 100
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
return this.#resolverCache;
|
|
1931
1569
|
}
|
|
1932
1570
|
/**
|
|
1933
1571
|
* Creates a new instance of the {@link VirtualFileSystem}.
|
|
@@ -1972,17 +1610,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1972
1610
|
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
1973
1611
|
*
|
|
1974
1612
|
* @param pathOrId - The path or id to check.
|
|
1975
|
-
* @param options - Optional parameters for resolving the path.
|
|
1976
1613
|
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
1977
1614
|
*/
|
|
1978
|
-
isVirtual(pathOrId, options = {}) {
|
|
1615
|
+
isVirtual(pathOrId, importer, options = {}) {
|
|
1979
1616
|
if (!pathOrId) {
|
|
1980
1617
|
return false;
|
|
1981
1618
|
}
|
|
1982
|
-
const resolvedPath = this.
|
|
1983
|
-
...options,
|
|
1984
|
-
pathType: "file"
|
|
1985
|
-
});
|
|
1619
|
+
const resolvedPath = this.resolveSync(pathOrId, importer, options);
|
|
1986
1620
|
if (!resolvedPath) {
|
|
1987
1621
|
return false;
|
|
1988
1622
|
}
|
|
@@ -1992,17 +1626,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1992
1626
|
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
1993
1627
|
*
|
|
1994
1628
|
* @param pathOrId - The path or id to check.
|
|
1995
|
-
* @param options - Optional parameters for resolving the path.
|
|
1996
1629
|
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
1997
1630
|
*/
|
|
1998
|
-
isPhysical(pathOrId, options = {}) {
|
|
1631
|
+
isPhysical(pathOrId, importer, options = {}) {
|
|
1999
1632
|
if (!pathOrId) {
|
|
2000
1633
|
return false;
|
|
2001
1634
|
}
|
|
2002
|
-
const resolvedPath = this.
|
|
2003
|
-
...options,
|
|
2004
|
-
pathType: "file"
|
|
2005
|
-
});
|
|
1635
|
+
const resolvedPath = this.resolveSync(pathOrId, importer, options);
|
|
2006
1636
|
if (!resolvedPath) {
|
|
2007
1637
|
return false;
|
|
2008
1638
|
}
|
|
@@ -2024,16 +1654,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2024
1654
|
* @param path - The path to create the directory at.
|
|
2025
1655
|
*/
|
|
2026
1656
|
unlinkSync(path, options) {
|
|
2027
|
-
|
|
2028
|
-
if (!this.isFile(formattedPath)) {
|
|
1657
|
+
if (!this.isFile(this.#normalizePath(path))) {
|
|
2029
1658
|
return;
|
|
2030
1659
|
}
|
|
2031
|
-
this.#log(LogLevelLabel.TRACE, `Synchronously removing file: ${
|
|
2032
|
-
this.#unifiedFS.resolveFS(path, options).unlinkSync(
|
|
2033
|
-
if (this
|
|
2034
|
-
delete this
|
|
1660
|
+
this.#log(LogLevelLabel.TRACE, `Synchronously removing file: ${this.#normalizePath(path)}`);
|
|
1661
|
+
this.#unifiedFS.resolveFS(path, options).unlinkSync(this.#normalizePath(path));
|
|
1662
|
+
if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
|
|
1663
|
+
delete this.#metadata[this.#ids[this.#normalizePath(path)]];
|
|
1664
|
+
delete this.#ids[this.#normalizePath(path)];
|
|
1665
|
+
delete this.#paths[this.#normalizeId(path)];
|
|
1666
|
+
this.#resolverCache.delete(this.#normalizePath(path));
|
|
2035
1667
|
}
|
|
2036
|
-
this.#clearResolverCache(formattedPath);
|
|
2037
1668
|
}
|
|
2038
1669
|
/**
|
|
2039
1670
|
* Removes a file in the virtual file system (VFS).
|
|
@@ -2041,19 +1672,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2041
1672
|
* @param path - The path to create the directory at.
|
|
2042
1673
|
*/
|
|
2043
1674
|
async unlink(path, options) {
|
|
2044
|
-
|
|
2045
|
-
if (!this.isFile(formattedPath)) {
|
|
1675
|
+
if (!this.isFile(this.#normalizePath(path))) {
|
|
2046
1676
|
return;
|
|
2047
1677
|
}
|
|
2048
|
-
this.#log(LogLevelLabel.TRACE, `Removing file: ${
|
|
1678
|
+
this.#log(LogLevelLabel.TRACE, `Removing file: ${this.#normalizePath(path)}`);
|
|
2049
1679
|
if (isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
|
|
2050
|
-
await this.#unifiedFS.resolveFS(path, options).promises.unlink(
|
|
2051
|
-
if (this
|
|
2052
|
-
delete this
|
|
1680
|
+
await this.#unifiedFS.resolveFS(path, options).promises.unlink(this.#normalizePath(path));
|
|
1681
|
+
if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
|
|
1682
|
+
delete this.#metadata[this.#ids[this.#normalizePath(path)]];
|
|
2053
1683
|
}
|
|
2054
|
-
this.#clearResolverCache(formattedPath);
|
|
2055
1684
|
} else {
|
|
2056
|
-
this.unlinkSync(
|
|
1685
|
+
this.unlinkSync(this.#normalizePath(path), options);
|
|
2057
1686
|
}
|
|
2058
1687
|
}
|
|
2059
1688
|
/**
|
|
@@ -2063,15 +1692,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2063
1692
|
* @param options - Options for creating the directory.
|
|
2064
1693
|
*/
|
|
2065
1694
|
rmdirSync(path, options = {}) {
|
|
2066
|
-
|
|
2067
|
-
if (!this.isDirectory(formattedPath)) {
|
|
1695
|
+
if (!this.isDirectory(this.#normalizePath(path))) {
|
|
2068
1696
|
return;
|
|
2069
1697
|
}
|
|
2070
|
-
this.#log(LogLevelLabel.TRACE, `Synchronously removing directory: ${
|
|
2071
|
-
this.#unifiedFS.resolveFS(path, options).rmdirSync(
|
|
1698
|
+
this.#log(LogLevelLabel.TRACE, `Synchronously removing directory: ${this.#normalizePath(path)}`);
|
|
1699
|
+
this.#unifiedFS.resolveFS(path, options).rmdirSync(this.#normalizePath(path), defu6(options, {
|
|
2072
1700
|
recursive: true
|
|
2073
1701
|
}));
|
|
2074
|
-
this.#clearResolverCache(formattedPath);
|
|
2075
1702
|
}
|
|
2076
1703
|
/**
|
|
2077
1704
|
* Removes a directory in the virtual file system (VFS).
|
|
@@ -2081,19 +1708,17 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2081
1708
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
2082
1709
|
*/
|
|
2083
1710
|
async rmdir(path, options = {}) {
|
|
2084
|
-
|
|
2085
|
-
if (!this.isDirectory(formattedPath)) {
|
|
1711
|
+
if (!this.isDirectory(this.#normalizePath(path))) {
|
|
2086
1712
|
return;
|
|
2087
1713
|
}
|
|
2088
|
-
this.#log(LogLevelLabel.TRACE, `Removing directory: ${
|
|
1714
|
+
this.#log(LogLevelLabel.TRACE, `Removing directory: ${this.#normalizePath(path)}`);
|
|
2089
1715
|
if (isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
|
|
2090
|
-
await this.#unifiedFS.resolveFS(path, options).promises.rm(
|
|
1716
|
+
await this.#unifiedFS.resolveFS(path, options).promises.rm(this.#normalizePath(path), defu6(options, {
|
|
2091
1717
|
force: true,
|
|
2092
1718
|
recursive: true
|
|
2093
1719
|
}));
|
|
2094
|
-
this.#clearResolverCache(formattedPath);
|
|
2095
1720
|
} else {
|
|
2096
|
-
this.rmdirSync(
|
|
1721
|
+
this.rmdirSync(this.#normalizePath(path), defu6(options ?? {}, {
|
|
2097
1722
|
force: true,
|
|
2098
1723
|
recursive: true
|
|
2099
1724
|
}));
|
|
@@ -2107,11 +1732,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2107
1732
|
* @returns A promise that resolves when the file is removed.
|
|
2108
1733
|
*/
|
|
2109
1734
|
async rm(path, options = {}) {
|
|
2110
|
-
this.#log(LogLevelLabel.TRACE, `Removing: ${
|
|
2111
|
-
if (this.isDirectory(path)) {
|
|
2112
|
-
return this.rmdir(path, options);
|
|
1735
|
+
this.#log(LogLevelLabel.TRACE, `Removing: ${this.#normalizePath(path)}`);
|
|
1736
|
+
if (this.isDirectory(this.#normalizePath(path))) {
|
|
1737
|
+
return this.rmdir(this.#normalizePath(path), options);
|
|
2113
1738
|
}
|
|
2114
|
-
return this.unlink(path, options);
|
|
1739
|
+
return this.unlink(this.#normalizePath(path), options);
|
|
2115
1740
|
}
|
|
2116
1741
|
/**
|
|
2117
1742
|
* Synchronously removes a file or directory in the virtual file system (VFS).
|
|
@@ -2120,11 +1745,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2120
1745
|
* @param options - Options for removing the file or directory.
|
|
2121
1746
|
*/
|
|
2122
1747
|
rmSync(path, options = {}) {
|
|
2123
|
-
this.#log(LogLevelLabel.TRACE, `Removing: ${
|
|
2124
|
-
if (this.isDirectory(path)) {
|
|
2125
|
-
return this.rmdirSync(path, options);
|
|
1748
|
+
this.#log(LogLevelLabel.TRACE, `Removing: ${this.#normalizePath(path)}`);
|
|
1749
|
+
if (this.isDirectory(this.#normalizePath(path))) {
|
|
1750
|
+
return this.rmdirSync(this.#normalizePath(path), options);
|
|
2126
1751
|
}
|
|
2127
|
-
return this.unlinkSync(path, options);
|
|
1752
|
+
return this.unlinkSync(this.#normalizePath(path), options);
|
|
2128
1753
|
}
|
|
2129
1754
|
/**
|
|
2130
1755
|
* Creates a directory in the virtual file system (VFS).
|
|
@@ -2134,9 +1759,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2134
1759
|
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
2135
1760
|
*/
|
|
2136
1761
|
mkdirSync(path, options = {}) {
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
1762
|
+
return this.#unifiedFS.resolveFS(this.#normalizePath(path), options).mkdirSync(this.#normalizePath(path), defu6(omit(options, [
|
|
1763
|
+
"mode"
|
|
1764
|
+
]), {
|
|
2140
1765
|
recursive: true
|
|
2141
1766
|
}));
|
|
2142
1767
|
}
|
|
@@ -2149,17 +1774,19 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2149
1774
|
*/
|
|
2150
1775
|
async mkdir(path, options = {}) {
|
|
2151
1776
|
let result;
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
1777
|
+
if (isFunction(this.#unifiedFS.resolveFS(this.#normalizePath(path), options).promises.mkdir)) {
|
|
1778
|
+
result = await this.#unifiedFS.resolveFS(this.#normalizePath(path), options).promises.mkdir(this.#normalizePath(path), defu6(omit(options, [
|
|
1779
|
+
"mode"
|
|
1780
|
+
]), {
|
|
2155
1781
|
recursive: true
|
|
2156
1782
|
}));
|
|
2157
1783
|
} else {
|
|
2158
|
-
result = this.#unifiedFS.resolveFS(
|
|
1784
|
+
result = this.#unifiedFS.resolveFS(this.#normalizePath(path), options).mkdirSync(this.#normalizePath(path), defu6(omit(options, [
|
|
1785
|
+
"mode"
|
|
1786
|
+
]), {
|
|
2159
1787
|
recursive: true
|
|
2160
1788
|
}));
|
|
2161
1789
|
}
|
|
2162
|
-
this.#clearResolverCache(filePath);
|
|
2163
1790
|
return result;
|
|
2164
1791
|
}
|
|
2165
1792
|
/**
|
|
@@ -2171,17 +1798,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2171
1798
|
async glob(patterns) {
|
|
2172
1799
|
const results = [];
|
|
2173
1800
|
for (const pattern of toArray(patterns)) {
|
|
2174
|
-
const normalized = this
|
|
1801
|
+
const normalized = this.#normalizePath(pattern);
|
|
2175
1802
|
if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
|
|
2176
|
-
const resolved = this.
|
|
2177
|
-
pathType: "file"
|
|
2178
|
-
});
|
|
1803
|
+
const resolved = this.resolveSync(normalized);
|
|
2179
1804
|
if (resolved && !results.includes(resolved)) {
|
|
2180
1805
|
results.push(resolved);
|
|
2181
1806
|
}
|
|
2182
1807
|
continue;
|
|
2183
1808
|
}
|
|
2184
|
-
const absPattern = isAbsolutePath(normalized) ? normalized : this
|
|
1809
|
+
const absPattern = isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, normalized));
|
|
2185
1810
|
const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
|
|
2186
1811
|
const baseDir = firstGlobIdx === -1 ? findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
|
|
2187
1812
|
const stack = [
|
|
@@ -2196,7 +1821,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2196
1821
|
continue;
|
|
2197
1822
|
}
|
|
2198
1823
|
for (const entry of entries) {
|
|
2199
|
-
const full = this
|
|
1824
|
+
const full = this.#normalizePath(joinPaths$1(dir, entry));
|
|
2200
1825
|
let stats;
|
|
2201
1826
|
try {
|
|
2202
1827
|
stats = this.#unifiedFS.lstatSync(full);
|
|
@@ -2208,9 +1833,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2208
1833
|
stack.push(full);
|
|
2209
1834
|
} else if (stats.isFile()) {
|
|
2210
1835
|
if (this.#buildRegex(absPattern).test(full)) {
|
|
2211
|
-
const resolved = this.
|
|
2212
|
-
pathType: "file"
|
|
2213
|
-
});
|
|
1836
|
+
const resolved = this.resolveSync(full);
|
|
2214
1837
|
if (resolved && !results.includes(resolved)) {
|
|
2215
1838
|
results.push(resolved);
|
|
2216
1839
|
}
|
|
@@ -2230,17 +1853,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2230
1853
|
globSync(patterns) {
|
|
2231
1854
|
const results = [];
|
|
2232
1855
|
for (const pattern of toArray(patterns)) {
|
|
2233
|
-
const normalized = this
|
|
1856
|
+
const normalized = this.#normalizePath(pattern);
|
|
2234
1857
|
if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
|
|
2235
|
-
const resolved = this.
|
|
2236
|
-
pathType: "file"
|
|
2237
|
-
});
|
|
1858
|
+
const resolved = this.resolveSync(normalized);
|
|
2238
1859
|
if (resolved && !results.includes(resolved)) {
|
|
2239
1860
|
results.push(resolved);
|
|
2240
1861
|
}
|
|
2241
1862
|
continue;
|
|
2242
1863
|
}
|
|
2243
|
-
const absPattern = isAbsolutePath(normalized) ? normalized : this
|
|
1864
|
+
const absPattern = isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, normalized));
|
|
2244
1865
|
const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
|
|
2245
1866
|
const baseDir = firstGlobIdx === -1 ? findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
|
|
2246
1867
|
const stack = [
|
|
@@ -2255,7 +1876,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2255
1876
|
continue;
|
|
2256
1877
|
}
|
|
2257
1878
|
for (const entry of entries) {
|
|
2258
|
-
const full = this
|
|
1879
|
+
const full = this.#normalizePath(joinPaths$1(dir, entry));
|
|
2259
1880
|
let stats;
|
|
2260
1881
|
try {
|
|
2261
1882
|
stats = this.#unifiedFS.lstatSync(full);
|
|
@@ -2267,9 +1888,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2267
1888
|
stack.push(full);
|
|
2268
1889
|
} else if (stats.isFile()) {
|
|
2269
1890
|
if (this.#buildRegex(absPattern).test(full)) {
|
|
2270
|
-
const resolved = this.
|
|
2271
|
-
pathType: "file"
|
|
2272
|
-
});
|
|
1891
|
+
const resolved = this.resolveSync(full);
|
|
2273
1892
|
if (resolved && !results.includes(resolved)) {
|
|
2274
1893
|
results.push(resolved);
|
|
2275
1894
|
}
|
|
@@ -2339,21 +1958,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2339
1958
|
* @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
|
|
2340
1959
|
*/
|
|
2341
1960
|
async readFile(pathOrId, options = "utf8") {
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
}
|
|
2345
|
-
const filePath = this.resolve(toFilePath(pathOrId), {
|
|
2346
|
-
pathType: "file"
|
|
2347
|
-
});
|
|
2348
|
-
if (filePath) {
|
|
1961
|
+
const filePath = await this.resolve(pathOrId);
|
|
1962
|
+
if (filePath && this.isFile(filePath)) {
|
|
2349
1963
|
let result;
|
|
2350
1964
|
if (isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
|
|
2351
1965
|
result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
|
|
2352
1966
|
} else {
|
|
2353
1967
|
result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
2354
1968
|
}
|
|
2355
|
-
|
|
2356
|
-
return content;
|
|
1969
|
+
return isBuffer(result) ? bufferToString(result) : result;
|
|
2357
1970
|
}
|
|
2358
1971
|
return void 0;
|
|
2359
1972
|
}
|
|
@@ -2364,16 +1977,10 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2364
1977
|
* @returns The contents of the file as a string, or undefined if the file does not exist.
|
|
2365
1978
|
*/
|
|
2366
1979
|
readFileSync(pathOrId, options = "utf8") {
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
}
|
|
2370
|
-
const filePath = this.resolve(toFilePath(pathOrId), {
|
|
2371
|
-
pathType: "file"
|
|
2372
|
-
});
|
|
2373
|
-
if (filePath) {
|
|
1980
|
+
const filePath = this.resolveSync(pathOrId);
|
|
1981
|
+
if (filePath && this.isFile(filePath)) {
|
|
2374
1982
|
const result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
2375
|
-
|
|
2376
|
-
return content;
|
|
1983
|
+
return isBuffer(result) ? bufferToString(result) : result;
|
|
2377
1984
|
}
|
|
2378
1985
|
return void 0;
|
|
2379
1986
|
}
|
|
@@ -2386,34 +1993,40 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2386
1993
|
* @returns A promise that resolves when the file is written.
|
|
2387
1994
|
*/
|
|
2388
1995
|
async writeFile(path, data = "", options = "utf8") {
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
await this.mkdir(findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1996
|
+
if (!this.isDirectory(findFilePath(this.#normalizePath(path)))) {
|
|
1997
|
+
await this.mkdir(findFilePath(this.#normalizePath(path)), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2392
1998
|
}
|
|
2393
|
-
|
|
1999
|
+
const metadata = isVirtualFileData(data) ? data : {};
|
|
2000
|
+
metadata.id = this.#normalizeId(path);
|
|
2001
|
+
let code = isVirtualFileData(data) ? metadata.code : data;
|
|
2394
2002
|
if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString(code)) {
|
|
2395
|
-
const resolvedConfig = await resolveConfig(
|
|
2003
|
+
const resolvedConfig = await resolveConfig(this.#normalizePath(path));
|
|
2396
2004
|
if (resolvedConfig) {
|
|
2397
2005
|
code = await format(code, {
|
|
2398
|
-
absolutePath:
|
|
2006
|
+
absolutePath: this.#normalizePath(path),
|
|
2399
2007
|
...resolvedConfig
|
|
2400
2008
|
});
|
|
2401
2009
|
}
|
|
2402
2010
|
}
|
|
2403
|
-
const outputMode = this.#unifiedFS.resolveMode(
|
|
2404
|
-
this.#log(LogLevelLabel.TRACE, `Writing ${
|
|
2405
|
-
this
|
|
2011
|
+
const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2012
|
+
this.#log(LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes(new Blob(toArray(code)).size)})`);
|
|
2013
|
+
this.#metadata[metadata.id] = {
|
|
2406
2014
|
mode: outputMode,
|
|
2407
2015
|
variant: "normal",
|
|
2408
2016
|
timestamp: Date.now(),
|
|
2409
|
-
...
|
|
2017
|
+
...metadata
|
|
2410
2018
|
};
|
|
2411
|
-
this.#
|
|
2412
|
-
|
|
2019
|
+
this.#paths[metadata.id] = this.#normalizePath(path);
|
|
2020
|
+
this.#ids[this.#normalizePath(path)] = metadata.id;
|
|
2021
|
+
const ifs = this.#unifiedFS.resolveFS(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2413
2022
|
if (isFunction(ifs.promises.writeFile)) {
|
|
2414
|
-
return ifs.promises.writeFile(
|
|
2023
|
+
return ifs.promises.writeFile(this.#normalizePath(path), code, isSetObject(options) ? omit(options, [
|
|
2024
|
+
"mode"
|
|
2025
|
+
]) : "utf8");
|
|
2415
2026
|
}
|
|
2416
|
-
return ifs.writeFileSync(
|
|
2027
|
+
return ifs.writeFileSync(this.#normalizePath(path), code, isSetObject(options) ? omit(options, [
|
|
2028
|
+
"mode"
|
|
2029
|
+
]) : "utf8");
|
|
2417
2030
|
}
|
|
2418
2031
|
/**
|
|
2419
2032
|
* Synchronously writes a file to the virtual file system (VFS).
|
|
@@ -2423,21 +2036,23 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2423
2036
|
* @param options - Optional parameters for writing the file.
|
|
2424
2037
|
*/
|
|
2425
2038
|
writeFileSync(path, data = "", options = "utf8") {
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
const
|
|
2432
|
-
this.#
|
|
2433
|
-
this.
|
|
2039
|
+
if (!this.isDirectory(findFilePath(this.#normalizePath(path)))) {
|
|
2040
|
+
this.mkdirSync(findFilePath(this.#normalizePath(path)), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2041
|
+
}
|
|
2042
|
+
const metadata = isVirtualFileData(data) ? data : {};
|
|
2043
|
+
metadata.id = this.#normalizeId(path);
|
|
2044
|
+
const code = isVirtualFileData(data) ? metadata.code : data;
|
|
2045
|
+
const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2046
|
+
this.#log(LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes(new Blob(toArray(code)).size)})`);
|
|
2047
|
+
this.#metadata[metadata.id] = {
|
|
2434
2048
|
mode: outputMode,
|
|
2435
2049
|
variant: "normal",
|
|
2436
2050
|
timestamp: Date.now(),
|
|
2437
|
-
...
|
|
2051
|
+
...metadata
|
|
2438
2052
|
};
|
|
2439
|
-
this.#
|
|
2440
|
-
|
|
2053
|
+
this.#paths[metadata.id] = this.#normalizePath(path);
|
|
2054
|
+
this.#ids[this.#normalizePath(path)] = metadata.id;
|
|
2055
|
+
const writeStream = this.#unifiedFS.resolveFS(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(this.#normalizePath(path));
|
|
2441
2056
|
try {
|
|
2442
2057
|
writeStream.write(code);
|
|
2443
2058
|
} finally {
|
|
@@ -2451,7 +2066,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2451
2066
|
* @returns `true` if the file exists, otherwise `false`.
|
|
2452
2067
|
*/
|
|
2453
2068
|
existsSync(pathOrId) {
|
|
2454
|
-
return this.
|
|
2069
|
+
return !!this.resolveSync(pathOrId);
|
|
2455
2070
|
}
|
|
2456
2071
|
/**
|
|
2457
2072
|
* Retrieves the metadata of a file in the virtual file system (VFS).
|
|
@@ -2460,7 +2075,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2460
2075
|
* @returns The metadata of the file, or undefined if the file does not exist.
|
|
2461
2076
|
*/
|
|
2462
2077
|
getMetadata(pathOrId) {
|
|
2463
|
-
const resolved = this.
|
|
2078
|
+
const resolved = this.resolveSync(pathOrId);
|
|
2464
2079
|
if (resolved && this.metadata[resolved]) {
|
|
2465
2080
|
return this.metadata[resolved];
|
|
2466
2081
|
}
|
|
@@ -2476,7 +2091,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2476
2091
|
* @returns `true` if the file exists, otherwise `false`.
|
|
2477
2092
|
*/
|
|
2478
2093
|
isFile(pathOrId) {
|
|
2479
|
-
const resolved = this.
|
|
2094
|
+
const resolved = this.resolveSync(pathOrId);
|
|
2480
2095
|
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()));
|
|
2481
2096
|
}
|
|
2482
2097
|
/**
|
|
@@ -2486,7 +2101,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2486
2101
|
* @returns `true` if the directory exists, otherwise `false`.
|
|
2487
2102
|
*/
|
|
2488
2103
|
isDirectory(pathOrId) {
|
|
2489
|
-
const resolved = this.
|
|
2104
|
+
const resolved = this.resolveSync(pathOrId);
|
|
2490
2105
|
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()));
|
|
2491
2106
|
}
|
|
2492
2107
|
/**
|
|
@@ -2496,7 +2111,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2496
2111
|
* @returns A promise that resolves to the file's status information, or false if the file does not exist.
|
|
2497
2112
|
*/
|
|
2498
2113
|
async stat(pathOrId, options) {
|
|
2499
|
-
return this.#unifiedFS.resolveFS(pathOrId).promises.stat(this.resolve(
|
|
2114
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.stat(await this.resolve(pathOrId) || pathOrId, options);
|
|
2500
2115
|
}
|
|
2501
2116
|
/**
|
|
2502
2117
|
* Synchronously retrieves the status of a file in the virtual file system (VFS).
|
|
@@ -2505,7 +2120,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2505
2120
|
* @returns The file's status information, or false if the file does not exist.
|
|
2506
2121
|
*/
|
|
2507
2122
|
statSync(pathOrId) {
|
|
2508
|
-
return this.#unifiedFS.resolveFS(pathOrId).statSync(this.
|
|
2123
|
+
return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolveSync(pathOrId) || pathOrId);
|
|
2509
2124
|
}
|
|
2510
2125
|
/**
|
|
2511
2126
|
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
@@ -2514,7 +2129,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2514
2129
|
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
2515
2130
|
*/
|
|
2516
2131
|
async lstat(pathOrId, options) {
|
|
2517
|
-
return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(this.resolve(
|
|
2132
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(await this.resolve(pathOrId) || pathOrId, options);
|
|
2518
2133
|
}
|
|
2519
2134
|
/**
|
|
2520
2135
|
* Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
@@ -2523,7 +2138,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2523
2138
|
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
2524
2139
|
*/
|
|
2525
2140
|
lstatSync(pathOrId, options) {
|
|
2526
|
-
return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.
|
|
2141
|
+
return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolveSync(pathOrId) || pathOrId, options);
|
|
2527
2142
|
}
|
|
2528
2143
|
/**
|
|
2529
2144
|
* Resolves a path or ID to its real path in the virtual file system (VFS).
|
|
@@ -2532,52 +2147,113 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2532
2147
|
* @returns The resolved real path if it exists, otherwise undefined.
|
|
2533
2148
|
*/
|
|
2534
2149
|
realpathSync(pathOrId) {
|
|
2535
|
-
const filePath = this.
|
|
2150
|
+
const filePath = this.resolveSync(pathOrId);
|
|
2536
2151
|
if (!filePath) {
|
|
2537
|
-
throw new Error(`File not found: ${
|
|
2152
|
+
throw new Error(`File not found: ${pathOrId}`);
|
|
2538
2153
|
}
|
|
2539
2154
|
return filePath;
|
|
2540
2155
|
}
|
|
2541
2156
|
/**
|
|
2542
|
-
*
|
|
2157
|
+
* A helper function to resolve modules in the virtual file system (VFS).
|
|
2543
2158
|
*
|
|
2544
|
-
* @
|
|
2545
|
-
*
|
|
2546
|
-
*
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2159
|
+
* @remarks
|
|
2160
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
2161
|
+
*
|
|
2162
|
+
* @example
|
|
2163
|
+
* ```ts
|
|
2164
|
+
* const resolved = await context.resolvePath("some-module", "/path/to/importer");
|
|
2165
|
+
* ```
|
|
2166
|
+
*
|
|
2167
|
+
* @param id - The module to resolve.
|
|
2168
|
+
* @param importer - An optional path to the importer module.
|
|
2169
|
+
* @param options - Additional resolution options.
|
|
2170
|
+
* @returns A promise that resolves to the resolved module path.
|
|
2171
|
+
*/
|
|
2172
|
+
async resolve(id, importer, options = {}) {
|
|
2173
|
+
let result = this.resolverCache.get(this.#normalizeId(id));
|
|
2174
|
+
if (result) {
|
|
2175
|
+
return result;
|
|
2557
2176
|
}
|
|
2177
|
+
result = this.paths[this.#normalizeId(id)];
|
|
2558
2178
|
if (!result) {
|
|
2559
|
-
|
|
2179
|
+
const paths = options.paths ?? [];
|
|
2180
|
+
if (importer && !paths.includes(importer)) {
|
|
2181
|
+
paths.push(importer);
|
|
2182
|
+
}
|
|
2183
|
+
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2184
|
+
paths.push(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot));
|
|
2185
|
+
paths.push(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, this.#context.config.sourceRoot));
|
|
2186
|
+
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) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2187
|
+
for (const combination of getResolutionCombinations(id, {
|
|
2188
|
+
paths
|
|
2189
|
+
})) {
|
|
2190
|
+
if (this.#existsSync(combination)) {
|
|
2191
|
+
result = combination;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
try {
|
|
2195
|
+
result = await resolve(id, {
|
|
2196
|
+
paths
|
|
2197
|
+
});
|
|
2198
|
+
} catch {
|
|
2199
|
+
}
|
|
2560
2200
|
}
|
|
2561
|
-
if (result
|
|
2562
|
-
|
|
2201
|
+
if (result) {
|
|
2202
|
+
result = toAbsolutePath(appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
|
|
2203
|
+
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2563
2204
|
}
|
|
2564
|
-
this.#cachedResolver.set(resolverKey, result);
|
|
2565
2205
|
return result;
|
|
2566
2206
|
}
|
|
2567
2207
|
/**
|
|
2568
|
-
*
|
|
2208
|
+
* A synchronous helper function to resolve modules using the Jiti resolver
|
|
2209
|
+
*
|
|
2210
|
+
* @remarks
|
|
2211
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
2212
|
+
*
|
|
2213
|
+
* @example
|
|
2214
|
+
* ```ts
|
|
2215
|
+
* const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
|
|
2216
|
+
* ```
|
|
2569
2217
|
*
|
|
2570
|
-
* @param
|
|
2571
|
-
* @
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
return
|
|
2218
|
+
* @param id - The module to resolve.
|
|
2219
|
+
* @param importer - An optional path to the importer module.
|
|
2220
|
+
* @param options - Additional resolution options.
|
|
2221
|
+
* @returns The resolved module path.
|
|
2222
|
+
*/
|
|
2223
|
+
resolveSync(id, importer, options = {}) {
|
|
2224
|
+
let result = this.resolverCache.get(this.#normalizeId(id));
|
|
2225
|
+
if (result) {
|
|
2226
|
+
return result;
|
|
2227
|
+
}
|
|
2228
|
+
result = this.paths[this.#normalizeId(id)];
|
|
2229
|
+
if (!result) {
|
|
2230
|
+
const paths = options.paths ?? [];
|
|
2231
|
+
if (importer && !paths.includes(importer)) {
|
|
2232
|
+
paths.push(importer);
|
|
2233
|
+
}
|
|
2234
|
+
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2235
|
+
paths.push(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot));
|
|
2236
|
+
paths.push(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, this.#context.config.sourceRoot));
|
|
2237
|
+
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) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2238
|
+
for (const combination of getResolutionCombinations(id, {
|
|
2239
|
+
paths
|
|
2240
|
+
})) {
|
|
2241
|
+
if (this.#existsSync(combination)) {
|
|
2242
|
+
result = combination;
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
try {
|
|
2246
|
+
result = resolveSync(id, {
|
|
2247
|
+
paths
|
|
2248
|
+
});
|
|
2249
|
+
} catch {
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
if (result) {
|
|
2253
|
+
result = toAbsolutePath(appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
|
|
2254
|
+
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2579
2255
|
}
|
|
2580
|
-
return
|
|
2256
|
+
return result;
|
|
2581
2257
|
}
|
|
2582
2258
|
/**
|
|
2583
2259
|
* Disposes of the virtual file system (VFS) by saving its state to disk.
|
|
@@ -2586,7 +2262,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2586
2262
|
if (!this.#isDisposed) {
|
|
2587
2263
|
this.#isDisposed = true;
|
|
2588
2264
|
this.#log(LogLevelLabel.DEBUG, "Disposing virtual file system...");
|
|
2589
|
-
await this.unlink(joinPaths$1(this.#context.
|
|
2265
|
+
await this.unlink(joinPaths$1(this.#context.dataPath, "fs.bin"));
|
|
2590
2266
|
const message = new $.Message();
|
|
2591
2267
|
const fs2 = message.initRoot(FileSystem);
|
|
2592
2268
|
const virtualFS = this.#unifiedFS.toJSON();
|
|
@@ -2595,7 +2271,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2595
2271
|
virtualFiles.forEach(([path, code], index) => {
|
|
2596
2272
|
const fd = files.get(index);
|
|
2597
2273
|
fd.path = path;
|
|
2598
|
-
fd.code = code;
|
|
2274
|
+
fd.code = code || "";
|
|
2599
2275
|
});
|
|
2600
2276
|
const ids = fs2._initIds(Object.keys(this.ids).length);
|
|
2601
2277
|
Object.entries(this.ids).forEach(([id, path], index) => {
|
|
@@ -2619,7 +2295,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2619
2295
|
});
|
|
2620
2296
|
}
|
|
2621
2297
|
});
|
|
2622
|
-
await writeFileBuffer(joinPaths$1(this.#context.
|
|
2298
|
+
await writeFileBuffer(joinPaths$1(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
|
|
2299
|
+
this.#resolverCache.save(true);
|
|
2300
|
+
this.#log(LogLevelLabel.DEBUG, "Virtual file system disposed.");
|
|
2623
2301
|
}
|
|
2624
2302
|
}
|
|
2625
2303
|
/**
|
|
@@ -2647,6 +2325,105 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2647
2325
|
return this.dispose();
|
|
2648
2326
|
}
|
|
2649
2327
|
};
|
|
2328
|
+
var VirtualFileSystemHost = class VirtualFileSystemHost2 extends InMemoryFileSystemHost {
|
|
2329
|
+
static {
|
|
2330
|
+
__name(this, "VirtualFileSystemHost");
|
|
2331
|
+
}
|
|
2332
|
+
#fs;
|
|
2333
|
+
constructor(fs2) {
|
|
2334
|
+
super();
|
|
2335
|
+
this.#fs = fs2;
|
|
2336
|
+
}
|
|
2337
|
+
deleteSync(path) {
|
|
2338
|
+
this.#fs.rmSync(path);
|
|
2339
|
+
}
|
|
2340
|
+
readDirSync(dirPath) {
|
|
2341
|
+
return this.#fs.readdirSync(dirPath).reduce((ret, entry) => {
|
|
2342
|
+
const fullPath = this.#fs.resolveSync(joinPaths(dirPath, entry));
|
|
2343
|
+
if (fullPath) {
|
|
2344
|
+
ret.push({
|
|
2345
|
+
name: entry,
|
|
2346
|
+
isDirectory: this.#fs.isDirectory(fullPath),
|
|
2347
|
+
isFile: this.#fs.isFile(fullPath),
|
|
2348
|
+
isSymlink: false
|
|
2349
|
+
});
|
|
2350
|
+
}
|
|
2351
|
+
return ret;
|
|
2352
|
+
}, []);
|
|
2353
|
+
}
|
|
2354
|
+
async readFile(filePath) {
|
|
2355
|
+
if (!this.#fs.existsSync(filePath)) {
|
|
2356
|
+
throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
|
|
2357
|
+
}
|
|
2358
|
+
return await this.#fs.readFile(filePath);
|
|
2359
|
+
}
|
|
2360
|
+
readFileSync(filePath) {
|
|
2361
|
+
if (!this.#fs.existsSync(filePath)) {
|
|
2362
|
+
throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
|
|
2363
|
+
}
|
|
2364
|
+
return this.#fs.readFileSync(filePath);
|
|
2365
|
+
}
|
|
2366
|
+
async writeFile(filePath, fileText) {
|
|
2367
|
+
return this.#fs.writeFile(filePath, fileText);
|
|
2368
|
+
}
|
|
2369
|
+
writeFileSync(filePath, fileText) {
|
|
2370
|
+
this.#fs.writeFileSync(filePath, fileText);
|
|
2371
|
+
}
|
|
2372
|
+
async mkdir(dirPath) {
|
|
2373
|
+
await this.#fs.mkdir(dirPath);
|
|
2374
|
+
}
|
|
2375
|
+
mkdirSync(dirPath) {
|
|
2376
|
+
this.#fs.mkdirSync(dirPath);
|
|
2377
|
+
}
|
|
2378
|
+
async move(srcPath, destPath) {
|
|
2379
|
+
await this.#fs.move(srcPath, destPath);
|
|
2380
|
+
}
|
|
2381
|
+
moveSync(srcPath, destPath) {
|
|
2382
|
+
this.#fs.moveSync(srcPath, destPath);
|
|
2383
|
+
}
|
|
2384
|
+
async copy(srcPath, destPath) {
|
|
2385
|
+
await this.#fs.copy(srcPath, destPath);
|
|
2386
|
+
}
|
|
2387
|
+
copySync(srcPath, destPath) {
|
|
2388
|
+
this.#fs.copySync(srcPath, destPath);
|
|
2389
|
+
}
|
|
2390
|
+
async fileExists(filePath) {
|
|
2391
|
+
return this.#fs.isFile(filePath);
|
|
2392
|
+
}
|
|
2393
|
+
fileExistsSync(filePath) {
|
|
2394
|
+
return this.#fs.isFile(filePath);
|
|
2395
|
+
}
|
|
2396
|
+
async directoryExists(dirPath) {
|
|
2397
|
+
return this.#fs.isDirectory(dirPath);
|
|
2398
|
+
}
|
|
2399
|
+
directoryExistsSync(dirPath) {
|
|
2400
|
+
return this.#fs.isDirectory(dirPath);
|
|
2401
|
+
}
|
|
2402
|
+
realpathSync(path) {
|
|
2403
|
+
return this.#fs.resolveSync(path) || path;
|
|
2404
|
+
}
|
|
2405
|
+
getCurrentDirectory() {
|
|
2406
|
+
return "/";
|
|
2407
|
+
}
|
|
2408
|
+
async glob(patterns) {
|
|
2409
|
+
return this.#fs.glob(patterns);
|
|
2410
|
+
}
|
|
2411
|
+
globSync(patterns) {
|
|
2412
|
+
return this.#fs.globSync(patterns);
|
|
2413
|
+
}
|
|
2414
|
+
};
|
|
2415
|
+
function createProgram(context, override) {
|
|
2416
|
+
const project = new Project({
|
|
2417
|
+
compilerOptions: {
|
|
2418
|
+
...context.tsconfig.options
|
|
2419
|
+
},
|
|
2420
|
+
tsConfigFilePath: context.tsconfig.tsconfigFilePath,
|
|
2421
|
+
fileSystem: new VirtualFileSystemHost(context.fs),
|
|
2422
|
+
...override
|
|
2423
|
+
});
|
|
2424
|
+
return project;
|
|
2425
|
+
}
|
|
2426
|
+
__name(createProgram, "createProgram");
|
|
2650
2427
|
var PROJECT_ROOT_HASH_LENGTH = 45;
|
|
2651
2428
|
var CACHE_HASH_LENGTH = 62;
|
|
2652
2429
|
function getPrefixedProjectRootHash(name, projectRootHash) {
|
|
@@ -2683,6 +2460,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2683
2460
|
#envPaths;
|
|
2684
2461
|
#fs;
|
|
2685
2462
|
#tsconfig;
|
|
2463
|
+
#program;
|
|
2464
|
+
#resolvePatterns = [];
|
|
2686
2465
|
#getConfigProps(config = {}) {
|
|
2687
2466
|
return {
|
|
2688
2467
|
variant: config.build?.variant,
|
|
@@ -2774,7 +2553,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2774
2553
|
*/
|
|
2775
2554
|
get tsconfig() {
|
|
2776
2555
|
if (!this.#tsconfig) {
|
|
2777
|
-
this
|
|
2556
|
+
this.tsconfig = {
|
|
2778
2557
|
tsconfigFilePath: this.config.tsconfig
|
|
2779
2558
|
};
|
|
2780
2559
|
}
|
|
@@ -2785,6 +2564,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2785
2564
|
*/
|
|
2786
2565
|
set tsconfig(value) {
|
|
2787
2566
|
this.#tsconfig = value;
|
|
2567
|
+
this.#resolvePatterns = tsconfigPathsToRegExp(value?.options?.paths ?? {});
|
|
2788
2568
|
}
|
|
2789
2569
|
/**
|
|
2790
2570
|
* The virtual file system interface for the project
|
|
@@ -2909,6 +2689,106 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2909
2689
|
return Object.values(this.fs.metadata).filter((meta) => meta && meta.type === "builtin").map((meta) => meta?.id).filter(Boolean);
|
|
2910
2690
|
}
|
|
2911
2691
|
/**
|
|
2692
|
+
* The {@link Project} instance used for type reflection and module manipulation
|
|
2693
|
+
*
|
|
2694
|
+
* @see https://ts-morph.com/
|
|
2695
|
+
*
|
|
2696
|
+
* @remarks
|
|
2697
|
+
* This instance is created lazily on first access.
|
|
2698
|
+
*/
|
|
2699
|
+
get program() {
|
|
2700
|
+
if (!this.#program) {
|
|
2701
|
+
this.#program = createProgram(this, {
|
|
2702
|
+
skipAddingFilesFromTsConfig: true
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2705
|
+
return this.#program;
|
|
2706
|
+
}
|
|
2707
|
+
/**
|
|
2708
|
+
* A helper function to resolve modules in the Virtual File System
|
|
2709
|
+
*
|
|
2710
|
+
* @remarks
|
|
2711
|
+
* This function can be used to resolve modules relative to the project root directory.
|
|
2712
|
+
*
|
|
2713
|
+
* @example
|
|
2714
|
+
* ```ts
|
|
2715
|
+
* const resolved = await context.resolve("some-module", "/path/to/importer");
|
|
2716
|
+
* ```
|
|
2717
|
+
*
|
|
2718
|
+
* @param id - The module to resolve.
|
|
2719
|
+
* @param importer - An optional path to the importer module.
|
|
2720
|
+
* @param options - Additional resolution options.
|
|
2721
|
+
* @returns A promise that resolves to the resolved module path.
|
|
2722
|
+
*/
|
|
2723
|
+
async resolveId(id, importer, options = {}) {
|
|
2724
|
+
if (this.fs.isVirtual(id)) {
|
|
2725
|
+
const result = await this.fs.resolve(id, importer, options);
|
|
2726
|
+
if (!result) {
|
|
2727
|
+
return void 0;
|
|
2728
|
+
}
|
|
2729
|
+
return {
|
|
2730
|
+
id: `\0${result}`,
|
|
2731
|
+
external: this.config.projectType !== "application"
|
|
2732
|
+
};
|
|
2733
|
+
}
|
|
2734
|
+
if (this.config.build.skipNodeModulesBundle) {
|
|
2735
|
+
if (match(id, this.#resolvePatterns) || match(id, this.config.build.noExternal)) {
|
|
2736
|
+
return void 0;
|
|
2737
|
+
}
|
|
2738
|
+
if (match(id, this.config.build.external) || id.startsWith("node:")) {
|
|
2739
|
+
return {
|
|
2740
|
+
id,
|
|
2741
|
+
external: true
|
|
2742
|
+
};
|
|
2743
|
+
}
|
|
2744
|
+
if (!/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(id)) {
|
|
2745
|
+
return {
|
|
2746
|
+
id,
|
|
2747
|
+
external: true
|
|
2748
|
+
};
|
|
2749
|
+
}
|
|
2750
|
+
} else {
|
|
2751
|
+
if (match(id, this.config.build.noExternal)) {
|
|
2752
|
+
return void 0;
|
|
2753
|
+
}
|
|
2754
|
+
if (match(id, this.config.build.external) || id.startsWith("node:")) {
|
|
2755
|
+
return {
|
|
2756
|
+
id,
|
|
2757
|
+
external: true
|
|
2758
|
+
};
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
return void 0;
|
|
2762
|
+
}
|
|
2763
|
+
/**
|
|
2764
|
+
* A helper function to load modules from the Virtual File System
|
|
2765
|
+
*
|
|
2766
|
+
* @remarks
|
|
2767
|
+
* This function can be used to load modules relative to the project root directory.
|
|
2768
|
+
*
|
|
2769
|
+
* @example
|
|
2770
|
+
* ```ts
|
|
2771
|
+
* const module = await context.load("some-module", "/path/to/importer");
|
|
2772
|
+
* ```
|
|
2773
|
+
*
|
|
2774
|
+
* @param id - The module to load.
|
|
2775
|
+
* @returns A promise that resolves to the loaded module.
|
|
2776
|
+
*/
|
|
2777
|
+
async load(id) {
|
|
2778
|
+
const resolvedId = await this.fs.resolve(id);
|
|
2779
|
+
if (!resolvedId) {
|
|
2780
|
+
return void 0;
|
|
2781
|
+
}
|
|
2782
|
+
const code = await this.fs.readFile(resolvedId);
|
|
2783
|
+
if (!code) {
|
|
2784
|
+
return void 0;
|
|
2785
|
+
}
|
|
2786
|
+
return {
|
|
2787
|
+
code,
|
|
2788
|
+
map: null
|
|
2789
|
+
};
|
|
2790
|
+
}
|
|
2791
|
+
/**
|
|
2912
2792
|
* Get the builtin virtual files that exist in the Powerlines virtual file system
|
|
2913
2793
|
*/
|
|
2914
2794
|
async getBuiltins() {
|
|
@@ -3245,6 +3125,24 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3245
3125
|
ret.push(plugin);
|
|
3246
3126
|
return ret;
|
|
3247
3127
|
}, []);
|
|
3128
|
+
if (this.config.tsconfig) {
|
|
3129
|
+
this.config.tsconfig = replacePathTokens(this, this.config.tsconfig);
|
|
3130
|
+
}
|
|
3131
|
+
if (this.config.output.dts) {
|
|
3132
|
+
this.config.output.dts = replacePathTokens(this, this.config.output.dts);
|
|
3133
|
+
}
|
|
3134
|
+
if (this.config.build.polyfill) {
|
|
3135
|
+
this.config.build.polyfill = this.config.build.polyfill.map((polyfill) => replacePathTokens(this, polyfill));
|
|
3136
|
+
}
|
|
3137
|
+
if (this.config.output.assets) {
|
|
3138
|
+
this.config.output.assets = this.config.output.assets.map((asset) => ({
|
|
3139
|
+
...asset,
|
|
3140
|
+
glob: replacePathTokens(this, asset.glob),
|
|
3141
|
+
ignore: asset.ignore ? asset.ignore.map((ignore) => replacePathTokens(this, ignore)) : void 0,
|
|
3142
|
+
input: replacePathTokens(this, asset.input),
|
|
3143
|
+
output: replacePathTokens(this, asset.output)
|
|
3144
|
+
}));
|
|
3145
|
+
}
|
|
3248
3146
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
3249
3147
|
}
|
|
3250
3148
|
mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
|
|
@@ -3665,13 +3563,9 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
|
|
|
3665
3563
|
await resolveTsconfig(context);
|
|
3666
3564
|
await installDependencies(context);
|
|
3667
3565
|
await this.callPostHook(context, "configResolved");
|
|
3668
|
-
if (context.config.build.polyfill) {
|
|
3669
|
-
context.config.build.polyfill = context.config.build.polyfill.map((polyfill) => replacePathTokens(context, polyfill));
|
|
3670
|
-
}
|
|
3671
3566
|
context.log(LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
|
|
3672
3567
|
|
|
3673
3568
|
${formatLogMessage(context.config)}`);
|
|
3674
|
-
context.fs[__VFS_PATCH__]();
|
|
3675
3569
|
await writeMetaFile(context);
|
|
3676
3570
|
context.persistedMeta = context.meta;
|
|
3677
3571
|
if (!existsSync(context.cachePath)) {
|
|
@@ -3721,35 +3615,19 @@ ${formatLogMessage(context.config)}`);
|
|
|
3721
3615
|
if (!typescriptPath) {
|
|
3722
3616
|
throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
|
|
3723
3617
|
}
|
|
3724
|
-
const files = builtinFilePaths.reduce(
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
ret.
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
joinPaths$1(typescriptPath, "lib", "lib.esnext.full.d.ts")
|
|
3732
|
-
]);
|
|
3733
|
-
context.log(LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
|
|
3734
|
-
const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu6({
|
|
3735
|
-
compilerOptions: {
|
|
3736
|
-
strict: false,
|
|
3737
|
-
noEmit: false,
|
|
3738
|
-
declaration: true,
|
|
3739
|
-
declarationMap: false,
|
|
3740
|
-
emitDeclarationOnly: true,
|
|
3741
|
-
skipLibCheck: true
|
|
3618
|
+
const files = builtinFilePaths.reduce(
|
|
3619
|
+
(ret, fileName) => {
|
|
3620
|
+
const formatted = replacePath(fileName, context.workspaceConfig.workspaceRoot);
|
|
3621
|
+
if (!ret.includes(formatted)) {
|
|
3622
|
+
ret.push(formatted);
|
|
3623
|
+
}
|
|
3624
|
+
return ret;
|
|
3742
3625
|
},
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
}, context.config.tsconfigRaw ?? {}));
|
|
3749
|
-
resolvedTsconfig.options.configFilePath = joinPaths$1(context.workspaceConfig.workspaceRoot, context.tsconfig.tsconfigFilePath);
|
|
3750
|
-
resolvedTsconfig.options.pathsBasePath = context.workspaceConfig.workspaceRoot;
|
|
3751
|
-
resolvedTsconfig.options.suppressOutputPathCheck = true;
|
|
3752
|
-
let generatedTypes = await emitTypes(context, resolvedTsconfig, files);
|
|
3626
|
+
[]
|
|
3627
|
+
// [joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")]
|
|
3628
|
+
);
|
|
3629
|
+
context.log(LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
|
|
3630
|
+
let generatedTypes = await emitTypes(context, files);
|
|
3753
3631
|
context.log(LogLevelLabel.TRACE, `Generating TypeScript declaration file in ${context.config.output.dts}.`);
|
|
3754
3632
|
const directives = [];
|
|
3755
3633
|
let result = await this.callPreHook(context, "generateTypes", generatedTypes);
|
|
@@ -3803,7 +3681,6 @@ ${formatTypes(generatedTypes)}
|
|
|
3803
3681
|
}
|
|
3804
3682
|
await this.callPostHook(context, "prepare");
|
|
3805
3683
|
await writeMetaFile(context);
|
|
3806
|
-
context.fs[__VFS_REVERT__]();
|
|
3807
3684
|
});
|
|
3808
3685
|
this.context.log(LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
|
|
3809
3686
|
}
|
|
@@ -4242,4 +4119,4 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
4242
4119
|
}
|
|
4243
4120
|
};
|
|
4244
4121
|
|
|
4245
|
-
export {
|
|
4122
|
+
export { FileData, FileId, FileMetadata, FileMetadata_KeyValuePair, FileSystem, FileType, PowerlinesAPI, PreserveSignatureType, _capnpFileId, createLog, extendLog };
|