powerlines 0.10.2 → 0.11.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/astro.cjs +8 -8
- package/dist/astro.d.cts +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +5 -5
- package/dist/{chunk-5XYGZ3DC.cjs → chunk-22K72CJ5.cjs} +2 -2
- package/dist/{chunk-GPPJ2CRE.js → chunk-4HGQJ4KR.js} +2 -2
- package/dist/chunk-7MTW3KR2.cjs +12 -0
- package/dist/{chunk-VIRKTIPK.js → chunk-7UIYU6SC.js} +3 -3
- package/dist/chunk-7WMWRX2S.cjs +12 -0
- package/dist/{chunk-HVT7PBFF.js → chunk-A3BBPLTY.js} +3 -3
- package/dist/{chunk-S746E63M.js → chunk-BHP6KBGK.js} +3 -3
- package/dist/{chunk-ZU4IRZSQ.js → chunk-BOIEJ5I6.js} +3 -3
- package/dist/chunk-DELRP3WY.js +31 -0
- package/dist/{chunk-ZBDP43LG.cjs → chunk-ELHJY5WG.cjs} +4 -4
- package/dist/{chunk-UHCRNFFC.cjs → chunk-FANQC345.cjs} +4 -4
- package/dist/chunk-GV3S7ZR3.cjs +34 -0
- package/dist/{chunk-WCPY7HPU.js → chunk-L3DAMAEC.js} +4 -4
- package/dist/chunk-LC6FLEJS.cjs +12 -0
- package/dist/{chunk-N7NE3VOU.js → chunk-MAEKW52U.js} +3 -3
- package/dist/chunk-MXJWCZDP.cjs +12 -0
- package/dist/{chunk-EGSEJQCE.js → chunk-NGKWITCO.js} +3 -3
- package/dist/{chunk-L2SAK2JC.cjs → chunk-OC7CCD5M.cjs} +4 -4
- package/dist/{chunk-OYIM2M74.js → chunk-P4BOYWXT.js} +195 -6
- package/dist/{chunk-UTVZVGM3.cjs → chunk-PJRHRDLS.cjs} +204 -15
- package/dist/{chunk-5Y4JYQ66.js → chunk-RBRFT2R6.js} +3 -3
- package/dist/{chunk-66GXB2UY.cjs → chunk-RU6BHTIP.cjs} +4 -4
- package/dist/{chunk-WPVIF35O.js → chunk-SIZKRND7.js} +2 -2
- package/dist/chunk-SNARILEC.cjs +24 -0
- package/dist/{chunk-6UDHGAAI.js → chunk-SY7N6FC3.js} +3 -3
- package/dist/{chunk-QHGPZK2H.cjs → chunk-V5D5NVV7.cjs} +4 -4
- package/dist/{chunk-SDEBJQDT.js → chunk-V7LXFIGK.js} +3 -3
- package/dist/{chunk-2RHPFVYT.cjs → chunk-WCTOTE3T.cjs} +8 -8
- package/dist/chunk-WD4363UW.cjs +12 -0
- package/dist/{chunk-7IWH37DY.cjs → chunk-YIWHO6SW.cjs} +2 -2
- package/dist/{chunk-3Y5CCIJR.js → chunk-ZP5QLZQ2.js} +3 -3
- package/dist/{chunk-KYGEWAEG.js → chunk-ZQ7U35QZ.js} +3 -3
- package/dist/define-config.d.cts +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/esbuild.cjs +7 -7
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +4 -4
- package/dist/extend-plugin.d.cts +1 -1
- package/dist/extend-plugin.d.ts +1 -1
- package/dist/farm.cjs +4 -4
- package/dist/farm.d.cts +1 -1
- package/dist/farm.d.ts +1 -1
- package/dist/farm.js +3 -3
- package/dist/{hooks-gk8S8LFP.d.cts → hooks-H3i0YxVa.d.cts} +1 -1
- package/dist/{hooks-BGYnc61f.d.ts → hooks-QG1Q6zBM.d.ts} +1 -1
- package/dist/index.cjs +26 -26
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -17
- package/dist/internal/api.cjs +3 -3
- package/dist/internal/api.d.cts +2 -2
- package/dist/internal/api.d.ts +2 -2
- package/dist/internal/api.js +2 -2
- package/dist/lib/build/esbuild.d.cts +12 -12
- package/dist/lib/build/esbuild.d.ts +12 -12
- package/dist/lib/build/index.cjs +18 -18
- package/dist/lib/build/index.d.cts +13 -13
- package/dist/lib/build/index.d.ts +13 -13
- package/dist/lib/build/index.js +3 -3
- package/dist/lib/build/rolldown.d.cts +12 -12
- package/dist/lib/build/rolldown.d.ts +12 -12
- package/dist/lib/build/rollup.d.cts +12 -12
- package/dist/lib/build/rollup.d.ts +12 -12
- package/dist/lib/build/rspack.d.cts +12 -12
- package/dist/lib/build/rspack.d.ts +12 -12
- package/dist/lib/build/tsup.d.cts +11 -11
- package/dist/lib/build/tsup.d.ts +11 -11
- package/dist/lib/build/unbuild.cjs +5 -5
- package/dist/lib/build/unbuild.d.cts +13 -13
- package/dist/lib/build/unbuild.d.ts +13 -13
- package/dist/lib/build/unbuild.js +2 -2
- package/dist/lib/build/vite.d.cts +12 -12
- package/dist/lib/build/vite.d.ts +12 -12
- package/dist/lib/build/webpack.d.cts +12 -12
- package/dist/lib/build/webpack.d.ts +12 -12
- package/dist/lib/bundle.cjs +16 -0
- package/dist/lib/bundle.cjs.map +1 -0
- package/dist/lib/bundle.d.cts +44 -0
- package/dist/lib/bundle.d.ts +44 -0
- package/dist/lib/bundle.js +7 -0
- package/dist/lib/bundle.js.map +1 -0
- package/dist/lib/chunk-2625RJNJ.cjs +41 -0
- package/dist/lib/chunk-2625RJNJ.cjs.map +1 -0
- package/dist/lib/{chunk-PIFE7MUZ.js → chunk-6BRTJXZ2.js} +195 -6
- package/dist/lib/chunk-6BRTJXZ2.js.map +1 -0
- package/dist/lib/chunk-6IJTWIVJ.cjs +107 -0
- package/dist/lib/chunk-6IJTWIVJ.cjs.map +1 -0
- package/dist/lib/{chunk-YVDJCVE5.cjs → chunk-BAC4AJEP.cjs} +3 -3
- package/dist/lib/{chunk-YVDJCVE5.cjs.map → chunk-BAC4AJEP.cjs.map} +1 -1
- package/dist/lib/{chunk-Q2RUDKWY.cjs → chunk-BW3VFCTS.cjs} +2 -2
- package/dist/lib/chunk-BW3VFCTS.cjs.map +1 -0
- package/dist/lib/chunk-ESYYL5UH.js +105 -0
- package/dist/lib/chunk-ESYYL5UH.js.map +1 -0
- package/dist/lib/chunk-GTQZYDA7.js +39 -0
- package/dist/lib/chunk-GTQZYDA7.js.map +1 -0
- package/dist/lib/{chunk-M7U5RMK7.js → chunk-KOCDKJDJ.js} +2 -2
- package/dist/lib/chunk-KOCDKJDJ.js.map +1 -0
- package/dist/lib/{chunk-M7WHFUKR.cjs → chunk-LYD5OTBI.cjs} +210 -21
- package/dist/lib/chunk-LYD5OTBI.cjs.map +1 -0
- package/dist/lib/{chunk-6U2UX2PX.cjs → chunk-RLMEYZ5I.cjs} +11 -15
- package/dist/lib/chunk-RLMEYZ5I.cjs.map +1 -0
- package/dist/lib/{chunk-CAPN4FSS.js → chunk-S4TGQD45.js} +3 -3
- package/dist/lib/{chunk-CAPN4FSS.js.map → chunk-S4TGQD45.js.map} +1 -1
- package/dist/lib/{chunk-KFE2IR3Y.js → chunk-V2T4H24I.js} +11 -15
- package/dist/lib/chunk-V2T4H24I.js.map +1 -0
- package/dist/lib/config-file.d.cts +11 -11
- package/dist/lib/config-file.d.ts +11 -11
- package/dist/lib/{config-AuIGsUck.d.cts → context-B481RQbf.d.cts} +615 -559
- package/dist/lib/{config-B_WTwd49.d.ts → context-efHKG-wc.d.ts} +615 -559
- package/dist/lib/create-program.cjs +13 -0
- package/dist/lib/create-program.cjs.map +1 -0
- package/dist/lib/create-program.d.cts +42 -0
- package/dist/lib/create-program.d.ts +42 -0
- package/dist/lib/create-program.js +4 -0
- package/dist/lib/create-program.js.map +1 -0
- package/dist/lib/entry.d.cts +12 -12
- package/dist/lib/entry.d.ts +12 -12
- package/dist/lib/{hooks-DErK4Fv4.d.ts → hooks-CdvPHbFZ.d.cts} +1 -1
- package/dist/lib/{hooks-4KkL9GD2.d.cts → hooks-JhMVguVh.d.ts} +1 -1
- package/dist/lib/index.cjs +47 -36
- package/dist/lib/index.d.cts +16 -13
- package/dist/lib/index.d.ts +16 -13
- package/dist/lib/index.js +10 -7
- package/dist/lib/logger.d.cts +12 -12
- package/dist/lib/logger.d.ts +12 -12
- package/dist/lib/typescript/compiler-host.cjs +46 -2
- package/dist/lib/typescript/compiler-host.cjs.map +1 -1
- package/dist/lib/typescript/compiler-host.d.cts +18 -13
- package/dist/lib/typescript/compiler-host.d.ts +18 -13
- package/dist/lib/typescript/compiler-host.js +45 -2
- package/dist/lib/typescript/compiler-host.js.map +1 -1
- package/dist/lib/typescript/import-transformer.d.cts +12 -12
- package/dist/lib/typescript/import-transformer.d.ts +12 -12
- package/dist/lib/typescript/index.cjs +6 -6
- package/dist/lib/typescript/index.d.cts +12 -12
- package/dist/lib/typescript/index.d.ts +12 -12
- package/dist/lib/typescript/index.js +1 -1
- package/dist/lib/typescript/program.cjs +6 -6
- package/dist/lib/typescript/program.d.cts +13 -13
- package/dist/lib/typescript/program.d.ts +13 -13
- package/dist/lib/typescript/program.js +1 -1
- package/dist/lib/unplugin/factory.cjs +3 -3
- package/dist/lib/unplugin/factory.d.cts +12 -12
- package/dist/lib/unplugin/factory.d.ts +12 -12
- package/dist/lib/unplugin/factory.js +2 -2
- package/dist/lib/unplugin/index.cjs +3 -3
- package/dist/lib/unplugin/index.d.cts +12 -12
- package/dist/lib/unplugin/index.d.ts +12 -12
- package/dist/lib/unplugin/index.js +2 -2
- package/dist/lib/unplugin/plugin.d.cts +11 -11
- package/dist/lib/unplugin/plugin.d.ts +11 -11
- package/dist/lib/unplugin/resolve-id.d.cts +11 -11
- package/dist/lib/unplugin/resolve-id.d.ts +11 -11
- package/dist/lib/utilities/file-header.d.cts +12 -12
- package/dist/lib/utilities/file-header.d.ts +12 -12
- package/dist/lib/utilities/index.cjs +20 -20
- package/dist/lib/utilities/index.d.cts +12 -12
- package/dist/lib/utilities/index.d.ts +12 -12
- package/dist/lib/utilities/index.js +3 -3
- package/dist/lib/utilities/meta.cjs +8 -8
- package/dist/lib/utilities/meta.d.cts +12 -12
- package/dist/lib/utilities/meta.d.ts +12 -12
- package/dist/lib/utilities/meta.js +1 -1
- package/dist/lib/utilities/plugin-helpers.d.cts +11 -11
- package/dist/lib/utilities/plugin-helpers.d.ts +11 -11
- package/dist/lib/utilities/resolve-path.d.cts +12 -12
- package/dist/lib/utilities/resolve-path.d.ts +12 -12
- package/dist/lib/utilities/worker.d.cts +11 -11
- package/dist/lib/utilities/worker.d.ts +11 -11
- package/dist/lib/utilities/write-file.d.cts +12 -12
- package/dist/lib/utilities/write-file.d.ts +12 -12
- package/dist/next.cjs +8 -8
- package/dist/next.js +5 -5
- package/dist/nuxt.cjs +9 -9
- package/dist/nuxt.js +6 -6
- package/dist/rolldown.cjs +7 -7
- package/dist/rolldown.d.cts +1 -1
- package/dist/rolldown.d.ts +1 -1
- package/dist/rolldown.js +4 -4
- package/dist/rollup.cjs +7 -7
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +4 -4
- package/dist/rspack.cjs +7 -7
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +4 -4
- package/dist/tsup.cjs +8 -8
- package/dist/tsup.js +5 -5
- package/dist/types/babel.d.cts +1 -1
- package/dist/types/babel.d.ts +1 -1
- package/dist/types/commands.d.cts +1 -1
- package/dist/types/commands.d.ts +1 -1
- package/dist/types/compiler.d.cts +1 -1
- package/dist/types/compiler.d.ts +1 -1
- package/dist/types/config.d.cts +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/context.cjs +2 -2
- package/dist/types/context.d.cts +1 -1
- package/dist/types/context.d.ts +1 -1
- package/dist/types/context.js +1 -1
- package/dist/types/hooks.d.cts +1 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/index.cjs +9 -9
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/internal.d.cts +2 -2
- package/dist/types/internal.d.ts +2 -2
- package/dist/types/plugin.d.cts +1 -1
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/resolved.d.cts +1 -1
- package/dist/types/resolved.d.ts +1 -1
- package/dist/types/unplugin.d.cts +1 -1
- package/dist/types/unplugin.d.ts +1 -1
- package/dist/types/vfs.cjs +7 -7
- package/dist/types/vfs.d.cts +61 -5
- package/dist/types/vfs.d.ts +61 -5
- package/dist/types/vfs.js +1 -1
- package/dist/unloader.cjs +7 -7
- package/dist/unloader.d.cts +1 -1
- package/dist/unloader.d.ts +1 -1
- package/dist/unloader.js +4 -4
- package/dist/unplugin.cjs +18 -18
- package/dist/unplugin.d.cts +2 -2
- package/dist/unplugin.d.ts +2 -2
- package/dist/unplugin.js +15 -15
- package/dist/vite.cjs +7 -7
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +4 -4
- package/dist/webpack.cjs +7 -7
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +4 -4
- package/package.json +9 -7
- package/dist/chunk-IJBH5OUN.cjs +0 -12
- package/dist/chunk-JBTSAOIQ.js +0 -31
- package/dist/chunk-LXMNDUPG.cjs +0 -12
- package/dist/chunk-RQ4CHMPO.cjs +0 -12
- package/dist/chunk-S5QFX2GM.cjs +0 -12
- package/dist/chunk-SL3CXJWD.cjs +0 -34
- package/dist/chunk-YG7U2GIR.cjs +0 -24
- package/dist/chunk-ZFATNDSY.cjs +0 -12
- package/dist/lib/chunk-6U2UX2PX.cjs.map +0 -1
- package/dist/lib/chunk-KFE2IR3Y.js.map +0 -1
- package/dist/lib/chunk-M7U5RMK7.js.map +0 -1
- package/dist/lib/chunk-M7WHFUKR.cjs.map +0 -1
- package/dist/lib/chunk-PIFE7MUZ.js.map +0 -1
- package/dist/lib/chunk-Q2RUDKWY.cjs.map +0 -1
- package/dist/{resolved-CcuVqMqc.d.cts → resolved-3RFshyDy.d.cts} +16 -16
- package/dist/{resolved-Dhscmo3z.d.ts → resolved-BzyBMgQG.d.ts} +16 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRLMEYZ5I_cjs = require('../chunk-RLMEYZ5I.cjs');
|
|
4
4
|
var chunkLJZEN4HP_cjs = require('../chunk-LJZEN4HP.cjs');
|
|
5
5
|
var chunkPK6SKIKE_cjs = require('../chunk-PK6SKIKE.cjs');
|
|
6
6
|
var types = require('@storm-software/config-tools/types');
|
|
@@ -15,6 +15,49 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
15
15
|
|
|
16
16
|
var defu__default = /*#__PURE__*/_interopDefault(defu);
|
|
17
17
|
|
|
18
|
+
function createVirtualSystem(context) {
|
|
19
|
+
return {
|
|
20
|
+
args: [],
|
|
21
|
+
createDirectory: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((path) => {
|
|
22
|
+
context.fs.mkdirSync(path);
|
|
23
|
+
}, "createDirectory"),
|
|
24
|
+
// TODO: could make a real file tree
|
|
25
|
+
directoryExists: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((directoryName) => {
|
|
26
|
+
return context.fs.existsSync(directoryName);
|
|
27
|
+
}, "directoryExists"),
|
|
28
|
+
exit: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => {
|
|
29
|
+
throw new Error("Not implemented: exit");
|
|
30
|
+
}, "exit"),
|
|
31
|
+
fileExists: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((fileName) => context.fs.existsSync(fileName), "fileExists"),
|
|
32
|
+
getCurrentDirectory: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => "/", "getCurrentDirectory"),
|
|
33
|
+
getDirectories: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => [], "getDirectories"),
|
|
34
|
+
getExecutingFilePath: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => {
|
|
35
|
+
throw new Error("Not implemented: getExecutingFilePath");
|
|
36
|
+
}, "getExecutingFilePath"),
|
|
37
|
+
readDirectory: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((directoryName) => {
|
|
38
|
+
return context.fs.readdirSync(directoryName);
|
|
39
|
+
}, "readDirectory"),
|
|
40
|
+
readFile: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((fileName) => {
|
|
41
|
+
if (context.fs.existsSync(fileName)) {
|
|
42
|
+
return context.fs.readFileSync(fileName);
|
|
43
|
+
}
|
|
44
|
+
return void 0;
|
|
45
|
+
}, "readFile"),
|
|
46
|
+
resolvePath: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((path) => context.fs.resolve(path) || path, "resolvePath"),
|
|
47
|
+
newLine: "\n",
|
|
48
|
+
useCaseSensitiveFileNames: true,
|
|
49
|
+
write: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => {
|
|
50
|
+
throw new Error("Not implemented: write");
|
|
51
|
+
}, "write"),
|
|
52
|
+
writeFile: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((fileName, contents) => {
|
|
53
|
+
context.fs.writeFileSync(fileName, contents);
|
|
54
|
+
}, "writeFile"),
|
|
55
|
+
deleteFile: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((fileName) => {
|
|
56
|
+
context.fs.unlinkSync(fileName);
|
|
57
|
+
}, "deleteFile")
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
chunkPK6SKIKE_cjs.__name(createVirtualSystem, "createVirtualSystem");
|
|
18
61
|
function createCompilerHost(context, compilerOptions) {
|
|
19
62
|
const host = typescript.createCompilerHost(compilerOptions);
|
|
20
63
|
return {
|
|
@@ -64,7 +107,7 @@ function createCompilerHost(context, compilerOptions) {
|
|
|
64
107
|
const path = context.fs.resolve(fileName);
|
|
65
108
|
if (path) {
|
|
66
109
|
try {
|
|
67
|
-
return typescript.createSourceFile(path, context.fs.readFileSync(path), languageVersionOrOptions ?? compilerOptions.target ??
|
|
110
|
+
return typescript.createSourceFile(path, context.fs.readFileSync(path), languageVersionOrOptions ?? compilerOptions.target ?? chunkRLMEYZ5I_cjs.getDefaultCompilerOptions().target, false);
|
|
68
111
|
} catch (error) {
|
|
69
112
|
context.log(types.LogLevelLabel.ERROR, `Failed to create source file for '${fileName}': ${error.message}`);
|
|
70
113
|
throw error;
|
|
@@ -118,5 +161,6 @@ chunkPK6SKIKE_cjs.__name(createProgram, "createProgram");
|
|
|
118
161
|
|
|
119
162
|
exports.createCompilerHost = createCompilerHost;
|
|
120
163
|
exports.createProgram = createProgram;
|
|
164
|
+
exports.createVirtualSystem = createVirtualSystem;
|
|
121
165
|
//# sourceMappingURL=compiler-host.cjs.map
|
|
122
166
|
//# sourceMappingURL=compiler-host.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/typescript/compiler-host.ts"],"names":["createCompilerHost","context","compilerOptions","host","createCompilerHostWorker","require","baseDir","moduleName","modulePath","fs","resolve","module","readFileSync","error","undefined","isFunction","sys","Error","getCanonicalFileName","fileName","realpath","fileExists","existsSync","includes","readFile","writeFile","text","writeByteOrderMark","onError","sourceFiles","data","writeFileSync","getSourceFile","languageVersionOrOptions","shouldCreateNewSourceFile","path","createSourceFile","target","getDefaultCompilerOptions","log","LogLevelLabel","ERROR","message","createProgram","fileNames","_options","TRACE","typescriptPath","resolvePackage","files","reduce","ret","formatted","replacePath","workspaceConfig","workspaceRoot","push","joinPaths","resolvedTsconfig","getParsedTypeScriptConfig","config","projectRoot","tsconfig","tsconfigFilePath","defu","strict","noEmit","declaration","declarationMap","emitDeclarationOnly","skipLibCheck","exclude","include","tsconfigRaw","options","configFilePath","pathsBasePath","suppressOutputPathCheck","createProgramWorker"],"mappings":";;;;;;;;;;;;;;;;;AAwEO,SAASA,kBAAAA,CACdC,SACAC,eAAAA,EAAgC;AAEhC,EAAA,MAAMC,IAAAA,GAAOC,8BAAyBF,eAAAA,CAAAA;AAEtC,EAAA,OAAO;IACL,GAAGC,IAAAA;AACHE,IAAAA,OAAAA,CAAQC,SAAiBC,UAAAA,EAAkB;AACzC,MAAA,MAAMC,UAAAA,GAAaP,OAAAA,CAAQQ,EAAAA,CAAGC,OAAAA,CAAQH,UAAA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,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"compiler-host.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport defu from \"defu\";\nimport {\n CompilerHost,\n CompilerOptions,\n createCompilerHost as createCompilerHostWorker,\n createProgram as createProgramWorker,\n createSourceFile,\n CreateSourceFileOptions,\n Program,\n ScriptTarget,\n SourceFile,\n sys,\n System,\n WriteFileCallbackData\n} from \"typescript\";\nimport { Context } from \"../../types/context\";\nimport { getDefaultCompilerOptions } from \"./program\";\nimport { getParsedTypeScriptConfig } from \"./tsconfig\";\n\nexport type ModuleImportResult =\n | { module: unknown; error: undefined }\n | { module: undefined; error: { stack?: string; message?: string } };\n\nexport interface TypeScriptSystem extends System {\n require: (baseDir: string, moduleName: string) => ModuleImportResult;\n}\n\n// function getDefaultCompilerOptions(): CompilerOptions {\n// return {\n// ...tsGetDefaultCompilerOptions(),\n// jsx: JsxEmit.React,\n// strict: true,\n// esModuleInterop: true,\n// module: ModuleKind.ESNext,\n// suppressOutputPathCheck: true,\n// skipLibCheck: true,\n// skipDefaultLibCheck: true,\n// moduleResolution: ModuleResolutionKind.Node10\n// };\n// }\n\n/**\n * Creates a TypeScript compiler host that uses the virtual file system (VFS) from the provided context to resolve paths.\n *\n * @param context - The context containing the virtual file system.\n * @param compilerOptions - The TypeScript compiler options.\n * @returns A TypeScript compiler host with VFS path resolution.\n */\nexport function createCompilerHost(\n context: Context,\n compilerOptions: CompilerOptions\n): CompilerHost {\n const host = createCompilerHostWorker(compilerOptions);\n\n return {\n ...host,\n require(baseDir: string, moduleName: string) {\n const modulePath = context.fs.resolve(moduleName);\n if (modulePath) {\n return {\n module: context.fs.readFileSync(modulePath),\n modulePath,\n error: undefined\n };\n }\n\n if (isFunction((sys as TypeScriptSystem)?.require)) {\n return (sys as TypeScriptSystem).require(baseDir, moduleName);\n }\n\n return {\n module: {},\n error: new Error(\n `Failed to resolve module '${moduleName}' from '${\n baseDir\n }' during TypeScript compilation. This is likely due to a missing dependency or an incorrect module path.`\n )\n };\n },\n getCanonicalFileName(fileName: string): string {\n return (\n context.fs.resolve(fileName) || host.getCanonicalFileName(fileName)\n );\n },\n realpath(fileName: string) {\n return context.fs.resolve(fileName) || host.realpath?.(fileName);\n },\n fileExists(fileName: string): boolean {\n if (context.fs.existsSync(fileName)) {\n return true;\n }\n\n if (fileName.includes(\"tsconfig.json\")) {\n return false;\n }\n\n return host.fileExists(fileName);\n },\n readFile(fileName: string): string | undefined {\n if (context.fs.existsSync(fileName)) {\n return context.fs.readFileSync(fileName);\n }\n\n return host.readFile(fileName);\n },\n writeFile(\n fileName: string,\n text: string,\n writeByteOrderMark: boolean,\n onError?: ((message: string) => void) | undefined,\n sourceFiles?: readonly SourceFile[] | undefined,\n data?: WriteFileCallbackData\n ): void {\n context.fs.existsSync(fileName)\n ? context.fs.writeFileSync(fileName, text)\n : host.writeFile(\n fileName,\n text,\n writeByteOrderMark,\n onError,\n sourceFiles,\n data\n );\n },\n getSourceFile(\n fileName: string,\n languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions,\n onError?: (message: string) => void,\n shouldCreateNewSourceFile?: boolean\n ): SourceFile | undefined {\n const path = context.fs.resolve(fileName);\n if (path) {\n try {\n return createSourceFile(\n path,\n context.fs.readFileSync(path)!,\n languageVersionOrOptions ??\n compilerOptions.target ??\n getDefaultCompilerOptions().target!,\n false\n );\n } catch (error: unknown) {\n context.log(\n LogLevelLabel.ERROR,\n `Failed to create source file for '${fileName}': ${\n (error as Error).message\n }`\n );\n throw error;\n }\n }\n\n return host.getSourceFile(\n fileName,\n languageVersionOrOptions,\n onError,\n shouldCreateNewSourceFile\n );\n }\n } as CompilerHost;\n}\n\nexport async function createProgram(\n context: Context,\n fileNames: string[],\n _options: Partial<CompilerOptions> = {}\n): Promise<Program> {\n context.log(LogLevelLabel.TRACE, \"Adding TypeScript library files.\");\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n const files = fileNames.reduce<string[]>(\n (ret, fileName) => {\n const formatted = replacePath(\n fileName,\n context.workspaceConfig.workspaceRoot\n );\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n },\n [joinPaths(typescriptPath, \"lib\", \"lib.esnext.full.d.ts\")]\n );\n\n context.log(\n LogLevelLabel.TRACE,\n \"Parsing TypeScript configuration for the Powerlines project.\"\n );\n\n const resolvedTsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.tsconfig.tsconfigFilePath,\n defu(\n {\n compilerOptions: {\n strict: false,\n noEmit: false,\n declaration: true,\n declarationMap: false,\n emitDeclarationOnly: true,\n skipLibCheck: true\n },\n exclude: [\"node_modules\", \"dist\"],\n include: fileNames\n },\n context.config.tsconfigRaw ?? {}\n ) as TsConfigJson\n );\n resolvedTsconfig.options.configFilePath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.tsconfig.tsconfigFilePath\n );\n resolvedTsconfig.options.pathsBasePath =\n context.workspaceConfig.workspaceRoot;\n resolvedTsconfig.options.suppressOutputPathCheck = true;\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler host\");\n\n // const host = createCompilerHostWorker(resolvedTsconfig.options);\n const host = createCompilerHost(context, resolvedTsconfig.options);\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler program\");\n\n return createProgramWorker(files, resolvedTsconfig.options, host);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/typescript/compiler-host.ts"],"names":["createVirtualSystem","context","args","createDirectory","path","fs","mkdirSync","directoryExists","directoryName","existsSync","exit","__name","Error","fileExists","fileName","getCurrentDirectory","getDirectories","getExecutingFilePath","readDirectory","readdirSync","readFile","readFileSync","undefined","resolvePath","resolve","newLine","useCaseSensitiveFileNames","write","writeFile","contents","writeFileSync","deleteFile","unlinkSync","createCompilerHost","compilerOptions","host","createCompilerHostWorker","require","baseDir","moduleName","modulePath","module","error","isFunction","sys","getCanonicalFileName","realpath","includes","text","writeByteOrderMark","onError","sourceFiles","data","getSourceFile","languageVersionOrOptions","shouldCreateNewSourceFile","createSourceFile","target","getDefaultCompilerOptions","log","LogLevelLabel","ERROR","message","createProgram","fileNames","_options","TRACE","typescriptPath","resolvePackage","files","reduce","ret","formatted","replacePath","workspaceConfig","workspaceRoot","push","joinPaths","resolvedTsconfig","getParsedTypeScriptConfig","config","projectRoot","tsconfig","tsconfigFilePath","defu","strict","noEmit","declaration","declarationMap","emitDeclarationOnly","skipLibCheck","exclude","include","tsconfigRaw","options","configFilePath","pathsBasePath","suppressOutputPathCheck","createProgramWorker"],"mappings":";;;;;;;;;;;;;;;;;AAqEO,SAASA,oBAAoBC,OAAAA,EAAgB;AAClD,EAAA,OAAO;AACLC,IAAAA,IAAAA,EAAM,EAAA;AACNC,IAAAA,eAAAA,4CAAiBC,IAAAA,KAAAA;AACfH,MAAAA,OAAAA,CAAQI,EAAAA,CAAGC,UAAUF,IAAAA,CAAAA;IACvB,CAAA,EAFiBA,iBAAAA,CAAAA;;AAIjBG,IAAAA,eAAAA,4CAAkBC,aAAAA,KAAAA;AA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GAAA,EACA/D,OAAAA,CAAQ+E,MAAAA,CAAOa,WAAAA,IAAe,EAAC,CAAA,CAAA;AAGnCf,EAAAA,gBAAAA,CAAiBgB,OAAAA,CAAQC,iBAAiBlB,mBAAAA,CACxC5E,OAAAA,CAAQyE,gBAAgBC,aAAAA,EACxB1E,OAAAA,CAAQiF,SAASC,gBAAgB,CAAA;AAEnCL,EAAAA,gBAAAA,CAAiBgB,OAAAA,CAAQE,aAAAA,GACvB/F,OAAAA,CAAQyE,eAAAA,CAAgBC,aAAAA;AAC1BG,EAAAA,gBAAAA,CAAiBgB,QAAQG,uBAAAA,GAA0B,IAAA;AAEnDhG,EAAAA,OAAAA,CAAQ0D,GAAAA,CAAIC,mBAAAA,CAAcM,KAAAA,EAAO,uCAAA,CAAA;AAGjC,EAAA,MAAM/B,IAAAA,GAAOF,kBAAAA,CAAmBhC,OAAAA,EAAS6E,gBAAAA,CAAiBgB,OAAO,CAAA;AAEjE7F,EAAAA,OAAAA,CAAQ0D,GAAAA,CAAIC,mBAAAA,CAAcM,KAAAA,EAAO,0CAAA,CAAA;AAEjC,EAAA,OAAOgC,wBAAAA,CAAoB7B,KAAAA,EAAOS,gBAAAA,CAAiBgB,OAAAA,EAAS3D,IAAAA,CAAAA;AAC9D;AAtEsB4B,wBAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"compiler-host.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport defu from \"defu\";\nimport {\n CompilerHost,\n CompilerOptions,\n createCompilerHost as createCompilerHostWorker,\n createProgram as createProgramWorker,\n createSourceFile,\n CreateSourceFileOptions,\n Program,\n ScriptTarget,\n SourceFile,\n sys,\n System,\n WriteFileCallbackData\n} from \"typescript\";\nimport { Context } from \"../../types/context\";\nimport { getDefaultCompilerOptions } from \"./program\";\nimport { getParsedTypeScriptConfig } from \"./tsconfig\";\n\nexport type ModuleImportResult =\n | { module: unknown; error: undefined }\n | { module: undefined; error: { stack?: string; message?: string } };\n\nexport interface TypeScriptSystem extends System {\n require: (baseDir: string, moduleName: string) => ModuleImportResult;\n}\n\n// function getDefaultCompilerOptions(): CompilerOptions {\n// return {\n// ...tsGetDefaultCompilerOptions(),\n// jsx: JsxEmit.React,\n// strict: true,\n// esModuleInterop: true,\n// module: ModuleKind.ESNext,\n// suppressOutputPathCheck: true,\n// skipLibCheck: true,\n// skipDefaultLibCheck: true,\n// moduleResolution: ModuleResolutionKind.Node10\n// };\n// }\n\n/**\n * Creates an in-memory System object which can be used in a TypeScript program, this\n * is what provides read/write aspects of the virtual fs\n */\nexport function createVirtualSystem(context: Context): System {\n return {\n args: [],\n createDirectory: path => {\n context.fs.mkdirSync(path);\n },\n // TODO: could make a real file tree\n directoryExists: (directoryName: string): boolean => {\n return context.fs.existsSync(directoryName);\n },\n exit: () => {\n throw new Error(\"Not implemented: exit\");\n },\n fileExists: fileName => context.fs.existsSync(fileName),\n getCurrentDirectory: () => \"/\",\n getDirectories: () => [],\n getExecutingFilePath: () => {\n throw new Error(\"Not implemented: getExecutingFilePath\");\n },\n readDirectory: (directoryName: string): string[] => {\n return context.fs.readdirSync(directoryName);\n },\n readFile: (fileName: string): string | undefined => {\n if (context.fs.existsSync(fileName)) {\n return context.fs.readFileSync(fileName);\n }\n\n return undefined;\n },\n resolvePath: path => context.fs.resolve(path) || path,\n newLine: \"\\n\",\n useCaseSensitiveFileNames: true,\n write: () => {\n throw new Error(\"Not implemented: write\");\n },\n writeFile: (fileName, contents) => {\n context.fs.writeFileSync(fileName, contents);\n },\n deleteFile: fileName => {\n context.fs.unlinkSync(fileName);\n }\n };\n}\n\n/**\n * Creates a TypeScript compiler host that uses the virtual file system (VFS) from the provided context to resolve paths.\n *\n * @param context - The context containing the virtual file system.\n * @param compilerOptions - The TypeScript compiler options.\n * @returns A TypeScript compiler host with VFS path resolution.\n */\nexport function createCompilerHost(\n context: Context,\n compilerOptions: CompilerOptions\n): CompilerHost {\n const host = createCompilerHostWorker(compilerOptions);\n\n return {\n ...host,\n require(baseDir: string, moduleName: string) {\n const modulePath = context.fs.resolve(moduleName);\n if (modulePath) {\n return {\n module: context.fs.readFileSync(modulePath),\n modulePath,\n error: undefined\n };\n }\n\n if (isFunction((sys as TypeScriptSystem)?.require)) {\n return (sys as TypeScriptSystem).require(baseDir, moduleName);\n }\n\n return {\n module: {},\n error: new Error(\n `Failed to resolve module '${moduleName}' from '${\n baseDir\n }' during TypeScript compilation. This is likely due to a missing dependency or an incorrect module path.`\n )\n };\n },\n getCanonicalFileName(fileName: string): string {\n return (\n context.fs.resolve(fileName) || host.getCanonicalFileName(fileName)\n );\n },\n realpath(fileName: string) {\n return context.fs.resolve(fileName) || host.realpath?.(fileName);\n },\n fileExists(fileName: string): boolean {\n if (context.fs.existsSync(fileName)) {\n return true;\n }\n\n if (fileName.includes(\"tsconfig.json\")) {\n return false;\n }\n\n return host.fileExists(fileName);\n },\n readFile(fileName: string): string | undefined {\n if (context.fs.existsSync(fileName)) {\n return context.fs.readFileSync(fileName);\n }\n\n return host.readFile(fileName);\n },\n writeFile(\n fileName: string,\n text: string,\n writeByteOrderMark: boolean,\n onError?: ((message: string) => void) | undefined,\n sourceFiles?: readonly SourceFile[] | undefined,\n data?: WriteFileCallbackData\n ): void {\n context.fs.existsSync(fileName)\n ? context.fs.writeFileSync(fileName, text)\n : host.writeFile(\n fileName,\n text,\n writeByteOrderMark,\n onError,\n sourceFiles,\n data\n );\n },\n getSourceFile(\n fileName: string,\n languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions,\n onError?: (message: string) => void,\n shouldCreateNewSourceFile?: boolean\n ): SourceFile | undefined {\n const path = context.fs.resolve(fileName);\n if (path) {\n try {\n return createSourceFile(\n path,\n context.fs.readFileSync(path)!,\n languageVersionOrOptions ??\n compilerOptions.target ??\n getDefaultCompilerOptions().target!,\n false\n );\n } catch (error: unknown) {\n context.log(\n LogLevelLabel.ERROR,\n `Failed to create source file for '${fileName}': ${\n (error as Error).message\n }`\n );\n throw error;\n }\n }\n\n return host.getSourceFile(\n fileName,\n languageVersionOrOptions,\n onError,\n shouldCreateNewSourceFile\n );\n }\n } as CompilerHost;\n}\n\nexport async function createProgram(\n context: Context,\n fileNames: string[],\n _options: Partial<CompilerOptions> = {}\n): Promise<Program> {\n context.log(LogLevelLabel.TRACE, \"Adding TypeScript library files.\");\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n const files = fileNames.reduce<string[]>(\n (ret, fileName) => {\n const formatted = replacePath(\n fileName,\n context.workspaceConfig.workspaceRoot\n );\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n },\n [joinPaths(typescriptPath, \"lib\", \"lib.esnext.full.d.ts\")]\n );\n\n context.log(\n LogLevelLabel.TRACE,\n \"Parsing TypeScript configuration for the Powerlines project.\"\n );\n\n const resolvedTsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.tsconfig.tsconfigFilePath,\n defu(\n {\n compilerOptions: {\n strict: false,\n noEmit: false,\n declaration: true,\n declarationMap: false,\n emitDeclarationOnly: true,\n skipLibCheck: true\n },\n exclude: [\"node_modules\", \"dist\"],\n include: fileNames\n },\n context.config.tsconfigRaw ?? {}\n ) as TsConfigJson\n );\n resolvedTsconfig.options.configFilePath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.tsconfig.tsconfigFilePath\n );\n resolvedTsconfig.options.pathsBasePath =\n context.workspaceConfig.workspaceRoot;\n resolvedTsconfig.options.suppressOutputPathCheck = true;\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler host\");\n\n // const host = createCompilerHostWorker(resolvedTsconfig.options);\n const host = createCompilerHost(context, resolvedTsconfig.options);\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler program\");\n\n return createProgramWorker(files, resolvedTsconfig.options, host);\n}\n"]}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { System, CompilerOptions, CompilerHost, Program } from 'typescript';
|
|
2
|
-
import { C as Context } from '../
|
|
3
|
-
import '@
|
|
2
|
+
import { C as Context } from '../context-B481RQbf.cjs';
|
|
3
|
+
import '@stryke/env/get-env-paths';
|
|
4
|
+
import '@stryke/types/package-json';
|
|
5
|
+
import 'jest-worker';
|
|
6
|
+
import 'jiti';
|
|
7
|
+
import 'oxc-parser';
|
|
8
|
+
import 'semver';
|
|
9
|
+
import 'unplugin';
|
|
4
10
|
import '@storm-software/config-tools/types';
|
|
5
|
-
import '@storm-software/config/types';
|
|
6
11
|
import '@stryke/types/base';
|
|
7
12
|
import '@stryke/types/configuration';
|
|
8
13
|
import '@stryke/types/file';
|
|
9
|
-
import 'c12';
|
|
10
14
|
import 'vite';
|
|
11
15
|
import '@farmfe/core';
|
|
12
16
|
import '@rspack/core';
|
|
@@ -16,16 +20,12 @@ import 'esbuild';
|
|
|
16
20
|
import 'rolldown';
|
|
17
21
|
import 'rollup';
|
|
18
22
|
import 'webpack';
|
|
19
|
-
import '@
|
|
20
|
-
import '@
|
|
21
|
-
import '
|
|
22
|
-
import 'jiti';
|
|
23
|
-
import 'oxc-parser';
|
|
24
|
-
import 'semver';
|
|
25
|
-
import 'unplugin';
|
|
26
|
-
import '@stryke/types/array';
|
|
23
|
+
import '@storm-software/build-tools/types';
|
|
24
|
+
import '@storm-software/config/types';
|
|
25
|
+
import 'c12';
|
|
27
26
|
import '../tsconfig-Bz-CiFqD.cjs';
|
|
28
27
|
import '@stryke/types/tsconfig';
|
|
28
|
+
import '@stryke/types/array';
|
|
29
29
|
import '@stryke/json/types';
|
|
30
30
|
import 'memfs';
|
|
31
31
|
import 'node:fs';
|
|
@@ -44,6 +44,11 @@ type ModuleImportResult = {
|
|
|
44
44
|
interface TypeScriptSystem extends System {
|
|
45
45
|
require: (baseDir: string, moduleName: string) => ModuleImportResult;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Creates an in-memory System object which can be used in a TypeScript program, this
|
|
49
|
+
* is what provides read/write aspects of the virtual fs
|
|
50
|
+
*/
|
|
51
|
+
declare function createVirtualSystem(context: Context): System;
|
|
47
52
|
/**
|
|
48
53
|
* Creates a TypeScript compiler host that uses the virtual file system (VFS) from the provided context to resolve paths.
|
|
49
54
|
*
|
|
@@ -56,4 +61,4 @@ declare function createProgram(context: Context, fileNames: string[], _options?:
|
|
|
56
61
|
declare type __ΩModuleImportResult = any[];
|
|
57
62
|
declare type __ΩTypeScriptSystem = any[];
|
|
58
63
|
|
|
59
|
-
export { type ModuleImportResult, type TypeScriptSystem, type __ΩModuleImportResult, type __ΩTypeScriptSystem, createCompilerHost, createProgram };
|
|
64
|
+
export { type ModuleImportResult, type TypeScriptSystem, type __ΩModuleImportResult, type __ΩTypeScriptSystem, createCompilerHost, createProgram, createVirtualSystem };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { System, CompilerOptions, CompilerHost, Program } from 'typescript';
|
|
2
|
-
import { C as Context } from '../
|
|
3
|
-
import '@
|
|
2
|
+
import { C as Context } from '../context-efHKG-wc.js';
|
|
3
|
+
import '@stryke/env/get-env-paths';
|
|
4
|
+
import '@stryke/types/package-json';
|
|
5
|
+
import 'jest-worker';
|
|
6
|
+
import 'jiti';
|
|
7
|
+
import 'oxc-parser';
|
|
8
|
+
import 'semver';
|
|
9
|
+
import 'unplugin';
|
|
4
10
|
import '@storm-software/config-tools/types';
|
|
5
|
-
import '@storm-software/config/types';
|
|
6
11
|
import '@stryke/types/base';
|
|
7
12
|
import '@stryke/types/configuration';
|
|
8
13
|
import '@stryke/types/file';
|
|
9
|
-
import 'c12';
|
|
10
14
|
import 'vite';
|
|
11
15
|
import '@farmfe/core';
|
|
12
16
|
import '@rspack/core';
|
|
@@ -16,16 +20,12 @@ import 'esbuild';
|
|
|
16
20
|
import 'rolldown';
|
|
17
21
|
import 'rollup';
|
|
18
22
|
import 'webpack';
|
|
19
|
-
import '@
|
|
20
|
-
import '@
|
|
21
|
-
import '
|
|
22
|
-
import 'jiti';
|
|
23
|
-
import 'oxc-parser';
|
|
24
|
-
import 'semver';
|
|
25
|
-
import 'unplugin';
|
|
26
|
-
import '@stryke/types/array';
|
|
23
|
+
import '@storm-software/build-tools/types';
|
|
24
|
+
import '@storm-software/config/types';
|
|
25
|
+
import 'c12';
|
|
27
26
|
import '../tsconfig-Bz-CiFqD.js';
|
|
28
27
|
import '@stryke/types/tsconfig';
|
|
28
|
+
import '@stryke/types/array';
|
|
29
29
|
import '@stryke/json/types';
|
|
30
30
|
import 'memfs';
|
|
31
31
|
import 'node:fs';
|
|
@@ -44,6 +44,11 @@ type ModuleImportResult = {
|
|
|
44
44
|
interface TypeScriptSystem extends System {
|
|
45
45
|
require: (baseDir: string, moduleName: string) => ModuleImportResult;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Creates an in-memory System object which can be used in a TypeScript program, this
|
|
49
|
+
* is what provides read/write aspects of the virtual fs
|
|
50
|
+
*/
|
|
51
|
+
declare function createVirtualSystem(context: Context): System;
|
|
47
52
|
/**
|
|
48
53
|
* Creates a TypeScript compiler host that uses the virtual file system (VFS) from the provided context to resolve paths.
|
|
49
54
|
*
|
|
@@ -56,4 +61,4 @@ declare function createProgram(context: Context, fileNames: string[], _options?:
|
|
|
56
61
|
declare type __ΩModuleImportResult = any[];
|
|
57
62
|
declare type __ΩTypeScriptSystem = any[];
|
|
58
63
|
|
|
59
|
-
export { type ModuleImportResult, type TypeScriptSystem, type __ΩModuleImportResult, type __ΩTypeScriptSystem, createCompilerHost, createProgram };
|
|
64
|
+
export { type ModuleImportResult, type TypeScriptSystem, type __ΩModuleImportResult, type __ΩTypeScriptSystem, createCompilerHost, createProgram, createVirtualSystem };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDefaultCompilerOptions } from '../chunk-
|
|
1
|
+
import { getDefaultCompilerOptions } from '../chunk-V2T4H24I.js';
|
|
2
2
|
import { getParsedTypeScriptConfig } from '../chunk-OO4BIM7N.js';
|
|
3
3
|
import { __name } from '../chunk-7QVYU63E.js';
|
|
4
4
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
@@ -9,6 +9,49 @@ import { isFunction } from '@stryke/type-checks/is-function';
|
|
|
9
9
|
import defu from 'defu';
|
|
10
10
|
import { createCompilerHost as createCompilerHost$1, createSourceFile, sys, createProgram as createProgram$1 } from 'typescript';
|
|
11
11
|
|
|
12
|
+
function createVirtualSystem(context) {
|
|
13
|
+
return {
|
|
14
|
+
args: [],
|
|
15
|
+
createDirectory: /* @__PURE__ */ __name((path) => {
|
|
16
|
+
context.fs.mkdirSync(path);
|
|
17
|
+
}, "createDirectory"),
|
|
18
|
+
// TODO: could make a real file tree
|
|
19
|
+
directoryExists: /* @__PURE__ */ __name((directoryName) => {
|
|
20
|
+
return context.fs.existsSync(directoryName);
|
|
21
|
+
}, "directoryExists"),
|
|
22
|
+
exit: /* @__PURE__ */ __name(() => {
|
|
23
|
+
throw new Error("Not implemented: exit");
|
|
24
|
+
}, "exit"),
|
|
25
|
+
fileExists: /* @__PURE__ */ __name((fileName) => context.fs.existsSync(fileName), "fileExists"),
|
|
26
|
+
getCurrentDirectory: /* @__PURE__ */ __name(() => "/", "getCurrentDirectory"),
|
|
27
|
+
getDirectories: /* @__PURE__ */ __name(() => [], "getDirectories"),
|
|
28
|
+
getExecutingFilePath: /* @__PURE__ */ __name(() => {
|
|
29
|
+
throw new Error("Not implemented: getExecutingFilePath");
|
|
30
|
+
}, "getExecutingFilePath"),
|
|
31
|
+
readDirectory: /* @__PURE__ */ __name((directoryName) => {
|
|
32
|
+
return context.fs.readdirSync(directoryName);
|
|
33
|
+
}, "readDirectory"),
|
|
34
|
+
readFile: /* @__PURE__ */ __name((fileName) => {
|
|
35
|
+
if (context.fs.existsSync(fileName)) {
|
|
36
|
+
return context.fs.readFileSync(fileName);
|
|
37
|
+
}
|
|
38
|
+
return void 0;
|
|
39
|
+
}, "readFile"),
|
|
40
|
+
resolvePath: /* @__PURE__ */ __name((path) => context.fs.resolve(path) || path, "resolvePath"),
|
|
41
|
+
newLine: "\n",
|
|
42
|
+
useCaseSensitiveFileNames: true,
|
|
43
|
+
write: /* @__PURE__ */ __name(() => {
|
|
44
|
+
throw new Error("Not implemented: write");
|
|
45
|
+
}, "write"),
|
|
46
|
+
writeFile: /* @__PURE__ */ __name((fileName, contents) => {
|
|
47
|
+
context.fs.writeFileSync(fileName, contents);
|
|
48
|
+
}, "writeFile"),
|
|
49
|
+
deleteFile: /* @__PURE__ */ __name((fileName) => {
|
|
50
|
+
context.fs.unlinkSync(fileName);
|
|
51
|
+
}, "deleteFile")
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
__name(createVirtualSystem, "createVirtualSystem");
|
|
12
55
|
function createCompilerHost(context, compilerOptions) {
|
|
13
56
|
const host = createCompilerHost$1(compilerOptions);
|
|
14
57
|
return {
|
|
@@ -110,6 +153,6 @@ async function createProgram(context, fileNames, _options = {}) {
|
|
|
110
153
|
}
|
|
111
154
|
__name(createProgram, "createProgram");
|
|
112
155
|
|
|
113
|
-
export { createCompilerHost, createProgram };
|
|
156
|
+
export { createCompilerHost, createProgram, createVirtualSystem };
|
|
114
157
|
//# sourceMappingURL=compiler-host.js.map
|
|
115
158
|
//# sourceMappingURL=compiler-host.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/typescript/compiler-host.ts"],"names":["createCompilerHost","context","compilerOptions","host","createCompilerHostWorker","require","baseDir","moduleName","modulePath","fs","resolve","module","readFileSync","error","undefined","isFunction","sys","Error","getCanonicalFileName","fileName","realpath","fileExists","existsSync","includes","readFile","writeFile","text","writeByteOrderMark","onError","sourceFiles","data","writeFileSync","getSourceFile","languageVersionOrOptions","shouldCreateNewSourceFile","path","createSourceFile","target","getDefaultCompilerOptions","log","LogLevelLabel","ERROR","message","createProgram","fileNames","_options","TRACE","typescriptPath","resolvePackage","files","reduce","ret","formatted","replacePath","workspaceConfig","workspaceRoot","push","joinPaths","resolvedTsconfig","getParsedTypeScriptConfig","config","projectRoot","tsconfig","tsconfigFilePath","defu","strict","noEmit","declaration","declarationMap","emitDeclarationOnly","skipLibCheck","exclude","include","tsconfigRaw","options","configFilePath","pathsBasePath","suppressOutputPathCheck","createProgramWorker"],"mappings":";;;;;;;;;;;AAwEO,SAASA,kBAAAA,CACdC,SACAC,eAAAA,EAAgC;AAEhC,EAAA,MAAMC,IAAAA,GAAOC,qBAAyBF,eAAAA,CAAAA;AAEtC,EAAA,OAAO;IACL,GAAGC,IAAAA;AACHE,IAAAA,OAAAA,CAAQC,SAAiBC,UAAAA,EAAkB;AACzC,MAAA,MAAMC,UAAAA,GAAaP,OAAAA,CAAQQ,EAAAA,CAAGC,OAAAA,CAAQH,UAAAA,CAAAA;AACtC,MAAA,IAAIC,UAAAA,EAAY;AACd,QAAA,OAAO;UACLG,MAAAA,EAAQV,OAAAA,CAAQQ,EAAAA,CAAGG,YAAAA,CAAaJ,UAAAA,CAAAA;AAChCA,UAAAA,UAAAA;UACAK,KAAAA,EAAOC;AACT,SAAA;AACF,MAAA;AAEA,MAAA,IAAIC,UAAAA,CAAYC,GAAAA,EAA0B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IAAA;MACbC,cAAAA,EAAgB,KAAA;MAChBC,mBAAAA,EAAqB,IAAA;MACrBC,YAAAA,EAAc;AAChB,KAAA;IACAC,OAAAA,EAAS;AAAC,MAAA,cAAA;AAAgB,MAAA;;IAC1BC,OAAAA,EAAS5B;AACX,GAAA,EACA3C,OAAAA,CAAQ2D,MAAAA,CAAOa,WAAAA,IAAe,EAAC,CAAA,CAAA;AAGnCf,EAAAA,gBAAAA,CAAiBgB,OAAAA,CAAQC,iBAAiBlB,SAAAA,CACxCxD,OAAAA,CAAQqD,gBAAgBC,aAAAA,EACxBtD,OAAAA,CAAQ6D,SAASC,gBAAgB,CAAA;AAEnCL,EAAAA,gBAAAA,CAAiBgB,OAAAA,CAAQE,aAAAA,GACvB3E,OAAAA,CAAQqD,eAAAA,CAAgBC,aAAAA;AAC1BG,EAAAA,gBAAAA,CAAiBgB,QAAQG,uBAAAA,GAA0B,IAAA;AAEnD5E,EAAAA,OAAAA,CAAQsC,GAAAA,CAAIC,aAAAA,CAAcM,KAAAA,EAAO,uCAAA,CAAA;AAGjC,EAAA,MAAM3C,IAAAA,GAAOH,kBAAAA,CAAmBC,OAAAA,EAASyD,gBAAAA,CAAiBgB,OAAO,CAAA;AAEjEzE,EAAAA,OAAAA,CAAQsC,GAAAA,CAAIC,aAAAA,CAAcM,KAAAA,EAAO,0CAAA,CAAA;AAEjC,EAAA,OAAOgC,eAAAA,CAAoB7B,KAAAA,EAAOS,gBAAAA,CAAiBgB,OAAAA,EAASvE,IAAAA,CAAAA;AAC9D;AAtEsBwC,MAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"compiler-host.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport defu from \"defu\";\nimport {\n CompilerHost,\n CompilerOptions,\n createCompilerHost as createCompilerHostWorker,\n createProgram as createProgramWorker,\n createSourceFile,\n CreateSourceFileOptions,\n Program,\n ScriptTarget,\n SourceFile,\n sys,\n System,\n WriteFileCallbackData\n} from \"typescript\";\nimport { Context } from \"../../types/context\";\nimport { getDefaultCompilerOptions } from \"./program\";\nimport { getParsedTypeScriptConfig } from \"./tsconfig\";\n\nexport type ModuleImportResult =\n | { module: unknown; error: undefined }\n | { module: undefined; error: { stack?: string; message?: string } };\n\nexport interface TypeScriptSystem extends System {\n require: (baseDir: string, moduleName: string) => ModuleImportResult;\n}\n\n// function getDefaultCompilerOptions(): CompilerOptions {\n// return {\n// ...tsGetDefaultCompilerOptions(),\n// jsx: JsxEmit.React,\n// strict: true,\n// esModuleInterop: true,\n// module: ModuleKind.ESNext,\n// suppressOutputPathCheck: true,\n// skipLibCheck: true,\n// skipDefaultLibCheck: true,\n// moduleResolution: ModuleResolutionKind.Node10\n// };\n// }\n\n/**\n * Creates a TypeScript compiler host that uses the virtual file system (VFS) from the provided context to resolve paths.\n *\n * @param context - The context containing the virtual file system.\n * @param compilerOptions - The TypeScript compiler options.\n * @returns A TypeScript compiler host with VFS path resolution.\n */\nexport function createCompilerHost(\n context: Context,\n compilerOptions: CompilerOptions\n): CompilerHost {\n const host = createCompilerHostWorker(compilerOptions);\n\n return {\n ...host,\n require(baseDir: string, moduleName: string) {\n const modulePath = context.fs.resolve(moduleName);\n if (modulePath) {\n return {\n module: context.fs.readFileSync(modulePath),\n modulePath,\n error: undefined\n };\n }\n\n if (isFunction((sys as TypeScriptSystem)?.require)) {\n return (sys as TypeScriptSystem).require(baseDir, moduleName);\n }\n\n return {\n module: {},\n error: new Error(\n `Failed to resolve module '${moduleName}' from '${\n baseDir\n }' during TypeScript compilation. This is likely due to a missing dependency or an incorrect module path.`\n )\n };\n },\n getCanonicalFileName(fileName: string): string {\n return (\n context.fs.resolve(fileName) || host.getCanonicalFileName(fileName)\n );\n },\n realpath(fileName: string) {\n return context.fs.resolve(fileName) || host.realpath?.(fileName);\n },\n fileExists(fileName: string): boolean {\n if (context.fs.existsSync(fileName)) {\n return true;\n }\n\n if (fileName.includes(\"tsconfig.json\")) {\n return false;\n }\n\n return host.fileExists(fileName);\n },\n readFile(fileName: string): string | undefined {\n if (context.fs.existsSync(fileName)) {\n return context.fs.readFileSync(fileName);\n }\n\n return host.readFile(fileName);\n },\n writeFile(\n fileName: string,\n text: string,\n writeByteOrderMark: boolean,\n onError?: ((message: string) => void) | undefined,\n sourceFiles?: readonly SourceFile[] | undefined,\n data?: WriteFileCallbackData\n ): void {\n context.fs.existsSync(fileName)\n ? context.fs.writeFileSync(fileName, text)\n : host.writeFile(\n fileName,\n text,\n writeByteOrderMark,\n onError,\n sourceFiles,\n data\n );\n },\n getSourceFile(\n fileName: string,\n languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions,\n onError?: (message: string) => void,\n shouldCreateNewSourceFile?: boolean\n ): SourceFile | undefined {\n const path = context.fs.resolve(fileName);\n if (path) {\n try {\n return createSourceFile(\n path,\n context.fs.readFileSync(path)!,\n languageVersionOrOptions ??\n compilerOptions.target ??\n getDefaultCompilerOptions().target!,\n false\n );\n } catch (error: unknown) {\n context.log(\n LogLevelLabel.ERROR,\n `Failed to create source file for '${fileName}': ${\n (error as Error).message\n }`\n );\n throw error;\n }\n }\n\n return host.getSourceFile(\n fileName,\n languageVersionOrOptions,\n onError,\n shouldCreateNewSourceFile\n );\n }\n } as CompilerHost;\n}\n\nexport async function createProgram(\n context: Context,\n fileNames: string[],\n _options: Partial<CompilerOptions> = {}\n): Promise<Program> {\n context.log(LogLevelLabel.TRACE, \"Adding TypeScript library files.\");\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n const files = fileNames.reduce<string[]>(\n (ret, fileName) => {\n const formatted = replacePath(\n fileName,\n context.workspaceConfig.workspaceRoot\n );\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n },\n [joinPaths(typescriptPath, \"lib\", \"lib.esnext.full.d.ts\")]\n );\n\n context.log(\n LogLevelLabel.TRACE,\n \"Parsing TypeScript configuration for the Powerlines project.\"\n );\n\n const resolvedTsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.tsconfig.tsconfigFilePath,\n defu(\n {\n compilerOptions: {\n strict: false,\n noEmit: false,\n declaration: true,\n declarationMap: false,\n emitDeclarationOnly: true,\n skipLibCheck: true\n },\n exclude: [\"node_modules\", \"dist\"],\n include: fileNames\n },\n context.config.tsconfigRaw ?? {}\n ) as TsConfigJson\n );\n resolvedTsconfig.options.configFilePath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.tsconfig.tsconfigFilePath\n );\n resolvedTsconfig.options.pathsBasePath =\n context.workspaceConfig.workspaceRoot;\n resolvedTsconfig.options.suppressOutputPathCheck = true;\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler host\");\n\n // const host = createCompilerHostWorker(resolvedTsconfig.options);\n const host = createCompilerHost(context, resolvedTsconfig.options);\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler program\");\n\n return createProgramWorker(files, resolvedTsconfig.options, host);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/typescript/compiler-host.ts"],"names":["createVirtualSystem","context","args","createDirectory","path","fs","mkdirSync","directoryExists","directoryName","existsSync","exit","Error","fileExists","fileName","getCurrentDirectory","getDirectories","getExecutingFilePath","readDirectory","readdirSync","readFile","readFileSync","undefined","resolvePath","resolve","newLine","useCaseSensitiveFileNames","write","writeFile","contents","writeFileSync","deleteFile","unlinkSync","createCompilerHost","compilerOptions","host","createCompilerHostWorker","require","baseDir","moduleName","modulePath","module","error","isFunction","sys","getCanonicalFileName","realpath","includes","text","writeByteOrderMark","onError","sourceFiles","data","getSourceFile","languageVersionOrOptions","shouldCreateNewSourceFile","createSourceFile","target","getDefaultCompilerOptions","log","LogLevelLabel","ERROR","message","createProgram","fileNames","_options","TRACE","typescriptPath","resolvePackage","files","reduce","ret","formatted","replacePath","workspaceConfig","workspaceRoot","push","joinPaths","resolvedTsconfig","getParsedTypeScriptConfig","config","projectRoot","tsconfig","tsconfigFilePath","defu","strict","noEmit","declaration","declarationMap","emitDeclarationOnly","skipLibCheck","exclude","include","tsconfigRaw","options","configFilePath","pathsBasePath","suppressOutputPathCheck","createProgramWorker"],"mappings":";;;;;;;;;;;AAqEO,SAASA,oBAAoBC,OAAAA,EAAgB;AAClD,EAAA,OAAO;AACLC,IAAAA,IAAAA,EAAM,EAAA;AACNC,IAAAA,eAAAA,0BAAiBC,IAAAA,KAAAA;AACfH,MAAAA,OAAAA,CAAQI,EAAAA,CAAGC,UAAUF,IAAAA,CAAAA;IACvB,CAAA,EAFiBA,iBAAAA,CAAAA;;AAIjBG,IAAAA,eAAAA,0BAAkBC,aAAAA,KAAAA;AAChB,MAAA,OAAOP,OAAAA,CAAQI,EAAAA,CAAGI,UAAAA,CAAWD,aAAAA,CAAAA;IAC/B,CAAA,EAFiB,iBAAA,CAAA;AAGjBE,IAAAA,IAAAA,kBAAM,MAAA,CAAA,MAAA;AACJ,MAAA,MAAM,IAAIC,MAAM,uBAAA,CAAA;IAClB,CAAA,EAFM,MAAA,CAAA;AAGNC,IAAAA,UAAAA,0BAAYC,QAAAA,KAAYZ,OAA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QwE,eAAAA,CAAgBC,aAAAA;AAC1BG,EAAAA,gBAAAA,CAAiBgB,QAAQG,uBAAAA,GAA0B,IAAA;AAEnD/F,EAAAA,OAAAA,CAAQyD,GAAAA,CAAIC,aAAAA,CAAcM,KAAAA,EAAO,uCAAA,CAAA;AAGjC,EAAA,MAAM/B,IAAAA,GAAOF,kBAAAA,CAAmB/B,OAAAA,EAAS4E,gBAAAA,CAAiBgB,OAAO,CAAA;AAEjE5F,EAAAA,OAAAA,CAAQyD,GAAAA,CAAIC,aAAAA,CAAcM,KAAAA,EAAO,0CAAA,CAAA;AAEjC,EAAA,OAAOgC,eAAAA,CAAoB7B,KAAAA,EAAOS,gBAAAA,CAAiBgB,OAAAA,EAAS3D,IAAAA,CAAAA;AAC9D;AAtEsB4B,MAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"compiler-host.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport defu from \"defu\";\nimport {\n CompilerHost,\n CompilerOptions,\n createCompilerHost as createCompilerHostWorker,\n createProgram as createProgramWorker,\n createSourceFile,\n CreateSourceFileOptions,\n Program,\n ScriptTarget,\n SourceFile,\n sys,\n System,\n WriteFileCallbackData\n} from \"typescript\";\nimport { Context } from \"../../types/context\";\nimport { getDefaultCompilerOptions } from \"./program\";\nimport { getParsedTypeScriptConfig } from \"./tsconfig\";\n\nexport type ModuleImportResult =\n | { module: unknown; error: undefined }\n | { module: undefined; error: { stack?: string; message?: string } };\n\nexport interface TypeScriptSystem extends System {\n require: (baseDir: string, moduleName: string) => ModuleImportResult;\n}\n\n// function getDefaultCompilerOptions(): CompilerOptions {\n// return {\n// ...tsGetDefaultCompilerOptions(),\n// jsx: JsxEmit.React,\n// strict: true,\n// esModuleInterop: true,\n// module: ModuleKind.ESNext,\n// suppressOutputPathCheck: true,\n// skipLibCheck: true,\n// skipDefaultLibCheck: true,\n// moduleResolution: ModuleResolutionKind.Node10\n// };\n// }\n\n/**\n * Creates an in-memory System object which can be used in a TypeScript program, this\n * is what provides read/write aspects of the virtual fs\n */\nexport function createVirtualSystem(context: Context): System {\n return {\n args: [],\n createDirectory: path => {\n context.fs.mkdirSync(path);\n },\n // TODO: could make a real file tree\n directoryExists: (directoryName: string): boolean => {\n return context.fs.existsSync(directoryName);\n },\n exit: () => {\n throw new Error(\"Not implemented: exit\");\n },\n fileExists: fileName => context.fs.existsSync(fileName),\n getCurrentDirectory: () => \"/\",\n getDirectories: () => [],\n getExecutingFilePath: () => {\n throw new Error(\"Not implemented: getExecutingFilePath\");\n },\n readDirectory: (directoryName: string): string[] => {\n return context.fs.readdirSync(directoryName);\n },\n readFile: (fileName: string): string | undefined => {\n if (context.fs.existsSync(fileName)) {\n return context.fs.readFileSync(fileName);\n }\n\n return undefined;\n },\n resolvePath: path => context.fs.resolve(path) || path,\n newLine: \"\\n\",\n useCaseSensitiveFileNames: true,\n write: () => {\n throw new Error(\"Not implemented: write\");\n },\n writeFile: (fileName, contents) => {\n context.fs.writeFileSync(fileName, contents);\n },\n deleteFile: fileName => {\n context.fs.unlinkSync(fileName);\n }\n };\n}\n\n/**\n * Creates a TypeScript compiler host that uses the virtual file system (VFS) from the provided context to resolve paths.\n *\n * @param context - The context containing the virtual file system.\n * @param compilerOptions - The TypeScript compiler options.\n * @returns A TypeScript compiler host with VFS path resolution.\n */\nexport function createCompilerHost(\n context: Context,\n compilerOptions: CompilerOptions\n): CompilerHost {\n const host = createCompilerHostWorker(compilerOptions);\n\n return {\n ...host,\n require(baseDir: string, moduleName: string) {\n const modulePath = context.fs.resolve(moduleName);\n if (modulePath) {\n return {\n module: context.fs.readFileSync(modulePath),\n modulePath,\n error: undefined\n };\n }\n\n if (isFunction((sys as TypeScriptSystem)?.require)) {\n return (sys as TypeScriptSystem).require(baseDir, moduleName);\n }\n\n return {\n module: {},\n error: new Error(\n `Failed to resolve module '${moduleName}' from '${\n baseDir\n }' during TypeScript compilation. This is likely due to a missing dependency or an incorrect module path.`\n )\n };\n },\n getCanonicalFileName(fileName: string): string {\n return (\n context.fs.resolve(fileName) || host.getCanonicalFileName(fileName)\n );\n },\n realpath(fileName: string) {\n return context.fs.resolve(fileName) || host.realpath?.(fileName);\n },\n fileExists(fileName: string): boolean {\n if (context.fs.existsSync(fileName)) {\n return true;\n }\n\n if (fileName.includes(\"tsconfig.json\")) {\n return false;\n }\n\n return host.fileExists(fileName);\n },\n readFile(fileName: string): string | undefined {\n if (context.fs.existsSync(fileName)) {\n return context.fs.readFileSync(fileName);\n }\n\n return host.readFile(fileName);\n },\n writeFile(\n fileName: string,\n text: string,\n writeByteOrderMark: boolean,\n onError?: ((message: string) => void) | undefined,\n sourceFiles?: readonly SourceFile[] | undefined,\n data?: WriteFileCallbackData\n ): void {\n context.fs.existsSync(fileName)\n ? context.fs.writeFileSync(fileName, text)\n : host.writeFile(\n fileName,\n text,\n writeByteOrderMark,\n onError,\n sourceFiles,\n data\n );\n },\n getSourceFile(\n fileName: string,\n languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions,\n onError?: (message: string) => void,\n shouldCreateNewSourceFile?: boolean\n ): SourceFile | undefined {\n const path = context.fs.resolve(fileName);\n if (path) {\n try {\n return createSourceFile(\n path,\n context.fs.readFileSync(path)!,\n languageVersionOrOptions ??\n compilerOptions.target ??\n getDefaultCompilerOptions().target!,\n false\n );\n } catch (error: unknown) {\n context.log(\n LogLevelLabel.ERROR,\n `Failed to create source file for '${fileName}': ${\n (error as Error).message\n }`\n );\n throw error;\n }\n }\n\n return host.getSourceFile(\n fileName,\n languageVersionOrOptions,\n onError,\n shouldCreateNewSourceFile\n );\n }\n } as CompilerHost;\n}\n\nexport async function createProgram(\n context: Context,\n fileNames: string[],\n _options: Partial<CompilerOptions> = {}\n): Promise<Program> {\n context.log(LogLevelLabel.TRACE, \"Adding TypeScript library files.\");\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n const files = fileNames.reduce<string[]>(\n (ret, fileName) => {\n const formatted = replacePath(\n fileName,\n context.workspaceConfig.workspaceRoot\n );\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n },\n [joinPaths(typescriptPath, \"lib\", \"lib.esnext.full.d.ts\")]\n );\n\n context.log(\n LogLevelLabel.TRACE,\n \"Parsing TypeScript configuration for the Powerlines project.\"\n );\n\n const resolvedTsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.tsconfig.tsconfigFilePath,\n defu(\n {\n compilerOptions: {\n strict: false,\n noEmit: false,\n declaration: true,\n declarationMap: false,\n emitDeclarationOnly: true,\n skipLibCheck: true\n },\n exclude: [\"node_modules\", \"dist\"],\n include: fileNames\n },\n context.config.tsconfigRaw ?? {}\n ) as TsConfigJson\n );\n resolvedTsconfig.options.configFilePath = joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.tsconfig.tsconfigFilePath\n );\n resolvedTsconfig.options.pathsBasePath =\n context.workspaceConfig.workspaceRoot;\n resolvedTsconfig.options.suppressOutputPathCheck = true;\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler host\");\n\n // const host = createCompilerHostWorker(resolvedTsconfig.options);\n const host = createCompilerHost(context, resolvedTsconfig.options);\n\n context.log(LogLevelLabel.TRACE, \"Creating the TypeScript compiler program\");\n\n return createProgramWorker(files, resolvedTsconfig.options, host);\n}\n"]}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { TransformerFactory, SourceFile } from 'typescript';
|
|
2
|
-
import { C as Context } from '../
|
|
3
|
-
import '@
|
|
2
|
+
import { C as Context } from '../context-B481RQbf.cjs';
|
|
3
|
+
import '@stryke/env/get-env-paths';
|
|
4
|
+
import '@stryke/types/package-json';
|
|
5
|
+
import 'jest-worker';
|
|
6
|
+
import 'jiti';
|
|
7
|
+
import 'oxc-parser';
|
|
8
|
+
import 'semver';
|
|
9
|
+
import 'unplugin';
|
|
4
10
|
import '@storm-software/config-tools/types';
|
|
5
|
-
import '@storm-software/config/types';
|
|
6
11
|
import '@stryke/types/base';
|
|
7
12
|
import '@stryke/types/configuration';
|
|
8
13
|
import '@stryke/types/file';
|
|
9
|
-
import 'c12';
|
|
10
14
|
import 'vite';
|
|
11
15
|
import '@farmfe/core';
|
|
12
16
|
import '@rspack/core';
|
|
@@ -16,16 +20,12 @@ import 'esbuild';
|
|
|
16
20
|
import 'rolldown';
|
|
17
21
|
import 'rollup';
|
|
18
22
|
import 'webpack';
|
|
19
|
-
import '@
|
|
20
|
-
import '@
|
|
21
|
-
import '
|
|
22
|
-
import 'jiti';
|
|
23
|
-
import 'oxc-parser';
|
|
24
|
-
import 'semver';
|
|
25
|
-
import 'unplugin';
|
|
26
|
-
import '@stryke/types/array';
|
|
23
|
+
import '@storm-software/build-tools/types';
|
|
24
|
+
import '@storm-software/config/types';
|
|
25
|
+
import 'c12';
|
|
27
26
|
import '../tsconfig-Bz-CiFqD.cjs';
|
|
28
27
|
import '@stryke/types/tsconfig';
|
|
28
|
+
import '@stryke/types/array';
|
|
29
29
|
import '@stryke/json/types';
|
|
30
30
|
import 'memfs';
|
|
31
31
|
import 'node:fs';
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { TransformerFactory, SourceFile } from 'typescript';
|
|
2
|
-
import { C as Context } from '../
|
|
3
|
-
import '@
|
|
2
|
+
import { C as Context } from '../context-efHKG-wc.js';
|
|
3
|
+
import '@stryke/env/get-env-paths';
|
|
4
|
+
import '@stryke/types/package-json';
|
|
5
|
+
import 'jest-worker';
|
|
6
|
+
import 'jiti';
|
|
7
|
+
import 'oxc-parser';
|
|
8
|
+
import 'semver';
|
|
9
|
+
import 'unplugin';
|
|
4
10
|
import '@storm-software/config-tools/types';
|
|
5
|
-
import '@storm-software/config/types';
|
|
6
11
|
import '@stryke/types/base';
|
|
7
12
|
import '@stryke/types/configuration';
|
|
8
13
|
import '@stryke/types/file';
|
|
9
|
-
import 'c12';
|
|
10
14
|
import 'vite';
|
|
11
15
|
import '@farmfe/core';
|
|
12
16
|
import '@rspack/core';
|
|
@@ -16,16 +20,12 @@ import 'esbuild';
|
|
|
16
20
|
import 'rolldown';
|
|
17
21
|
import 'rollup';
|
|
18
22
|
import 'webpack';
|
|
19
|
-
import '@
|
|
20
|
-
import '@
|
|
21
|
-
import '
|
|
22
|
-
import 'jiti';
|
|
23
|
-
import 'oxc-parser';
|
|
24
|
-
import 'semver';
|
|
25
|
-
import 'unplugin';
|
|
26
|
-
import '@stryke/types/array';
|
|
23
|
+
import '@storm-software/build-tools/types';
|
|
24
|
+
import '@storm-software/config/types';
|
|
25
|
+
import 'c12';
|
|
27
26
|
import '../tsconfig-Bz-CiFqD.js';
|
|
28
27
|
import '@stryke/types/tsconfig';
|
|
28
|
+
import '@stryke/types/array';
|
|
29
29
|
import '@stryke/json/types';
|
|
30
30
|
import 'memfs';
|
|
31
31
|
import 'node:fs';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('../chunk-PEZXLKQD.cjs');
|
|
4
4
|
var chunk62ZJYXT3_cjs = require('../chunk-62ZJYXT3.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkRLMEYZ5I_cjs = require('../chunk-RLMEYZ5I.cjs');
|
|
6
6
|
var chunkLJZEN4HP_cjs = require('../chunk-LJZEN4HP.cjs');
|
|
7
7
|
require('../chunk-PK6SKIKE.cjs');
|
|
8
8
|
|
|
@@ -14,23 +14,23 @@ Object.defineProperty(exports, "isolatedDeclarations", {
|
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "SourcesMap", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkRLMEYZ5I_cjs.SourcesMap; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "createVirtualCompilerHost", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkRLMEYZ5I_cjs.createVirtualCompilerHost; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "createVirtualProgram", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkRLMEYZ5I_cjs.createVirtualProgram; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getDefaultCompilerOptions", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkRLMEYZ5I_cjs.getDefaultCompilerOptions; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "loadLibFiles", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkRLMEYZ5I_cjs.loadLibFiles; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "findIncludeMatch", {
|
|
36
36
|
enumerable: true,
|
|
@@ -2,14 +2,18 @@ export { IsolatedDeclarationsResult, __ΩIsolatedDeclarationsResult, isolatedDec
|
|
|
2
2
|
export { SourcesMap, __ΩSourcesMap, createVirtualCompilerHost, createVirtualProgram, getDefaultCompilerOptions, loadLibFiles } from './program.cjs';
|
|
3
3
|
export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigFilePath, isIncludeMatchFound, isMatchFound } from './tsconfig.cjs';
|
|
4
4
|
import 'typescript';
|
|
5
|
-
import '../
|
|
6
|
-
import '@
|
|
5
|
+
import '../context-B481RQbf.cjs';
|
|
6
|
+
import '@stryke/env/get-env-paths';
|
|
7
|
+
import '@stryke/types/package-json';
|
|
8
|
+
import 'jest-worker';
|
|
9
|
+
import 'jiti';
|
|
10
|
+
import 'oxc-parser';
|
|
11
|
+
import 'semver';
|
|
12
|
+
import 'unplugin';
|
|
7
13
|
import '@storm-software/config-tools/types';
|
|
8
|
-
import '@storm-software/config/types';
|
|
9
14
|
import '@stryke/types/base';
|
|
10
15
|
import '@stryke/types/configuration';
|
|
11
16
|
import '@stryke/types/file';
|
|
12
|
-
import 'c12';
|
|
13
17
|
import 'vite';
|
|
14
18
|
import '@farmfe/core';
|
|
15
19
|
import '@rspack/core';
|
|
@@ -19,16 +23,12 @@ import 'esbuild';
|
|
|
19
23
|
import 'rolldown';
|
|
20
24
|
import 'rollup';
|
|
21
25
|
import 'webpack';
|
|
22
|
-
import '@
|
|
23
|
-
import '@
|
|
24
|
-
import '
|
|
25
|
-
import 'jiti';
|
|
26
|
-
import 'oxc-parser';
|
|
27
|
-
import 'semver';
|
|
28
|
-
import 'unplugin';
|
|
29
|
-
import '@stryke/types/array';
|
|
26
|
+
import '@storm-software/build-tools/types';
|
|
27
|
+
import '@storm-software/config/types';
|
|
28
|
+
import 'c12';
|
|
30
29
|
import '../tsconfig-Bz-CiFqD.cjs';
|
|
31
30
|
import '@stryke/types/tsconfig';
|
|
31
|
+
import '@stryke/types/array';
|
|
32
32
|
import '@stryke/json/types';
|
|
33
33
|
import 'memfs';
|
|
34
34
|
import 'node:fs';
|
|
@@ -2,14 +2,18 @@ export { IsolatedDeclarationsResult, __ΩIsolatedDeclarationsResult, isolatedDec
|
|
|
2
2
|
export { SourcesMap, __ΩSourcesMap, createVirtualCompilerHost, createVirtualProgram, getDefaultCompilerOptions, loadLibFiles } from './program.js';
|
|
3
3
|
export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigFilePath, isIncludeMatchFound, isMatchFound } from './tsconfig.js';
|
|
4
4
|
import 'typescript';
|
|
5
|
-
import '../
|
|
6
|
-
import '@
|
|
5
|
+
import '../context-efHKG-wc.js';
|
|
6
|
+
import '@stryke/env/get-env-paths';
|
|
7
|
+
import '@stryke/types/package-json';
|
|
8
|
+
import 'jest-worker';
|
|
9
|
+
import 'jiti';
|
|
10
|
+
import 'oxc-parser';
|
|
11
|
+
import 'semver';
|
|
12
|
+
import 'unplugin';
|
|
7
13
|
import '@storm-software/config-tools/types';
|
|
8
|
-
import '@storm-software/config/types';
|
|
9
14
|
import '@stryke/types/base';
|
|
10
15
|
import '@stryke/types/configuration';
|
|
11
16
|
import '@stryke/types/file';
|
|
12
|
-
import 'c12';
|
|
13
17
|
import 'vite';
|
|
14
18
|
import '@farmfe/core';
|
|
15
19
|
import '@rspack/core';
|
|
@@ -19,16 +23,12 @@ import 'esbuild';
|
|
|
19
23
|
import 'rolldown';
|
|
20
24
|
import 'rollup';
|
|
21
25
|
import 'webpack';
|
|
22
|
-
import '@
|
|
23
|
-
import '@
|
|
24
|
-
import '
|
|
25
|
-
import 'jiti';
|
|
26
|
-
import 'oxc-parser';
|
|
27
|
-
import 'semver';
|
|
28
|
-
import 'unplugin';
|
|
29
|
-
import '@stryke/types/array';
|
|
26
|
+
import '@storm-software/build-tools/types';
|
|
27
|
+
import '@storm-software/config/types';
|
|
28
|
+
import 'c12';
|
|
30
29
|
import '../tsconfig-Bz-CiFqD.js';
|
|
31
30
|
import '@stryke/types/tsconfig';
|
|
31
|
+
import '@stryke/types/array';
|
|
32
32
|
import '@stryke/json/types';
|
|
33
33
|
import 'memfs';
|
|
34
34
|
import 'node:fs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../chunk-XGH6JWRO.js';
|
|
2
2
|
export { isolatedDeclarations } from '../chunk-367E23MI.js';
|
|
3
|
-
export { SourcesMap, createVirtualCompilerHost, createVirtualProgram, getDefaultCompilerOptions, loadLibFiles } from '../chunk-
|
|
3
|
+
export { SourcesMap, createVirtualCompilerHost, createVirtualProgram, getDefaultCompilerOptions, loadLibFiles } from '../chunk-V2T4H24I.js';
|
|
4
4
|
export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigFilePath, isIncludeMatchFound, isMatchFound } from '../chunk-OO4BIM7N.js';
|
|
5
5
|
import '../chunk-7QVYU63E.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|