powerlines 0.42.28 → 0.42.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-C4dPy8XP.mjs → api-BQswQ9mT.mjs} +31 -71
- package/dist/api-BQswQ9mT.mjs.map +1 -0
- package/dist/{api-LEq5A1pG.cjs → api-D7HzHvkw.cjs} +30 -71
- package/dist/{api-context-p1enWkF-.mjs → api-context-AY_byIdN.mjs} +4 -4
- package/dist/{api-context-p1enWkF-.mjs.map → api-context-AY_byIdN.mjs.map} +1 -1
- package/dist/{api-context-BSrRdlnu.cjs → api-context-BTrJUKNX.cjs} +4 -5
- package/dist/astro.cjs +1 -2
- package/dist/config.cjs +0 -2
- package/dist/constants.cjs +0 -2
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/esbuild.cjs +1 -2
- package/dist/farm.cjs +1 -2
- package/dist/index.cjs +3 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/next.cjs +1 -2
- package/dist/nuxt.cjs +2 -3
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.mjs +1 -1
- package/dist/plugin-utils.cjs +0 -2
- package/dist/rolldown.cjs +1 -2
- package/dist/rollup.cjs +1 -2
- package/dist/rspack.cjs +1 -2
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.d.cts +1 -4
- package/dist/storage/index.d.cts.map +1 -1
- package/dist/storage/index.d.mts +2 -5
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +1 -1
- package/dist/{tsconfig-ChmbpAO7.cjs → tsconfig-B0kfe_iM.cjs} +1 -2
- package/dist/{tsconfig-DoV1dUYg.mjs → tsconfig-B8RooiIp.mjs} +1 -1
- package/dist/{tsconfig-DoV1dUYg.mjs.map → tsconfig-B8RooiIp.mjs.map} +1 -1
- package/dist/tsdown.cjs +1 -2
- package/dist/tsup.cjs +1 -2
- package/dist/{types-9O-s0Fpu.d.mts → types-hdziyQIH.d.mts} +1 -1
- package/dist/types-hdziyQIH.d.mts.map +1 -0
- package/dist/typescript/index.cjs +104 -4
- package/dist/typescript/index.d.mts +1 -1
- package/dist/typescript/index.mjs +102 -3
- package/dist/typescript/index.mjs.map +1 -0
- package/dist/unloader.cjs +1 -2
- package/dist/unplugin.cjs +1 -3
- package/dist/unplugin.mjs +1 -1
- package/dist/utils.cjs +0 -2
- package/dist/{virtual-BNy8T32w.cjs → virtual-CJChzKrr.cjs} +1 -2
- package/dist/{virtual-PaZGNIrj.mjs → virtual-DB9ki0Y6.mjs} +1 -1
- package/dist/{virtual-PaZGNIrj.mjs.map → virtual-DB9ki0Y6.mjs.map} +1 -1
- package/dist/vite.cjs +1 -2
- package/dist/webpack.cjs +1 -2
- package/package.json +39 -38
- package/dist/api-C4dPy8XP.mjs.map +0 -1
- package/dist/api-LEq5A1pG.cjs.map +0 -1
- package/dist/api-context-BSrRdlnu.cjs.map +0 -1
- package/dist/astro.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/constants.cjs.map +0 -1
- package/dist/esbuild.cjs.map +0 -1
- package/dist/farm.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/next.cjs.map +0 -1
- package/dist/nuxt.cjs.map +0 -1
- package/dist/plugin-utils.cjs.map +0 -1
- package/dist/rolldown.cjs.map +0 -1
- package/dist/rollup.cjs.map +0 -1
- package/dist/rspack.cjs.map +0 -1
- package/dist/ts-morph-B85ZbV1Q.mjs +0 -102
- package/dist/ts-morph-B85ZbV1Q.mjs.map +0 -1
- package/dist/ts-morph-Cf4wz3E0.cjs +0 -115
- package/dist/ts-morph-Cf4wz3E0.cjs.map +0 -1
- package/dist/tsconfig-ChmbpAO7.cjs.map +0 -1
- package/dist/tsdown.cjs.map +0 -1
- package/dist/tsup.cjs.map +0 -1
- package/dist/types-9O-s0Fpu.d.mts.map +0 -1
- package/dist/unloader.cjs.map +0 -1
- package/dist/unplugin.cjs.map +0 -1
- package/dist/utils.cjs.map +0 -1
- package/dist/virtual-BNy8T32w.cjs.map +0 -1
- package/dist/vite.cjs.map +0 -1
- package/dist/webpack.cjs.map +0 -1
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["PowerlinesAPI"],"sources":["../src/index.ts"],"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\n/**\n * The powerlines library used by Storm Software for building NodeJS applications.\n *\n * @remarks\n * A build toolkit and runtime used by Storm Software in TypeScript applications\n *\n * @packageDocumentation\n */\n\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { PowerlinesAPI } from \"./api\";\nimport { UserConfig } from \"./types\";\n\nexport * from \"../schemas/fs\";\nexport type * from \"./types\";\n\n/**\n * Creates a new {@link PowerlinesAPI} instance.\n *\n * @param options - The user configuration options.\n * @returns A promise that resolves to a {@link PowerlinesAPI} instance.\n */\nexport async function createPowerlines(\n options: Partial<UserConfig> = {}\n): Promise<PowerlinesAPI> {\n options.root ??= process.cwd();\n const workspaceRoot = getWorkspaceRoot(options.root);\n\n return PowerlinesAPI.from(\n workspaceRoot,\n options as Parameters<typeof PowerlinesAPI.from>[1]\n );\n}\n\nexport { PowerlinesAPI };\nexport default PowerlinesAPI;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwCA,eAAsB,iBACpB,UAA+B,EAAE,EACT;AACxB,SAAQ,SAAS,QAAQ,KAAK;CAC9B,MAAM,oEAAiC,QAAQ,KAAK;AAEpD,QAAOA,0BAAc,KACnB,eACA,QACD;;AAIH,kBAAeA"}
|
package/dist/next.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next.cjs","names":["webpack"],"sources":["../src/next.ts"],"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 { WebpackPluginUserConfig } from \"@powerlines/plugin-webpack/types/plugin\";\nimport type { NextConfig } from \"next\";\nimport type { WebpackConfigContext } from \"next/dist/server/config-shared\";\nimport type { Configuration } from \"webpack\";\nimport webpack from \"./webpack\";\n\n/**\n * A Next.js configuration function that integrates Powerlines into the build process.\n *\n * @see https://nextjs.org/docs/api-reference/next.config.js/introduction\n *\n * @example\n * ```js\n * // next.config.js\n * import withPowerlines from 'powerlines/next'\n *\n * export default withPowerlines({\n * reactStrictMode: true,\n * })\n * ```\n *\n * @param config - The Next.js configuration to merge with the Powerlines configuration.\n * @returns The merged Next.js configuration.\n */\nexport function next(config: NextConfig = {}): NextConfig {\n return {\n ...config,\n webpack(webpackConfig: Configuration, context: WebpackConfigContext) {\n const result = (config.webpack?.(webpackConfig, context) ||\n webpackConfig) as Configuration;\n\n result.plugins ??= [];\n result.plugins.push(webpack(webpackConfig as WebpackPluginUserConfig));\n\n return result;\n }\n };\n}\n\nexport default next;\nexport { next as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,KAAK,SAAqB,EAAE,EAAc;AACxD,QAAO;EACL,GAAG;EACH,QAAQ,eAA8B,SAA+B;GACnE,MAAM,SAAU,OAAO,UAAU,eAAe,QAAQ,IACtD;AAEF,UAAO,YAAY,EAAE;AACrB,UAAO,QAAQ,KAAKA,wBAAQ,cAAyC,CAAC;AAEtE,UAAO;;EAEV"}
|
package/dist/nuxt.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.cjs","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"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 { addVitePlugin, addWebpackPlugin, defineNuxtModule } from \"@nuxt/kit\";\nimport { name, version } from \"../package.json\";\nimport { UserConfig } from \"./types\";\nimport vite from \"./vite\";\nimport webpack from \"./webpack\";\n\n/**\n * A Nuxt plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://nuxt.com/docs/guide/directory-structure/modules\n *\n * @example\n * ```ts\n * // nuxt.config.ts\n * import { defineNuxtConfig } from \"@nuxt/kit\";\n *\n * export default defineNuxtConfig({\n * modules: [\n * [\n * \"powerlines/nuxt\",\n * { name: \"example-app\", ... }\n * ],\n * ],\n * });\n *\n * ```\n */\nexport const nuxt = defineNuxtModule<UserConfig>({\n meta: {\n name,\n version,\n configKey: \"powerlines\",\n compatibility: {\n builder: {\n vite: \"^6.0.0\"\n }\n }\n },\n defaults: {},\n setup(options) {\n addVitePlugin(() => vite(options));\n addWebpackPlugin(() => webpack(options));\n }\n});\n\nexport default nuxt;\nexport { nuxt as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,uCAAoC;CAC/C,MAAM;EACJ;EACA;EACA,WAAW;EACX,eAAe,EACb,SAAS,EACP,MAAM,UACP,EACF;EACF;CACD,UAAU,EAAE;CACZ,MAAM,SAAS;AACb,qCAAoBA,qBAAK,QAAQ,CAAC;AAClC,wCAAuBC,wBAAQ,QAAQ,CAAC;;CAE3C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-utils.cjs","names":[],"sources":["../src/plugin-utils.ts"],"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\nexport * from \"@powerlines/core/plugin-utils\";\n"],"mappings":""}
|
package/dist/rolldown.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.cjs","names":["unplugin","createUnpluginFactory"],"sources":["../src/rolldown.ts"],"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 { resolveOptions } from \"@powerlines/plugin-rolldown/helpers/resolve-options\";\nimport {\n RolldownPluginContext,\n RolldownPluginUserConfig\n} from \"@powerlines/plugin-rolldown/types/plugin\";\nimport { defu } from \"defu\";\nimport type { InputOptions } from \"rolldown\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport {\n default as plugin,\n default as rolldown\n} from \"@powerlines/plugin-rolldown\";\n\n/**\n * A Rolldown plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import powerlines from \"powerlines/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const unplugin = createRolldownPlugin<Partial<RolldownPluginUserConfig>>(\n createUnpluginFactory<RolldownPluginContext>(\"rolldown\", (api, plugin) => {\n return {\n ...plugin,\n rolldown: {\n async options(options: InputOptions) {\n const merged = defu(await api.context.getEnvironment(), this);\n\n return defu(\n resolveOptions(merged),\n options,\n api.callHook(\n \"rolldown:options\",\n { environment: merged },\n options\n ) ?? {}\n );\n }\n }\n };\n })\n);\n\nexport { unplugin as \"module.exports\" };\n\nexport default unplugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAaA,gDACXC,uCAA6C,aAAa,KAAK,WAAW;AACxE,QAAO;EACL,GAAG;EACH,UAAU,EACR,MAAM,QAAQ,SAAuB;GACnC,MAAM,wBAAc,MAAM,IAAI,QAAQ,gBAAgB,EAAE,KAAK;AAE7D,iGACiB,OAAO,EACtB,SACA,IAAI,SACF,oBACA,EAAE,aAAa,QAAQ,EACvB,QACD,IAAI,EAAE,CACR;KAEJ;EACF;EACD,CACH"}
|
package/dist/rollup.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.cjs","names":["unplugin","createUnpluginFactory"],"sources":["../src/rollup.ts"],"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 { RollupPluginUserConfig } from \"@powerlines/plugin-rollup/types/plugin\";\nimport { createRollupPlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport {\n default as plugin,\n default as rollup\n} from \"@powerlines/plugin-rollup\";\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"powerlines/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const unplugin = createRollupPlugin<Partial<RollupPluginUserConfig>>(\n createUnpluginFactory(\"rollup\")\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAaA,8CACXC,uCAAsB,SAAS,CAChC"}
|
package/dist/rspack.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.cjs","names":["unplugin","createUnpluginFactory"],"sources":["../src/rspack.ts"],"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 { RspackPluginUserConfig } from \"@powerlines/plugin-rspack/types/plugin\";\nimport { createRspackPlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport {\n default as plugin,\n default as rspack\n} from \"@powerlines/plugin-rspack\";\n\n/**\n * An Rspack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n *\n * import powerlines from \"powerlines/rspack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const unplugin = createRspackPlugin<Partial<RspackPluginUserConfig>>(\n createUnpluginFactory(\"rspack\")\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAaA,8CACXC,uCAAsB,SAAS,CAChC"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import defu$1 from "defu";
|
|
2
|
-
import { InMemoryFileSystemHost, Project } from "ts-morph";
|
|
3
|
-
|
|
4
|
-
//#region src/typescript/ts-morph.ts
|
|
5
|
-
var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
|
|
6
|
-
#context;
|
|
7
|
-
constructor(context) {
|
|
8
|
-
super();
|
|
9
|
-
this.#context = context;
|
|
10
|
-
}
|
|
11
|
-
deleteSync(path) {
|
|
12
|
-
this.#context.fs.removeSync(path);
|
|
13
|
-
}
|
|
14
|
-
readDirSync(dirPath) {
|
|
15
|
-
if (!this.#context.fs.isDirectorySync(dirPath)) return [];
|
|
16
|
-
return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
|
|
17
|
-
const fullPath = this.#context.fs.resolveSync(entry);
|
|
18
|
-
if (fullPath) ret.push({
|
|
19
|
-
name: entry,
|
|
20
|
-
isDirectory: this.#context.fs.isDirectorySync(fullPath),
|
|
21
|
-
isFile: this.#context.fs.isFileSync(fullPath),
|
|
22
|
-
isSymlink: false
|
|
23
|
-
});
|
|
24
|
-
return ret;
|
|
25
|
-
}, []);
|
|
26
|
-
}
|
|
27
|
-
async readFile(filePath) {
|
|
28
|
-
if (!this.#context.fs.isFileSync(filePath)) return "";
|
|
29
|
-
return await this.#context.fs.read(filePath);
|
|
30
|
-
}
|
|
31
|
-
readFileSync(filePath) {
|
|
32
|
-
if (!this.#context.fs.isFileSync(filePath)) return "";
|
|
33
|
-
return this.#context.fs.readSync(filePath);
|
|
34
|
-
}
|
|
35
|
-
async writeFile(filePath, fileText) {
|
|
36
|
-
return this.#context.fs.write(filePath, fileText);
|
|
37
|
-
}
|
|
38
|
-
writeFileSync(filePath, fileText) {
|
|
39
|
-
this.#context.fs.writeSync(filePath, fileText);
|
|
40
|
-
}
|
|
41
|
-
async mkdir(dirPath) {
|
|
42
|
-
await this.#context.fs.mkdir(dirPath);
|
|
43
|
-
}
|
|
44
|
-
mkdirSync(dirPath) {
|
|
45
|
-
this.#context.fs.mkdirSync(dirPath);
|
|
46
|
-
}
|
|
47
|
-
async move(srcPath, destPath) {
|
|
48
|
-
await this.#context.fs.move(srcPath, destPath);
|
|
49
|
-
}
|
|
50
|
-
moveSync(srcPath, destPath) {
|
|
51
|
-
this.#context.fs.moveSync(srcPath, destPath);
|
|
52
|
-
}
|
|
53
|
-
async copy(srcPath, destPath) {
|
|
54
|
-
await this.#context.fs.copy(srcPath, destPath);
|
|
55
|
-
}
|
|
56
|
-
copySync(srcPath, destPath) {
|
|
57
|
-
this.#context.fs.copySync(srcPath, destPath);
|
|
58
|
-
}
|
|
59
|
-
async fileExists(filePath) {
|
|
60
|
-
return this.#context.fs.isFile(filePath);
|
|
61
|
-
}
|
|
62
|
-
fileExistsSync(filePath) {
|
|
63
|
-
return this.#context.fs.isFileSync(filePath);
|
|
64
|
-
}
|
|
65
|
-
async directoryExists(dirPath) {
|
|
66
|
-
return this.#context.fs.isDirectory(dirPath);
|
|
67
|
-
}
|
|
68
|
-
directoryExistsSync(dirPath) {
|
|
69
|
-
return this.#context.fs.isDirectorySync(dirPath);
|
|
70
|
-
}
|
|
71
|
-
realpathSync(path) {
|
|
72
|
-
return this.#context.fs.resolveSync(path) || path;
|
|
73
|
-
}
|
|
74
|
-
getCurrentDirectory() {
|
|
75
|
-
return this.#context.workspaceConfig.workspaceRoot;
|
|
76
|
-
}
|
|
77
|
-
async glob(patterns) {
|
|
78
|
-
return this.#context.fs.glob(patterns);
|
|
79
|
-
}
|
|
80
|
-
globSync(patterns) {
|
|
81
|
-
return this.#context.fs.globSync(patterns);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing
|
|
86
|
-
*
|
|
87
|
-
* @param context - The Powerlines context
|
|
88
|
-
* @returns A ts-morph {@link Project} instance
|
|
89
|
-
*/
|
|
90
|
-
function createProgram(context, override) {
|
|
91
|
-
context.debug(`Creating ts-morph Project instance with configuration from: ${context.tsconfig.tsconfigFilePath}.`);
|
|
92
|
-
return new Project(defu$1(override ?? {}, {
|
|
93
|
-
skipAddingFilesFromTsConfig: false,
|
|
94
|
-
tsConfigFilePath: context.tsconfig.tsconfigFilePath,
|
|
95
|
-
fileSystem: new VirtualFileSystemHost(context),
|
|
96
|
-
compilerOptions: defu$1(context.tsconfig.options ?? {}, { lib: ["lib.esnext.full.d.ts"] })
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
export { createProgram as n, VirtualFileSystemHost as t };
|
|
102
|
-
//# sourceMappingURL=ts-morph-B85ZbV1Q.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ts-morph-B85ZbV1Q.mjs","names":["#context","defu"],"sources":["../src/typescript/ts-morph.ts"],"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 type { Context } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport {\n CompilerOptions,\n FileSystemHost,\n InMemoryFileSystemHost,\n Project,\n ProjectOptions,\n RuntimeDirEntry\n} from \"ts-morph\";\n\nexport class VirtualFileSystemHost\n extends InMemoryFileSystemHost\n implements FileSystemHost\n{\n #context: Context;\n\n public constructor(context: Context) {\n super();\n\n this.#context = context;\n }\n\n public override deleteSync(path: string) {\n this.#context.fs.removeSync(path);\n }\n\n public override readDirSync(dirPath: string): RuntimeDirEntry[] {\n if (!this.#context.fs.isDirectorySync(dirPath)) {\n return [];\n }\n\n return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {\n const fullPath = this.#context.fs.resolveSync(entry);\n if (fullPath) {\n ret.push({\n name: entry,\n isDirectory: this.#context.fs.isDirectorySync(fullPath),\n isFile: this.#context.fs.isFileSync(fullPath),\n isSymlink: false\n });\n }\n\n return ret;\n }, [] as RuntimeDirEntry[]);\n }\n\n public override async readFile(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return (await this.#context.fs.read(filePath))!;\n }\n\n public override readFileSync(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return this.#context.fs.readSync(filePath)!;\n }\n\n public override async writeFile(filePath: string, fileText: string) {\n return this.#context.fs.write(filePath, fileText);\n }\n\n public override writeFileSync(filePath: string, fileText: string) {\n this.#context.fs.writeSync(filePath, fileText);\n }\n\n public override async mkdir(dirPath: string) {\n await this.#context.fs.mkdir(dirPath);\n }\n\n public override mkdirSync(dirPath: string) {\n this.#context.fs.mkdirSync(dirPath);\n }\n\n public override async move(srcPath: string, destPath: string) {\n await this.#context.fs.move(srcPath, destPath);\n }\n\n public override moveSync(srcPath: string, destPath: string) {\n this.#context.fs.moveSync(srcPath, destPath);\n }\n\n public override async copy(srcPath: string, destPath: string) {\n await this.#context.fs.copy(srcPath, destPath);\n }\n\n public override copySync(srcPath: string, destPath: string) {\n this.#context.fs.copySync(srcPath, destPath);\n }\n\n public override async fileExists(filePath: string) {\n return this.#context.fs.isFile(filePath);\n }\n\n public override fileExistsSync(filePath: string) {\n return this.#context.fs.isFileSync(filePath);\n }\n\n public override async directoryExists(dirPath: string) {\n return this.#context.fs.isDirectory(dirPath);\n }\n\n public override directoryExistsSync(dirPath: string): boolean {\n return this.#context.fs.isDirectorySync(dirPath);\n }\n\n public override realpathSync(path: string) {\n return this.#context.fs.resolveSync(path) || path;\n }\n\n public override getCurrentDirectory() {\n return this.#context.workspaceConfig.workspaceRoot;\n }\n\n public override async glob(\n patterns: ReadonlyArray<string>\n ): Promise<string[]> {\n return this.#context.fs.glob(patterns as string[]);\n }\n\n public override globSync(patterns: ReadonlyArray<string>): string[] {\n return this.#context.fs.globSync(patterns as string[]);\n }\n}\n\n/**\n * Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing\n *\n * @param context - The Powerlines context\n * @returns A ts-morph {@link Project} instance\n */\nexport function createProgram(\n context: Context,\n override: Partial<ProjectOptions>\n): Project {\n context.debug(\n `Creating ts-morph Project instance with configuration from: ${\n context.tsconfig.tsconfigFilePath\n }.`\n );\n\n const project = new Project(\n defu(override ?? {}, {\n skipAddingFilesFromTsConfig: false,\n tsConfigFilePath: context.tsconfig.tsconfigFilePath,\n fileSystem: new VirtualFileSystemHost(context),\n compilerOptions: defu(context.tsconfig.options ?? {}, {\n lib: [\"lib.esnext.full.d.ts\"]\n }) as CompilerOptions\n })\n );\n\n return project;\n}\n"],"mappings":";;;;AA6BA,IAAa,wBAAb,c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");
|
|
3
|
-
defu = require_chunk.__toESM(defu);
|
|
4
|
-
let ts_morph = require("ts-morph");
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/ts-morph.ts
|
|
7
|
-
var VirtualFileSystemHost = class extends ts_morph.InMemoryFileSystemHost {
|
|
8
|
-
#context;
|
|
9
|
-
constructor(context) {
|
|
10
|
-
super();
|
|
11
|
-
this.#context = context;
|
|
12
|
-
}
|
|
13
|
-
deleteSync(path) {
|
|
14
|
-
this.#context.fs.removeSync(path);
|
|
15
|
-
}
|
|
16
|
-
readDirSync(dirPath) {
|
|
17
|
-
if (!this.#context.fs.isDirectorySync(dirPath)) return [];
|
|
18
|
-
return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
|
|
19
|
-
const fullPath = this.#context.fs.resolveSync(entry);
|
|
20
|
-
if (fullPath) ret.push({
|
|
21
|
-
name: entry,
|
|
22
|
-
isDirectory: this.#context.fs.isDirectorySync(fullPath),
|
|
23
|
-
isFile: this.#context.fs.isFileSync(fullPath),
|
|
24
|
-
isSymlink: false
|
|
25
|
-
});
|
|
26
|
-
return ret;
|
|
27
|
-
}, []);
|
|
28
|
-
}
|
|
29
|
-
async readFile(filePath) {
|
|
30
|
-
if (!this.#context.fs.isFileSync(filePath)) return "";
|
|
31
|
-
return await this.#context.fs.read(filePath);
|
|
32
|
-
}
|
|
33
|
-
readFileSync(filePath) {
|
|
34
|
-
if (!this.#context.fs.isFileSync(filePath)) return "";
|
|
35
|
-
return this.#context.fs.readSync(filePath);
|
|
36
|
-
}
|
|
37
|
-
async writeFile(filePath, fileText) {
|
|
38
|
-
return this.#context.fs.write(filePath, fileText);
|
|
39
|
-
}
|
|
40
|
-
writeFileSync(filePath, fileText) {
|
|
41
|
-
this.#context.fs.writeSync(filePath, fileText);
|
|
42
|
-
}
|
|
43
|
-
async mkdir(dirPath) {
|
|
44
|
-
await this.#context.fs.mkdir(dirPath);
|
|
45
|
-
}
|
|
46
|
-
mkdirSync(dirPath) {
|
|
47
|
-
this.#context.fs.mkdirSync(dirPath);
|
|
48
|
-
}
|
|
49
|
-
async move(srcPath, destPath) {
|
|
50
|
-
await this.#context.fs.move(srcPath, destPath);
|
|
51
|
-
}
|
|
52
|
-
moveSync(srcPath, destPath) {
|
|
53
|
-
this.#context.fs.moveSync(srcPath, destPath);
|
|
54
|
-
}
|
|
55
|
-
async copy(srcPath, destPath) {
|
|
56
|
-
await this.#context.fs.copy(srcPath, destPath);
|
|
57
|
-
}
|
|
58
|
-
copySync(srcPath, destPath) {
|
|
59
|
-
this.#context.fs.copySync(srcPath, destPath);
|
|
60
|
-
}
|
|
61
|
-
async fileExists(filePath) {
|
|
62
|
-
return this.#context.fs.isFile(filePath);
|
|
63
|
-
}
|
|
64
|
-
fileExistsSync(filePath) {
|
|
65
|
-
return this.#context.fs.isFileSync(filePath);
|
|
66
|
-
}
|
|
67
|
-
async directoryExists(dirPath) {
|
|
68
|
-
return this.#context.fs.isDirectory(dirPath);
|
|
69
|
-
}
|
|
70
|
-
directoryExistsSync(dirPath) {
|
|
71
|
-
return this.#context.fs.isDirectorySync(dirPath);
|
|
72
|
-
}
|
|
73
|
-
realpathSync(path) {
|
|
74
|
-
return this.#context.fs.resolveSync(path) || path;
|
|
75
|
-
}
|
|
76
|
-
getCurrentDirectory() {
|
|
77
|
-
return this.#context.workspaceConfig.workspaceRoot;
|
|
78
|
-
}
|
|
79
|
-
async glob(patterns) {
|
|
80
|
-
return this.#context.fs.glob(patterns);
|
|
81
|
-
}
|
|
82
|
-
globSync(patterns) {
|
|
83
|
-
return this.#context.fs.globSync(patterns);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing
|
|
88
|
-
*
|
|
89
|
-
* @param context - The Powerlines context
|
|
90
|
-
* @returns A ts-morph {@link Project} instance
|
|
91
|
-
*/
|
|
92
|
-
function createProgram(context, override) {
|
|
93
|
-
context.debug(`Creating ts-morph Project instance with configuration from: ${context.tsconfig.tsconfigFilePath}.`);
|
|
94
|
-
return new ts_morph.Project((0, defu.default)(override ?? {}, {
|
|
95
|
-
skipAddingFilesFromTsConfig: false,
|
|
96
|
-
tsConfigFilePath: context.tsconfig.tsconfigFilePath,
|
|
97
|
-
fileSystem: new VirtualFileSystemHost(context),
|
|
98
|
-
compilerOptions: (0, defu.default)(context.tsconfig.options ?? {}, { lib: ["lib.esnext.full.d.ts"] })
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//#endregion
|
|
103
|
-
Object.defineProperty(exports, 'VirtualFileSystemHost', {
|
|
104
|
-
enumerable: true,
|
|
105
|
-
get: function () {
|
|
106
|
-
return VirtualFileSystemHost;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
Object.defineProperty(exports, 'createProgram', {
|
|
110
|
-
enumerable: true,
|
|
111
|
-
get: function () {
|
|
112
|
-
return createProgram;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
//# sourceMappingURL=ts-morph-Cf4wz3E0.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ts-morph-Cf4wz3E0.cjs","names":["InMemoryFileSystemHost","#context","Project"],"sources":["../src/typescript/ts-morph.ts"],"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 type { Context } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport {\n CompilerOptions,\n FileSystemHost,\n InMemoryFileSystemHost,\n Project,\n ProjectOptions,\n RuntimeDirEntry\n} from \"ts-morph\";\n\nexport class VirtualFileSystemHost\n extends InMemoryFileSystemHost\n implements FileSystemHost\n{\n #context: Context;\n\n public constructor(context: Context) {\n super();\n\n this.#context = context;\n }\n\n public override deleteSync(path: string) {\n this.#context.fs.removeSync(path);\n }\n\n public override readDirSync(dirPath: string): RuntimeDirEntry[] {\n if (!this.#context.fs.isDirectorySync(dirPath)) {\n return [];\n }\n\n return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {\n const fullPath = this.#context.fs.resolveSync(entry);\n if (fullPath) {\n ret.push({\n name: entry,\n isDirectory: this.#context.fs.isDirectorySync(fullPath),\n isFile: this.#context.fs.isFileSync(fullPath),\n isSymlink: false\n });\n }\n\n return ret;\n }, [] as RuntimeDirEntry[]);\n }\n\n public override async readFile(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return (await this.#context.fs.read(filePath))!;\n }\n\n public override readFileSync(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return this.#context.fs.readSync(filePath)!;\n }\n\n public override async writeFile(filePath: string, fileText: string) {\n return this.#context.fs.write(filePath, fileText);\n }\n\n public override writeFileSync(filePath: string, fileText: string) {\n this.#context.fs.writeSync(filePath, fileText);\n }\n\n public override async mkdir(dirPath: string) {\n await this.#context.fs.mkdir(dirPath);\n }\n\n public override mkdirSync(dirPath: string) {\n this.#context.fs.mkdirSync(dirPath);\n }\n\n public override async move(srcPath: string, destPath: string) {\n await this.#context.fs.move(srcPath, destPath);\n }\n\n public override moveSync(srcPath: string, destPath: string) {\n this.#context.fs.moveSync(srcPath, destPath);\n }\n\n public override async copy(srcPath: string, destPath: string) {\n await this.#context.fs.copy(srcPath, destPath);\n }\n\n public override copySync(srcPath: string, destPath: string) {\n this.#context.fs.copySync(srcPath, destPath);\n }\n\n public override async fileExists(filePath: string) {\n return this.#context.fs.isFile(filePath);\n }\n\n public override fileExistsSync(filePath: string) {\n return this.#context.fs.isFileSync(filePath);\n }\n\n public override async directoryExists(dirPath: string) {\n return this.#context.fs.isDirectory(dirPath);\n }\n\n public override directoryExistsSync(dirPath: string): boolean {\n return this.#context.fs.isDirectorySync(dirPath);\n }\n\n public override realpathSync(path: string) {\n return this.#context.fs.resolveSync(path) || path;\n }\n\n public override getCurrentDirectory() {\n return this.#context.workspaceConfig.workspaceRoot;\n }\n\n public override async glob(\n patterns: ReadonlyArray<string>\n ): Promise<string[]> {\n return this.#context.fs.glob(patterns as string[]);\n }\n\n public override globSync(patterns: ReadonlyArray<string>): string[] {\n return this.#context.fs.globSync(patterns as string[]);\n }\n}\n\n/**\n * Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing\n *\n * @param context - The Powerlines context\n * @returns A ts-morph {@link Project} instance\n */\nexport function createProgram(\n context: Context,\n override: Partial<ProjectOptions>\n): Project {\n context.debug(\n `Creating ts-morph Project instance with configuration from: ${\n context.tsconfig.tsconfigFilePath\n }.`\n );\n\n const project = new Project(\n defu(override ?? {}, {\n skipAddingFilesFromTsConfig: false,\n tsConfigFilePath: context.tsconfig.tsconfigFilePath,\n fileSystem: new VirtualFileSystemHost(context),\n compilerOptions: defu(context.tsconfig.options ?? {}, {\n lib: [\"lib.esnext.full.d.ts\"]\n }) as CompilerOptions\n })\n );\n\n return project;\n}\n"],"mappings":";;;;;;AA6BA,IAAa,wBAAb,cACUA,gCAEV;CACE;CAEA,AAAO,YAAY,SAAkB;AACnC,SAAO;AAEP,QAAKC,UAAW;;CAGlB,AAAgB,WAAW,MAAc;AACvC,QAAKA,QAAS,GAAG,WAAW,KAAK;;CAGnC,AAAgB,YAAY,SAAoC;AAC9D,MAAI,CAAC,MAAKA,QAAS,GAAG,gBAAgB,QAAQ,CAC5C,QAAO,EAAE;AAGX,SAAO,MAAKA,QAAS,GAAG,SAAS,QAAQ,CAAC,QAAQ,KAAK,UAAU;GAC/D,MAAM,WAAW,MAAKA,QAAS,GAAG,YAAY,MAAM;AACpD,OAAI,SACF,KAAI,KAAK;IACP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gBAAgB,SAAiB;AACrD,SAAO,MAAKA,QAAS,GAAG,YAAY,QAAQ;;CAG9C,AAAgB,oBAAoB,SAA0B;AAC5D,SAAO,MAAKA,QAAS,GAAG,gBAAgB,QAAQ;;CAGlD,AAAgB,aAAa,MAAc;AACzC,SAAO,MAAKA,QAAS,GAAG,YAAY,KAAK,IAAI;;CAG/C,AAAgB,sBAAsB;AACpC,SAAO,MAAKA,QAAS,gBAAgB;;CAGvC,MAAsB,KACpB,UACmB;AACnB,SAAO,MAAKA,QAAS,GAAG,KAAK,SAAqB;;CAGpD,AAAgB,SAAS,UAA2C;AAClE,SAAO,MAAKA,QAAS,GAAG,SAAS,SAAqB;;;;;;;;;AAU1D,SAAgB,cACd,SACA,UACS;AACT,SAAQ,MACN,+DACE,QAAQ,SAAS,iBAClB,GACF;AAaD,QAXgB,IAAIC,mCACb,YAAY,EAAE,EAAE;EACnB,6BAA6B;EAC7B,kBAAkB,QAAQ,SAAS;EACnC,YAAY,IAAI,sBAAsB,QAAQ;EAC9C,mCAAsB,QAAQ,SAAS,WAAW,EAAE,EAAE,EACpD,KAAK,CAAC,uBAAuB,EAC9B,CAAC;EACH,CAAC,CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-ChmbpAO7.cjs","names":["ts"],"sources":["../src/typescript/tsconfig.ts"],"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 type { ParsedTypeScriptConfig, TSConfig } from \"@powerlines/core\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFileSync } from \"@stryke/fs/json\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { FilterPattern } from \"@stryke/types/file\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport defu from \"defu\";\nimport ts from \"typescript\";\n\n/**\n * Get the path to the tsconfig.json file.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param projectRoot - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @returns The absolute path to the tsconfig.json file.\n * @throws If the tsconfig.json file does not exist.\n */\nexport function getTsconfigFilePath(\n workspaceRoot: string,\n projectRoot: string,\n tsconfig?: string\n): string {\n let tsconfigFilePath: string | undefined;\n if (tsconfig) {\n tsconfigFilePath = tryTsconfigFilePath(\n workspaceRoot,\n projectRoot,\n tsconfig\n );\n } else {\n tsconfigFilePath = tryTsconfigFilePath(\n workspaceRoot,\n projectRoot,\n \"tsconfig.app.json\"\n );\n if (!tsconfigFilePath) {\n tsconfigFilePath = tryTsconfigFilePath(\n workspaceRoot,\n projectRoot,\n \"tsconfig.lib.json\"\n );\n if (!tsconfigFilePath) {\n tsconfigFilePath = tryTsconfigFilePath(\n workspaceRoot,\n projectRoot,\n \"tsconfig.json\"\n );\n }\n }\n }\n\n if (!tsconfigFilePath) {\n throw new Error(\n `Cannot find the \\`tsconfig.json\\` configuration file for the project at ${\n projectRoot\n }.`\n );\n }\n\n return tsconfigFilePath;\n}\n\n/**\n * Get the path to the tsconfig.json file.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param projectRoot - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @returns The absolute path to the tsconfig.json file.\n * @throws If the tsconfig.json file does not exist.\n */\nexport function tryTsconfigFilePath(\n workspaceRoot: string,\n projectRoot: string,\n tsconfig: string\n): string | undefined {\n let tsconfigFilePath = tsconfig;\n if (!existsSync(tsconfigFilePath)) {\n tsconfigFilePath = appendPath(tsconfig, projectRoot);\n if (!existsSync(tsconfigFilePath)) {\n tsconfigFilePath = appendPath(\n tsconfig,\n appendPath(projectRoot, workspaceRoot)\n );\n if (!existsSync(tsconfigFilePath)) {\n return undefined;\n }\n }\n }\n\n return tsconfigFilePath;\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function findMatch(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[],\n extensions: string[] = [\".ts\", \".tsx\", \".d.ts\"]\n): string | RegExp | null | undefined {\n return types.find(\n type =>\n tsconfigType?.toString().toLowerCase() ===\n type?.toString().toLowerCase() ||\n tsconfigType?.toString().toLowerCase() ===\n `./${type?.toString().toLowerCase()}` ||\n `./${tsconfigType?.toString().toLowerCase()}` ===\n type?.toString().toLowerCase() ||\n extensions.some(\n ext =>\n `${tsconfigType?.toString().toLowerCase()}${ext}` ===\n type?.toString().toLowerCase() ||\n `${tsconfigType?.toString().toLowerCase()}${ext}` ===\n `./${type?.toString().toLowerCase()}` ||\n `${type?.toString().toLowerCase()}${ext}` ===\n `./${tsconfigType?.toString().toLowerCase()}` ||\n tsconfigType?.toString().toLowerCase() ===\n `${type?.toString().toLowerCase()}${ext}` ||\n tsconfigType?.toString().toLowerCase() ===\n `./${type?.toString().toLowerCase()}${ext}` ||\n type?.toString().toLowerCase() ===\n `./${tsconfigType?.toString().toLowerCase()}${ext}`\n )\n );\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function findIncludeMatch(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[]\n): string | RegExp | null | undefined {\n return findMatch(tsconfigType, types, [\n \".ts\",\n \".tsx\",\n \".d.ts\",\n \".js\",\n \".jsx\",\n \".mjs\",\n \".cjs\",\n \".mts\",\n \".cts\",\n \"/*.ts\",\n \"/*.tsx\",\n \"/*.d.ts\",\n \"/*.js\",\n \"/*.jsx\",\n \"/*.mjs\",\n \"/*.cjs\",\n \"/*.mts\",\n \"/*.cts\",\n \"/**/*.ts\",\n \"/**/*.tsx\",\n \"/**/*.d.ts\",\n \"/**/*.js\",\n \"/**/*.jsx\",\n \"/**/*.mjs\",\n \"/**/*.cjs\",\n \"/**/*.mts\",\n \"/**/*.cts\"\n ]);\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function isMatchFound(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[]\n): boolean {\n return findMatch(tsconfigType, types) !== undefined;\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function isIncludeMatchFound(\n tsconfigType: FilterPattern,\n types: FilterPattern[]\n): boolean {\n return (\n findIncludeMatch(\n tsconfigType as string | RegExp | null,\n types as (string | RegExp | null)[]\n ) !== undefined\n );\n}\n\n/**\n * Get the parsed TypeScript configuration.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param projectRoot - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @param tsconfigRaw - The raw tsconfig.json content.\n * @param originalTsconfigJson - The original tsconfig.json content.\n * @param host - The TypeScript parse config host.\n * @returns The resolved TypeScript configuration.\n */\nexport function getParsedTypeScriptConfig(\n workspaceRoot: string,\n projectRoot: string,\n tsconfig?: string,\n tsconfigRaw: TSConfig = {},\n originalTsconfigJson?: TSConfig,\n host: ts.ParseConfigHost = ts.sys\n): ParsedTypeScriptConfig {\n const tsconfigFilePath = getTsconfigFilePath(\n workspaceRoot,\n projectRoot,\n tsconfig\n );\n const tsconfigJson = readJsonFileSync<TSConfig>(tsconfigFilePath);\n if (!tsconfigJson) {\n throw new Error(\n `Cannot find the \\`tsconfig.json\\` configuration file at ${joinPaths(\n projectRoot,\n tsconfig ?? \"tsconfig.json\"\n )}`\n );\n }\n\n const parsedCommandLine = ts.parseJsonConfigFileContent(\n defu(tsconfigRaw ?? {}, tsconfigJson),\n host,\n appendPath(projectRoot, workspaceRoot)\n );\n if (parsedCommandLine.errors.length > 0) {\n const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:\n${parsedCommandLine.errors\n .map(\n error =>\n `- ${\n (error.category !== undefined && error.code\n ? `[${error.category}-${error.code}]: `\n : \"\") + error.messageText.toString()\n }`\n )\n .join(\"\\n\")}\n `;\n\n throw new Error(errorMessage);\n }\n\n return {\n ...parsedCommandLine,\n originalTsconfigJson: (originalTsconfigJson ??\n tsconfigJson) as TsConfigJson,\n tsconfigJson,\n tsconfigFilePath\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,oBACd,eACA,aACA,UACQ;CACR,IAAI;AACJ,KAAI,SACF,oBAAmB,oBACjB,eACA,aACA,SACD;MACI;AACL,qBAAmB,oBACjB,eACA,aACA,oBACD;AACD,MAAI,CAAC,kBAAkB;AACrB,sBAAmB,oBACjB,eACA,aACA,oBACD;AACD,OAAI,CAAC,iBACH,oBAAmB,oBACjB,eACA,aACA,gBACD;;;AAKP,KAAI,CAAC,iBACH,OAAM,IAAI,MACR,2EACE,YACD,GACF;AAGH,QAAO;;;;;;;;;;;AAYT,SAAgB,oBACd,eACA,aACA,UACoB;CACpB,IAAI,mBAAmB;AACvB,KAAI,mCAAY,iBAAiB,EAAE;AACjC,yDAA8B,UAAU,YAAY;AACpD,MAAI,mCAAY,iBAAiB,EAAE;AACjC,0DACE,8CACW,aAAa,cAAc,CACvC;AACD,OAAI,mCAAY,iBAAiB,CAC/B;;;AAKN,QAAO;;;;;;;;;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ACvB,eACA,aACA,SACD;CACD,MAAM,qDAA0C,iBAAiB;AACjE,KAAI,CAAC,aACH,OAAM,IAAI,MACR,kGACE,aACA,YAAY,gBACb,GACF;CAGH,MAAM,oBAAoBA,mBAAG,6CACtB,eAAe,EAAE,EAAE,aAAa,EACrC,0CACW,aAAa,cAAc,CACvC;AACD,KAAI,kBAAkB,OAAO,SAAS,GAAG;EACvC,MAAM,eAAe;EACvB,kBAAkB,OACjB,KACC,UACE,MACG,MAAM,aAAa,UAAa,MAAM,OACnC,IAAI,MAAM,SAAS,GAAG,MAAM,KAAK,OACjC,MAAM,MAAM,YAAY,UAAU,GAE3C,CACA,KAAK,KAAK,CAAC;;AAGV,QAAM,IAAI,MAAM,aAAa;;AAG/B,QAAO;EACL,GAAG;EACH,sBAAuB,wBACrB;EACF;EACA;EACD"}
|
package/dist/tsdown.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.cjs","names":["rolldown"],"sources":["../src/tsdown.ts"],"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 { RolldownOptions } from \"@powerlines/plugin-rolldown/types/build\";\nimport { resolveFromFormat } from \"@powerlines/plugin-tsdown/helpers/resolve-options\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { ModuleFormat } from \"rolldown\";\nimport type { UserConfig } from \"tsdown/config\";\nimport rolldown from \"./rolldown\";\nimport { CopyConfig, ResolveConfig } from \"./types\";\n\nexport {\n default as plugin,\n default as tsdown\n} from \"@powerlines/plugin-tsdown\";\n\n/**\n * A Tsdown configuration function that integrates Powerlines into the build process.\n *\n * @see https://github.com/rolldown/tsdown\n *\n * @example\n * ```ts\n * // tsdown.config.ts\n * import withPowerlines from \"powerlines/tsdown\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsdown options to merge with the Powerlines configuration.\n * @returns The merged Tsdown configuration options.\n */\nexport function unplugin(options: UserConfig = {}): UserConfig {\n return {\n ...options,\n entry: options.entry,\n plugins: [\n rolldown({\n name: options.name,\n root: options.cwd ?? process.cwd(),\n output: {\n path: options.outDir,\n format: resolveFromFormat(\n options.format as ModuleFormat | ModuleFormat[]\n ),\n copy: {\n path: options.outDir!,\n assets: toArray(options.copy)\n .map(copy => {\n if (!copy) {\n return undefined;\n }\n\n if (isSetString(copy)) {\n return copy;\n }\n\n if (isFunction(copy)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based copy options are not supported in Powerlines.\"\n );\n\n return undefined;\n }\n\n return {\n input: copy.from,\n output: copy.to\n };\n })\n .filter(Boolean) as CopyConfig[\"assets\"]\n }\n },\n resolve: {\n external: options.external\n ? (toArray(options.external)\n .map(external => {\n if (isFunction(external)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based external options are not supported in Powerlines.\"\n );\n\n return undefined;\n }\n\n return external;\n })\n .filter(Boolean) as ResolveConfig[\"external\"])\n : undefined,\n noExternal: options.noExternal\n ? (toArray(options.noExternal)\n .map(noExternal => {\n if (isFunction(noExternal)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based noExternal options are not supported in Powerlines.\"\n );\n\n return undefined;\n }\n\n return noExternal;\n })\n .filter(Boolean) as ResolveConfig[\"noExternal\"])\n : undefined\n },\n rolldown: options.inputOptions as RolldownOptions,\n tsconfig: isSetString(options.tsconfig) ? options.tsconfig : undefined\n })\n ]\n };\n}\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgB,SAAS,UAAsB,EAAE,EAAc;AAC7D,QAAO;EACL,GAAG;EACH,OAAO,QAAQ;EACf,SAAS,CACPA,yBAAS;GACP,MAAM,QAAQ;GACd,MAAM,QAAQ,OAAO,QAAQ,KAAK;GAClC,QAAQ;IACN,MAAM,QAAQ;IACd,iFACE,QAAQ,OACT;IACD,MAAM;KACJ,MAAM,QAAQ;KACd,8CAAgB,QAAQ,KAAK,CAC1B,KAAI,SAAQ;AACX,UAAI,CAAC,KACH;AAGF,6DAAgB,KAAK,CACnB,QAAO;AAGT,0DAAe,KAAK,EAAE;AAEpB,eAAQ,KACN,+DACD;AAED;;AAGF,aAAO;OACL,OAAO,KAAK;OACZ,QAAQ,KAAK;OACd;OACD,CACD,OAAO,QAAQ;KACnB;IACF;GACD,SAAS;IACP,UAAU,QAAQ,iDACL,QAAQ,SAAS,CACvB,KAAI,aAAY;AACf,yDAAe,SAAS,EAAE;AAExB,cAAQ,KACN,mEACD;AAED;;AAGF,YAAO;MACP,CACD,OAAO,QAAQ,GAClB;IACJ,YAAY,QAAQ,mDACP,QAAQ,WAAW,CACzB,KAAI,eAAc;AACjB,yDAAe,WAAW,EAAE;AAE1B,cAAQ,KACN,qEACD;AAED;;AAGF,YAAO;MACP,CACD,OAAO,QAAQ,GAClB;IACL;GACD,UAAU,QAAQ;GAClB,6DAAsB,QAAQ,SAAS,GAAG,QAAQ,WAAW;GAC9D,CAAC,CACH;EACF"}
|
package/dist/tsup.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsup.cjs","names":["esbuild"],"sources":["../src/tsup.ts"],"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 { omit } from \"@stryke/helpers/omit\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { Options } from \"tsup\";\nimport esbuild from \"./esbuild\";\n\nexport { default as plugin, default as tsup } from \"@powerlines/plugin-tsup\";\n\n/**\n * A Tsup configuration function that integrates Powerlines into the build process.\n *\n * @see https://tsup.egoist.dev/#/config\n *\n * @example\n * ```ts\n * // tsup.config.ts\n * import withPowerlines from \"powerlines/tsup\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsup options to merge with the Powerlines configuration.\n * @returns The merged Tsup configuration options.\n */\nexport function unplugin(options: Options = {}): Options {\n return {\n ...options,\n esbuildPlugins: [\n esbuild({\n output: {\n path: options.outDir,\n format: options.format\n },\n esbuild: {\n ...omit(options, [\n \"plugins\",\n \"banner\",\n \"footer\",\n \"outExtension\",\n \"outDir\",\n \"format\",\n \"minify\",\n \"pure\",\n \"inject\"\n ]),\n minify: Boolean(options.minify),\n pure: Array.isArray(options.pure)\n ? options.pure\n : isString(options.pure)\n ? [options.pure]\n : []\n }\n })\n ]\n };\n}\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,SAAS,UAAmB,EAAE,EAAW;AACvD,QAAO;EACL,GAAG;EACH,gBAAgB,CACdA,wBAAQ;GACN,QAAQ;IACN,MAAM,QAAQ;IACd,QAAQ,QAAQ;IACjB;GACD,SAAS;IACP,kCAAQ,SAAS;KACf;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CAAC;IACF,QAAQ,QAAQ,QAAQ,OAAO;IAC/B,MAAM,MAAM,QAAQ,QAAQ,KAAK,GAC7B,QAAQ,mDACC,QAAQ,KAAK,GACpB,CAAC,QAAQ,KAAK,GACd,EAAE;IACT;GACF,CAAC,CACH;EACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-9O-s0Fpu.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
|
package/dist/unloader.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.cjs","names":["createUnpluginFactory"],"sources":["../src/unloader.ts"],"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 { createUnloaderPlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\n/**\n * An Unloader plugin that will invoke the Powerlines API hooks during processing.\n *\n * @example\n * ```ts\n * // unloader.config.js\n * import powerlines from \"powerlines/unloader\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const unloader = createUnloaderPlugin(createUnpluginFactory(\"unloader\"));\n\nexport default unloader;\nexport { unloader as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,8CAAgCA,uCAAsB,WAAW,CAAC"}
|
package/dist/unplugin.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.cjs","names":["LogLevelLabel","PowerlinesAPI"],"sources":["../src/unplugin.ts"],"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\n/* -------------------------------------------------------------------\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 type {\n API,\n Context,\n UnpluginBuilderVariant,\n UnpluginFactory,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport { createLog } from \"@powerlines/core/lib/logger\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { LoadResult } from \"rolldown\";\nimport type {\n UnpluginOptions as BaseUnpluginOptions,\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { PowerlinesAPI } from \"./api\";\n\nexport * from \"@powerlines/core/lib/unplugin\";\n\n/**\n * Creates a Powerlines unplugin factory that generates a plugin instance.\n *\n * @param variant - The build variant for which to create the unplugin.\n * @param decorate - An optional function to decorate the unplugin options.\n * @returns The unplugin factory that generates a plugin instance.\n */\nexport function createUnpluginFactory<\n TContext extends Context,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n variant: TUnpluginBuilderVariant,\n decorate?: (\n api: API<TContext[\"config\"]>,\n plugin: UnpluginOptions<TContext>\n ) => BaseUnpluginOptions\n): UnpluginFactory<TContext> {\n return (config, meta): UnpluginOptions<TContext> => {\n const log = createLog(\"unplugin\", config);\n log(LogLevelLabel.DEBUG, \"Initializing Unplugin\");\n\n try {\n const userConfig = {\n ...config,\n variant,\n unplugin: meta\n } as TContext[\"config\"][\"userConfig\"];\n\n let api!: API<TContext[\"config\"]>;\n\n async function buildStart(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n\n api = await PowerlinesAPI.from(\n getWorkspaceRoot(process.cwd()),\n userConfig\n );\n setParseImpl(api.context.parse);\n\n log(\n LogLevelLabel.DEBUG,\n \"Preparing build artifacts for the Powerlines project...\"\n );\n\n await api.prepare({\n command: \"build\"\n });\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n options: {\n isEntry: boolean;\n } = { isEntry: false }\n ) {\n return api.context.resolve(id, importer, options);\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult> {\n const environment = await api.context.getEnvironment();\n\n let result = await api.callHook(\n \"load\",\n { environment, order: \"pre\" },\n id\n );\n if (result) {\n return result;\n }\n\n result = await api.callHook(\n \"load\",\n { environment, order: \"normal\" },\n id\n );\n if (result) {\n return result;\n }\n\n result = await environment.load(id);\n if (result) {\n return result;\n }\n\n return api.callHook(\"load\", { environment, order: \"post\" }, id);\n }\n\n async function transform(\n code: string,\n id: string\n ): Promise<TransformResult> {\n return api.callHook(\n \"transform\",\n {\n environment: await api.context.getEnvironment(),\n result: \"merge\",\n asNextParam: previousResult => getString(previousResult)\n },\n getString(code),\n id\n );\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n await api.callHook(\"writeBundle\", {\n environment: await api.context.getEnvironment()\n });\n }\n\n const options = {\n name: \"powerlines\",\n api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/, /^storm:/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n writeBundle\n } as UnpluginOptions<TContext>;\n\n const result = decorate ? decorate(api, options) : options;\n\n log(LogLevelLabel.DEBUG, \"Unplugin initialized successfully.\");\n\n return { api, ...result };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkEA,SAAgB,sBAKd,SACA,UAI2B;AAC3B,SAAQ,QAAQ,SAAoC;EAClD,MAAM,iDAAgB,YAAY,OAAO;AACzC,MAAIA,iDAAc,OAAO,wBAAwB;AAEjD,MAAI;GACF,MAAM,aAAa;IACjB,GAAG;IACH;IACA,UAAU;IACX;GAED,IAAI;GAEJ,eAAe,aAAsD;AACnE,QAAIA,iDAAc,OAAO,sCAAsC;AAE/D,UAAM,MAAMC,0BAAc,yDACP,QAAQ,KAAK,CAAC,EAC/B,WACD;AACD,+BAAa,IAAI,QAAQ,MAAM;AAE/B,QACED,iDAAc,OACd,0DACD;AAED,UAAM,IAAI,QAAQ,EAChB,SAAS,SACV,CAAC;;GAGJ,eAAe,UAEb,IACA,UACA,UAEI,EAAE,SAAS,OAAO,EACtB;AACA,WAAO,IAAI,QAAQ,QAAQ,IAAI,UAAU,QAAQ;;GAGnD,eAAe,KAEb,IACqB;IACrB,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;IAEtD,IAAI,SAAS,MAAM,IAAI,SACrB,QACA;KAAE;KAAa,OAAO;KAAO,EAC7B,GACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,IAAI,SACjB,QACA;KAAE;KAAa,OAAO;KAAU,EAChC,GACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,YAAY,KAAK,GAAG;AACnC,QAAI,OACF,QAAO;AAGT,WAAO,IAAI,SAAS,QAAQ;KAAE;KAAa,OAAO;KAAQ,EAAE,GAAG;;GAGjE,eAAe,UACb,MACA,IAC0B;AAC1B,WAAO,IAAI,SACT,aACA;KACE,aAAa,MAAM,IAAI,QAAQ,gBAAgB;KAC/C,QAAQ;KACR,cAAa,6EAA4B,eAAe;KACzD,4DACS,KAAK,EACf,GACD;;GAGH,eAAe,cAA6B;AAC1C,QAAIA,iDAAc,OAAO,0CAA0C;AAEnE,UAAM,IAAI,SAAS,eAAe,EAChC,aAAa,MAAM,IAAI,QAAQ,gBAAgB,EAChD,CAAC;;GAGJ,MAAM,UAAU;IACd,MAAM;IACN;IACA,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,MAAM,UAAU,EAC3B,EACF;KACD,SAAS;KACV;IACD;IACA;IACA;IACD;GAED,MAAM,SAAS,WAAW,SAAS,KAAK,QAAQ,GAAG;AAEnD,OAAIA,iDAAc,OAAO,qCAAqC;AAE9D,UAAO;IAAE;IAAK,GAAG;IAAQ;WAClB,OAAO;AACd,OAAIA,iDAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM"}
|
package/dist/utils.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"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\nexport * from \"@powerlines/core/lib/entry\";\nexport * from \"@powerlines/core/lib/logger\";\nexport * from \"@powerlines/core/lib/utilities\";\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-BNy8T32w.cjs","names":["#isDisposed"],"sources":["../src/storage/base.ts","../src/storage/helpers.ts","../src/storage/file-system.ts","../src/storage/virtual.ts"],"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 { appendPath } from \"@stryke/path/append\";\nimport { correctPath } from \"@stryke/path/correct-path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport { resolve } from \"node:path\";\nimport type { Context, StorageAdapter, StoragePreset } from \"../types\";\n\nexport interface StorageAdapterOptions {\n base: string;\n isReadOnly?: boolean;\n ignore?: string | string[];\n}\n\n/**\n * Abstract base class for storage adapters, providing a template for storage operations.\n */\nexport abstract class BaseStorageAdapter<\n TOptions extends StorageAdapterOptions = StorageAdapterOptions\n> implements StorageAdapter {\n /**\n * Indicates whether the storage adapter has been disposed.\n */\n #isDisposed = false;\n\n /**\n * A name identifying the storage adapter type.\n */\n public abstract name: string;\n\n /**\n * Configuration options for the storage adapter.\n */\n public options: TOptions;\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public readonly preset?: StoragePreset | null = null;\n\n /**\n * Constructor for the BaseStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(\n protected context: Context,\n options: TOptions = { base: \"/\" } as TOptions\n ) {\n this.options = options;\n this.options.base = resolve(options.base);\n this.options.isReadOnly = !!options.isReadOnly;\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public abstract existsSync(key: string): boolean;\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public async exists(key: string): Promise<boolean> {\n return this.existsSync(key);\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public abstract getSync(key: string): string | null;\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public async get(key: string): Promise<string | null> {\n return this.getSync(key);\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public abstract setSync(key: string, value: string): void;\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public async set(key: string, value: string): Promise<void> {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.setSync(key, value);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param _ - The path of the directory to create.\n */\n public mkdirSync(_: string) {}\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public async mkdir(dirPath: string): Promise<void> {\n return Promise.resolve(this.mkdirSync(dirPath));\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public abstract removeSync(key: string): void;\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public async remove(key: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n this.removeSync(key);\n }\n }\n\n /**\n * Synchronously removes all entries from the storage that match the provided base path.\n *\n * @param base - The base path to clear keys from.\n */\n public clearSync(base?: string) {\n if (!this.isReadOnly && this.overwrite) {\n const keys = this.listSync(base || this.options.base);\n if (!keys.length) {\n return;\n }\n\n keys.map(key =>\n this.removeSync(\n base && !key.startsWith(base) ? joinPaths(base, key) : key\n )\n );\n }\n }\n\n /**\n * Asynchronously removes all entries from the storage that match the provided base path.\n *\n * @param base - The base path to clear keys from.\n * @returns A promise that resolves when the operation is complete.\n */\n public async clear(base?: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n const keys = await this.list(base || this.options.base);\n if (!keys.length) {\n return;\n }\n\n await Promise.all(\n keys.map(async key =>\n this.remove(\n base && !key.startsWith(base) ? joinPaths(base, key) : key\n )\n )\n );\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public abstract listSync(base?: string): string[];\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public async list(base?: string): Promise<string[]> {\n return this.listSync(base);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param _ - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public isDirectorySync(_: string): boolean {\n return false;\n }\n\n /**\n * Checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.\n */\n public async isDirectory(key: string) {\n return Promise.resolve(this.isDirectorySync(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public isFileSync(key: string): boolean {\n return this.existsSync(key) && !this.isDirectorySync(key);\n }\n\n /**\n * Checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.\n */\n public async isFile(key: string) {\n return Promise.resolve(this.isFileSync(key));\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public dispose(): MaybePromise<void> {\n return Promise.resolve();\n }\n\n /**\n * Async dispose method to clean up resources.\n *\n * @returns A promise that resolves when disposal is complete.\n */\n public async [Symbol.asyncDispose]() {\n return this._dispose();\n }\n\n /**\n * Determines if the storage adapter is read-only based on the provided options.\n *\n * @returns `true` if the storage adapter is read-only, otherwise `false`.\n */\n protected get isReadOnly() {\n return !!this.options.isReadOnly;\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected get overwrite() {\n return !this.isReadOnly && this.context.config.output.overwrite !== false;\n }\n\n /**\n * Resolves a given key to its full path within the storage adapter.\n *\n * @param key - The key to resolve.\n * @returns The resolved full path for the key.\n */\n protected resolve(key?: string) {\n if (!key) {\n return this.options.base;\n }\n\n if (/\\.\\.:|\\.\\.$/.test(key)) {\n throw new Error(\n `[${this.name}]: Invalid key: ${JSON.stringify(key)} provided to storage adapter.`\n );\n }\n\n return appendPath(correctPath(key).replace(/:/g, \"/\"), this.options.base);\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n protected async _dispose(): Promise<void> {\n if (!this.#isDisposed) {\n await Promise.resolve(this.dispose());\n this.#isDisposed = true;\n }\n }\n}\n","/* -------------------------------------------------------------------\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 { isError } from \"@stryke/type-checks/is-error\";\n\n/**\n * Checks if an error is a file system error.\n *\n * @param err - The error to check.\n * @returns `true` if the error is a file system error, otherwise `false`.\n */\nexport function isFileError(err: any) {\n return isError(err) && \"code\" in err && err.code;\n}\n\n/**\n * Ignores file not found errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file not found error, otherwise returns the error.\n */\nexport function ignoreNotfound(err: any) {\n return (\n isFileError(err) &&\n (err.code === \"ENOENT\" || err.code === \"EISDIR\" ? null : err)\n );\n}\n\n/**\n * Ignores file exists errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file exists error, otherwise returns the error.\n */\nexport function ignoreExists(err: any) {\n return isFileError(err) && err.code === \"EEXIST\" ? null : err;\n}\n","/* -------------------------------------------------------------------\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 { exists, existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, createDirectorySync } from \"@stryke/fs/helpers\";\nimport { isDirectory, isFile } from \"@stryke/fs/is-file\";\nimport { listFiles, listFilesSync } from \"@stryke/fs/list-files\";\nimport { readFile, readFileSync } from \"@stryke/fs/read-file\";\nimport { writeFile, writeFileSync } from \"@stryke/fs/write-file\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { unlinkSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport type { Context } from \"../types\";\nimport { getFileHeaderWarningText } from \"../utils\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\nimport { ignoreNotfound } from \"./helpers\";\n\nexport type SetSyncOptions = Parameters<typeof writeFileSync>[2];\nexport type SetOptions = Parameters<typeof writeFile>[2];\n\n/**\n * File system storage adapter implementation.\n */\nexport class FileSystemStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"file-system\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"fs\";\n\n /**\n * Constructor for the FileSystemStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return existsSync(this.resolve(key));\n }\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public override async exists(key: string): Promise<boolean> {\n return exists(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return readFileSync(this.resolve(key));\n }\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public override async get(key: string): Promise<string | null> {\n return readFile(this.resolve(key));\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly) {\n if (this.existsSync(this.resolve(key)) && !this.overwrite) {\n const existingValue = this.getSync(this.resolve(key));\n if (\n isSetString(existingValue) &&\n existingValue.includes(\n getFileHeaderWarningText(true, this.context.config.framework)\n )\n ) {\n return writeFileSync(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(true, this.context.config.framework),\n getFileHeaderWarningText(false, this.context.config.framework)\n )\n );\n }\n } else {\n return writeFileSync(this.resolve(key), value);\n }\n }\n }\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public override async set(key: string, value: string): Promise<void> {\n if (!this.isReadOnly) {\n if (this.existsSync(this.resolve(key)) && !this.overwrite) {\n const existingValue = await this.get(this.resolve(key));\n if (\n isSetString(existingValue) &&\n existingValue.includes(\n getFileHeaderWarningText(true, this.context.config.framework)\n )\n ) {\n return writeFile(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(true, this.context.config.framework),\n getFileHeaderWarningText(false, this.context.config.framework)\n )\n );\n }\n } else {\n return writeFile(this.resolve(key), value);\n }\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n try {\n return unlinkSync(this.resolve(key));\n } catch (err) {\n return ignoreNotfound(err);\n }\n }\n }\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public override async remove(key: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n return unlink(this.resolve(key)).catch(ignoreNotfound);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override mkdirSync(dirPath: string) {\n createDirectorySync(this.resolve(dirPath));\n }\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override async mkdir(dirPath: string): Promise<void> {\n await createDirectory(this.resolve(dirPath));\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n try {\n return listFilesSync(this.resolve(base), {\n ignore: this.options.ignore\n });\n } catch (err) {\n return ignoreNotfound(err) ?? [];\n }\n }\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public override async list(base?: string): Promise<string[]> {\n return listFiles(this.resolve(base), {\n ignore: this.options.ignore\n })\n .catch(ignoreNotfound)\n .then(r => r || []);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public override isDirectorySync(key: string): boolean {\n return isDirectory(this.resolve(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public override isFileSync(key: string): boolean {\n return isFile(this.resolve(key));\n }\n}\n","/* -------------------------------------------------------------------\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 { isParentPath } from \"@stryke/path/is-parent-path\";\nimport type { Context } from \"../types\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\n\n/**\n * Virtual/in-memory storage adapter implementation.\n */\nexport class VirtualStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"virtual\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"virtual\";\n\n /**\n * In-memory data storage.\n */\n protected data = new Map<string, any>();\n\n /**\n * Constructor for the VirtualStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return this.data.has(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return this.data.get(this.resolve(key)) ?? null;\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.data.set(this.resolve(key), value);\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n this.data.delete(this.resolve(key));\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n return [\n ...this.data\n .keys()\n .filter(key => (!base ? true : isParentPath(key, this.resolve(base))))\n ];\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public override async dispose(): Promise<void> {\n return this.clear();\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected override get overwrite() {\n return !this.isReadOnly;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAsB,qBAAtB,MAE4B;;;;CAI1B,cAAc;;;;CAUd,AAAO;;;;;;;CAQP,AAAgB,SAAgC;;;;;;;CAQhD,AAAO,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AAI,KAAkB;;;;;;;CAQvC,AAAO,YAAY,SAAkB,SAAiC;AACpE,QAAM,SAAS,QAAQ;;;;;;;;CASzB,AAAO,WAAW,KAAsB;AACtC,SAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,CAAC;;;;;;;;CASzC,AAAO,QAAQ,KAA4B;AACzC,SAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI;;;;;;;;CAS7C,AAAO,QAAQ,KAAa,OAAe;AACzC,MAAI,CAAC,KAAK,eAAe,CAAC,KAAK,WAAW,IAAI,IAAI,KAAK,WACrD,MAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,EAAE,MAAM;;;;;;;CAS3C,AAAO,WAAW,KAAa;AAC7B,MAAI,CAAC,KAAK,cAAc,KAAK,UAC3B,MAAK,KAAK,OAAO,KAAK,QAAQ,IAAI,CAAC;;;;;;;;CAUvC,AAAO,SAAS,MAAyB;AACvC,SAAO,CACL,GAAG,KAAK,KACL,MAAM,CACN,QAAO,QAAQ,CAAC,OAAO,qDAAoB,KAAK,KAAK,QAAQ,KAAK,CAAC,CAAE,CACzE;;;;;;;CAQH,MAAsB,UAAyB;AAC7C,SAAO,KAAK,OAAO;;;;;;;CAQrB,IAAuB,YAAY;AACjC,SAAO,CAAC,KAAK"}
|
package/dist/vite.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite.cjs","names":["unplugin","createUnpluginFactory"],"sources":["../src/vite.ts"],"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 { resolveOptions } from \"@powerlines/plugin-vite/helpers/resolve-options\";\nimport {\n ViteOptions,\n VitePluginUserConfig\n} from \"@powerlines/plugin-vite/types\";\nimport { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport { default as plugin, default as vite } from \"@powerlines/plugin-vite\";\n\n/**\n * A Vite plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import powerlines from \"powerlines/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const unplugin = createVitePlugin<Partial<VitePluginUserConfig>>(\n createUnpluginFactory(\"vite\", (api, plugin) => {\n return {\n ...plugin,\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(options) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:hotUpdate\", { environment }, options);\n },\n async config(config, env) {\n api.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await api.context.getEnvironment();\n const result = await api.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(api.context),\n // Need to use `any` here to avoid excessive type complexity\n result?.build ?? {},\n config\n ) as Omit<ViteOptions, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await api.context.getEnvironment();\n\n await api.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:configureServer\", { environment }, server);\n },\n async configurePreviewServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:handleHotUpdate\", { environment }, ctx);\n }\n }\n };\n })\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAaA,4CACXC,uCAAsB,SAAS,KAAK,WAAW;AAC7C,QAAO;EACL,GAAG;EACH,MAAM;GACJ,mBAAmB;GAEnB,MAAM,UAAU,SAAS;IACvB,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SAAS,kBAAkB,EAAE,aAAa,EAAE,QAAQ;;GAEjE,MAAM,OAAO,QAAQ,KAAK;AACxB,QAAI,QAAQ,OAAO,6DAAyB,IAAI,KAAK,GACjD,+DACW,IAAI,KAAK,GAClB,SACA;IAEN,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;IACtD,MAAM,SAAS,MAAM,IAAI,SACvB,eACA,EAAE,aAAa,EACf,QACA,IACD;AAED,iGACiB,IAAI,QAAQ,EAE3B,QAAQ,SAAS,EAAE,EACnB,OACD;;GAEH,MAAM,eAAe,SAAS;IAC5B,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,UAAM,IAAI,SAAS,kBAAkB,EAAE,aAAa,CAAC;;GAEvD,MAAM,gBAAgB,QAAQ;IAC5B,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SAAS,wBAAwB,EAAE,aAAa,EAAE,OAAO;;GAEtE,MAAM,uBAAuB,QAAQ;IACnC,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SACT,+BACA,EAAE,aAAa,EACf,OACD;;GAEH,MAAM,mBAAmB,MAAM,KAAK;IAClC,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SACT,2BACA,EAAE,aAAa,EACf,MACA,IACD;;GAEH,MAAM,gBAAgB,KAAK;IACzB,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SAAS,wBAAwB,EAAE,aAAa,EAAE,IAAI;;GAEpE;EACF;EACD,CACH"}
|
package/dist/webpack.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.cjs","names":["unplugin","createUnpluginFactory"],"sources":["../src/webpack.ts"],"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 { WebpackPluginUserConfig } from \"@powerlines/plugin-webpack/types/plugin\";\nimport { createWebpackPlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport {\n default as plugin,\n default as webpack\n} from \"@powerlines/plugin-webpack\";\n\n/**\n * An Webpack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture\n *\n * @example\n * ```js\n * // webpack.config.js\n * import powerlines from \"powerlines/webpack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const unplugin = createWebpackPlugin<Partial<WebpackPluginUserConfig>>(\n createUnpluginFactory(\"webpack\")\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaA,+CACXC,uCAAsB,UAAU,CACjC"}
|