powerlines 0.30.8 → 0.30.10
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.cjs +2 -3
- package/dist/api.js +1 -2
- package/dist/astro.cjs +4 -5
- package/dist/astro.js +3 -4
- package/dist/{chunk-LZALJGUI.js → chunk-7GYPWBEP.js} +3 -3
- package/dist/chunk-DJVETZWM.js +7 -0
- package/dist/chunk-F7QESYUW.cjs +12 -0
- package/dist/chunk-GGJUF3OS.cjs +10 -0
- package/dist/{chunk-JZXHHXYN.js → chunk-IDLTP3CA.js} +12 -10
- package/dist/{chunk-I2JETGOV.cjs → chunk-JCQNCKL6.cjs} +12 -10
- package/dist/{chunk-N4G223DZ.js → chunk-LAAYAZCS.js} +3 -3
- package/dist/chunk-QCTZQ37E.cjs +12 -0
- package/dist/{chunk-4NBDS6NP.cjs → chunk-TGULIA3I.cjs} +5 -5
- package/dist/{chunk-J6EQ3W5E.cjs → chunk-TLNZXWBF.cjs} +4 -4
- package/dist/{chunk-NT23SCZY.js → chunk-XSHI4YXA.js} +3 -3
- package/dist/{chunk-FSZLSPRZ.js → chunk-Y6BHFF2K.js} +3 -3
- package/dist/{chunk-Q5264YFH.js → chunk-YRYNUZMV.js} +3 -3
- package/dist/{chunk-2GKLJTIZ.cjs → chunk-Z2YRWYQH.cjs} +4 -4
- package/dist/esbuild.cjs +6 -7
- package/dist/esbuild.js +3 -4
- package/dist/farm.cjs +3 -4
- package/dist/farm.js +2 -3
- package/dist/index.cjs +18 -22
- package/dist/index.js +3 -3
- package/dist/lib/{api-DajcXmYN.d.ts → api-BZmSz-33.d.ts} +1 -1
- package/dist/lib/{api-DNuawr-4.d.cts → api-DUNpZZaT.d.cts} +1 -1
- package/dist/lib/build/esbuild.d.cts +2 -2
- package/dist/lib/build/esbuild.d.ts +2 -2
- package/dist/lib/build/index.cjs +5 -5
- package/dist/lib/build/index.d.cts +4 -4
- package/dist/lib/build/index.d.ts +4 -4
- package/dist/lib/build/index.js +1 -1
- package/dist/lib/build/rolldown.d.cts +2 -2
- package/dist/lib/build/rolldown.d.ts +2 -2
- package/dist/lib/build/rollup.d.cts +2 -2
- package/dist/lib/build/rollup.d.ts +2 -2
- package/dist/lib/build/rspack.d.cts +2 -2
- package/dist/lib/build/rspack.d.ts +2 -2
- package/dist/lib/build/tsdown.cjs +5 -5
- package/dist/lib/build/tsdown.d.cts +2 -2
- package/dist/lib/build/tsdown.d.ts +2 -2
- package/dist/lib/build/tsdown.js +1 -1
- package/dist/lib/build/tsup.d.cts +2 -2
- package/dist/lib/build/tsup.d.ts +2 -2
- package/dist/lib/build/unbuild.d.cts +4 -4
- package/dist/lib/build/unbuild.d.ts +4 -4
- package/dist/lib/build/vite.d.cts +2 -2
- package/dist/lib/build/vite.d.ts +2 -2
- package/dist/lib/build/webpack.d.cts +2 -2
- package/dist/lib/build/webpack.d.ts +2 -2
- package/dist/lib/{chunk-S2F75YZK.js → chunk-5FVICSI2.js} +6 -5
- package/dist/lib/chunk-5FVICSI2.js.map +1 -0
- package/dist/lib/{chunk-Q7V66FH3.cjs → chunk-5KOLVUSY.cjs} +9 -8
- package/dist/lib/chunk-5KOLVUSY.cjs.map +1 -0
- package/dist/lib/{chunk-A7JRCJK2.cjs → chunk-75KYTRYW.cjs} +12 -12
- package/dist/lib/{chunk-A7JRCJK2.cjs.map → chunk-75KYTRYW.cjs.map} +1 -1
- package/dist/lib/{chunk-2OMOKN7Y.cjs → chunk-CLLQO726.cjs} +8 -7
- package/dist/lib/chunk-CLLQO726.cjs.map +1 -0
- package/dist/lib/{chunk-LJJDCMJM.js → chunk-D7GUAMYL.js} +4 -4
- package/dist/lib/{chunk-LJJDCMJM.js.map → chunk-D7GUAMYL.js.map} +1 -1
- package/dist/lib/{chunk-NAX6YQ7E.cjs → chunk-KLRDCXEP.cjs} +3 -3
- package/dist/lib/{chunk-NAX6YQ7E.cjs.map → chunk-KLRDCXEP.cjs.map} +1 -1
- package/dist/lib/{chunk-RNSQODBR.js → chunk-NXUMUI2Z.js} +3 -10
- package/dist/lib/chunk-NXUMUI2Z.js.map +1 -0
- package/dist/lib/{chunk-HTZ4V4L7.cjs → chunk-Q2CL3VW4.cjs} +16 -15
- package/dist/lib/chunk-Q2CL3VW4.cjs.map +1 -0
- package/dist/lib/{chunk-YQQPMY35.js → chunk-QOTSQ6ZF.js} +7 -6
- package/dist/lib/chunk-QOTSQ6ZF.js.map +1 -0
- package/dist/lib/{chunk-2HAOX4Q2.cjs → chunk-UWOD2XLX.cjs} +3 -10
- package/dist/lib/chunk-UWOD2XLX.cjs.map +1 -0
- package/dist/lib/{chunk-7CDTHZ3R.js → chunk-VN2OA25X.js} +6 -5
- package/dist/lib/chunk-VN2OA25X.js.map +1 -0
- package/dist/lib/{chunk-MOFTDKP2.js → chunk-WOQDW3EX.js} +3 -3
- package/dist/lib/{chunk-MOFTDKP2.js.map → chunk-WOQDW3EX.js.map} +1 -1
- package/dist/lib/{config-1l-NWS6B.d.cts → config-C6f56gi9.d.cts} +1 -1
- package/dist/lib/{config-DQPVzA4A.d.ts → config-Fp7jibtY.d.ts} +1 -1
- package/dist/lib/config-file.d.cts +2 -2
- package/dist/lib/config-file.d.ts +2 -2
- package/dist/lib/contexts/api-context.cjs +5 -5
- package/dist/lib/contexts/api-context.d.cts +4 -4
- package/dist/lib/contexts/api-context.d.ts +4 -4
- package/dist/lib/contexts/api-context.js +4 -4
- package/dist/lib/contexts/context.cjs +3 -3
- package/dist/lib/contexts/context.d.cts +5 -5
- package/dist/lib/contexts/context.d.ts +5 -5
- package/dist/lib/contexts/context.js +2 -2
- package/dist/lib/contexts/environment-context.cjs +4 -4
- package/dist/lib/contexts/environment-context.d.cts +4 -4
- package/dist/lib/contexts/environment-context.d.ts +4 -4
- package/dist/lib/contexts/environment-context.js +3 -3
- package/dist/lib/contexts/index.cjs +7 -7
- package/dist/lib/contexts/index.d.cts +4 -4
- package/dist/lib/contexts/index.d.ts +4 -4
- package/dist/lib/contexts/index.js +4 -4
- package/dist/lib/contexts/plugin-context.d.cts +4 -4
- package/dist/lib/contexts/plugin-context.d.ts +4 -4
- package/dist/lib/entry.d.cts +2 -2
- package/dist/lib/entry.d.ts +2 -2
- package/dist/lib/fs/index.cjs +2 -2
- package/dist/lib/fs/index.d.cts +2 -2
- package/dist/lib/fs/index.d.ts +2 -2
- package/dist/lib/fs/index.js +1 -1
- package/dist/lib/fs/storage/base.d.cts +1 -1
- package/dist/lib/fs/storage/base.d.ts +1 -1
- package/dist/lib/fs/storage/file-system.d.cts +1 -1
- package/dist/lib/fs/storage/file-system.d.ts +1 -1
- package/dist/lib/fs/storage/index.d.cts +1 -1
- package/dist/lib/fs/storage/index.d.ts +1 -1
- package/dist/lib/fs/storage/virtual.d.cts +1 -1
- package/dist/lib/fs/storage/virtual.d.ts +1 -1
- package/dist/lib/fs/vfs.cjs +2 -2
- package/dist/lib/fs/vfs.d.cts +2 -2
- package/dist/lib/fs/vfs.d.ts +2 -2
- package/dist/lib/fs/vfs.js +1 -1
- package/dist/lib/{fs-abWbkR69.d.cts → fs-BAG-Ofs1.d.cts} +2 -5
- package/dist/lib/{fs-abWbkR69.d.ts → fs-BAG-Ofs1.d.ts} +2 -5
- package/dist/lib/index.cjs +10 -10
- package/dist/lib/index.d.cts +5 -5
- package/dist/lib/index.d.ts +5 -5
- package/dist/lib/index.js +5 -5
- package/dist/lib/{internal-Dq5WN0wv.d.cts → internal-CXi-inTj.d.cts} +2 -2
- package/dist/lib/{internal-CiGtbK1K.d.ts → internal-CgeJlAcu.d.ts} +2 -2
- package/dist/lib/logger.d.cts +2 -2
- package/dist/lib/logger.d.ts +2 -2
- package/dist/lib/typescript/import-transformer.d.cts +2 -2
- package/dist/lib/typescript/import-transformer.d.ts +2 -2
- package/dist/lib/typescript/index.d.cts +2 -2
- package/dist/lib/typescript/index.d.ts +2 -2
- package/dist/lib/typescript/ts-morph.d.cts +2 -2
- package/dist/lib/typescript/ts-morph.d.ts +2 -2
- package/dist/lib/unplugin/factory.cjs +6 -6
- package/dist/lib/unplugin/factory.d.cts +4 -4
- package/dist/lib/unplugin/factory.d.ts +4 -4
- package/dist/lib/unplugin/factory.js +5 -5
- package/dist/lib/unplugin/helpers.d.cts +2 -2
- package/dist/lib/unplugin/helpers.d.ts +2 -2
- package/dist/lib/unplugin/index.cjs +6 -6
- package/dist/lib/unplugin/index.d.cts +4 -4
- package/dist/lib/unplugin/index.d.ts +4 -4
- package/dist/lib/unplugin/index.js +5 -5
- package/dist/lib/unplugin/plugin.d.cts +4 -4
- package/dist/lib/unplugin/plugin.d.ts +4 -4
- package/dist/lib/{unplugin-D0_Lkr4u.d.cts → unplugin-BeguWiS6.d.cts} +2 -2
- package/dist/lib/{unplugin-DZ55zlz2.d.ts → unplugin-CK0n8Ng1.d.ts} +2 -2
- package/dist/lib/utilities/bundle.d.cts +2 -2
- package/dist/lib/utilities/bundle.d.ts +2 -2
- package/dist/lib/utilities/cache.d.cts +2 -2
- package/dist/lib/utilities/cache.d.ts +2 -2
- package/dist/lib/utilities/file-header.d.cts +2 -2
- package/dist/lib/utilities/file-header.d.ts +2 -2
- package/dist/lib/utilities/index.d.cts +2 -2
- package/dist/lib/utilities/index.d.ts +2 -2
- package/dist/lib/utilities/meta.d.cts +2 -2
- package/dist/lib/utilities/meta.d.ts +2 -2
- package/dist/lib/utilities/resolve.d.cts +2 -2
- package/dist/lib/utilities/resolve.d.ts +2 -2
- package/dist/lib/utilities/source-file.d.cts +2 -2
- package/dist/lib/utilities/source-file.d.ts +2 -2
- package/dist/lib/utilities/source-map.d.cts +2 -2
- package/dist/lib/utilities/source-map.d.ts +2 -2
- package/dist/lib/utilities/worker.d.cts +2 -2
- package/dist/lib/utilities/worker.d.ts +2 -2
- package/dist/lib/utilities/write-file.d.cts +2 -2
- package/dist/lib/utilities/write-file.d.ts +2 -2
- package/dist/next.cjs +4 -5
- package/dist/next.js +3 -4
- package/dist/nuxt.cjs +7 -8
- package/dist/nuxt.js +5 -6
- package/dist/plugin-utils/{context-C67e3ndi.d.ts → context-BKDpmw6M.d.cts} +1 -4
- package/dist/plugin-utils/{context-C67e3ndi.d.cts → context-BKDpmw6M.d.ts} +1 -4
- package/dist/plugin-utils/context-helpers.d.cts +1 -1
- package/dist/plugin-utils/context-helpers.d.ts +1 -1
- package/dist/plugin-utils/enforce.d.cts +1 -1
- package/dist/plugin-utils/enforce.d.ts +1 -1
- package/dist/plugin-utils/extend.d.cts +1 -1
- package/dist/plugin-utils/extend.d.ts +1 -1
- package/dist/plugin-utils/get-config-path.d.cts +1 -1
- package/dist/plugin-utils/get-config-path.d.ts +1 -1
- package/dist/plugin-utils/helpers.d.cts +1 -1
- package/dist/plugin-utils/helpers.d.ts +1 -1
- package/dist/plugin-utils/index.d.cts +1 -1
- package/dist/plugin-utils/index.d.ts +1 -1
- package/dist/plugin-utils/merge.d.cts +1 -1
- package/dist/plugin-utils/merge.d.ts +1 -1
- package/dist/plugin-utils/paths.d.cts +1 -1
- package/dist/plugin-utils/paths.d.ts +1 -1
- package/dist/rolldown.cjs +6 -7
- package/dist/rolldown.js +3 -4
- package/dist/rollup.cjs +3 -4
- package/dist/rollup.js +2 -3
- package/dist/rspack.cjs +3 -4
- package/dist/rspack.js +2 -3
- package/dist/tsdown.cjs +4 -5
- package/dist/tsdown.js +3 -4
- package/dist/tsup.cjs +4 -5
- package/dist/tsup.js +3 -4
- package/dist/types/fs.cjs +3 -7
- package/dist/types/fs.d.cts +2 -5
- package/dist/types/fs.d.ts +2 -5
- package/dist/types/fs.js +1 -1
- package/dist/types/index.cjs +9 -13
- package/dist/types/index.js +1 -1
- package/dist/unloader.cjs +3 -4
- package/dist/unloader.js +2 -3
- package/dist/unplugin.cjs +5 -6
- package/dist/unplugin.js +3 -4
- package/dist/vite.cjs +6 -7
- package/dist/vite.js +3 -4
- package/dist/webpack.cjs +6 -7
- package/dist/webpack.js +3 -4
- package/package.json +23 -23
- package/dist/chunk-3NYXGOKU.cjs +0 -12
- package/dist/chunk-575Z57QD.js +0 -12
- package/dist/chunk-SALASTMK.cjs +0 -16
- package/dist/chunk-W3KMSMT7.cjs +0 -12
- package/dist/lib/chunk-2HAOX4Q2.cjs.map +0 -1
- package/dist/lib/chunk-2OMOKN7Y.cjs.map +0 -1
- package/dist/lib/chunk-7CDTHZ3R.js.map +0 -1
- package/dist/lib/chunk-HTZ4V4L7.cjs.map +0 -1
- package/dist/lib/chunk-Q7V66FH3.cjs.map +0 -1
- package/dist/lib/chunk-RNSQODBR.js.map +0 -1
- package/dist/lib/chunk-S2F75YZK.js.map +0 -1
- package/dist/lib/chunk-YQQPMY35.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","createEnvironment","name","userConfig","defu","environments","title","titleCase","ssr","mainFields","build","platform","extensions","consumer","preview","port","open","strictPort","host","allowedHosts","cors","headers","undefined","createDefaultEnvironment","PowerlinesAPIContext","PowerlinesContext","from","workspaceRoot","config","context","loadWorkspaceConfig","root","withUserConfig","powerlinesPath","resolvePackage","Error","$$internal","value","environment","Object","values","log","createLog","plugins","workspaceConfig","init","Promise","all","toArray","keys","length","map","env","in","PowerlinesEnvironmentContext","fromConfig","isSetObject","inlineConfig","withInlineConfig","plugin","addPlugin","options","isHighPriority","push","getEnvironment","LogLevelLabel","DEBUG","chalk","bold","cyanBright","WARN","getEnvironmentSafe"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,SAAA;AAE5B,SAASC,iBAAAA,CACdC,MACAC,UAAAA,EAA4C;AAE5C,EAAA,OAAOC,sBACLD,UAAAA,CAAWE,YAAAA,GAAeH,IAAAA,CAAAA,IAAS,EAAC,EACpC;AACEA,IAAAA,IAAAA;AACAI,IAAAA,KAAAA,EAAOH,UAAAA,CAAWG,KAAAA,IAASC,mBAAAA,CAAUJ,UAAAA,CAAWD,IAAI,CAAA;IACpDM,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A,CACvB9B,yBAAyB,IAAA,CAAKK,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAGjD,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,mBAAAA,CAAcK,IAAAA,EACd,CAAA,mGAAA,EAAsGH,sBAAAA,CAAMC,IAAAA,CAAKC,UAAAA,CAC/G/B,WAAAA,EAAaA,WAAAA,CAAYpC,IAAAA,CAAAA,CAAAA,CACxB,CAAA;AAEP,IAAA;AAEA,IAAA,OAAOoC,WAAAA;AACT,EAAA;AAEA,EAAA,MAAaiC,mBACXrE,IAAAA,EAC0D;AAC1D,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,CAAK8D,cAAAA,CAAe9D,IAAAA,CAAAA;IACnC,CAAA,CAAA,MAAQ;AACN,MAAA,OAAOoB,MAAAA;AACT,IAAA;AACF,EAAA;AACF","file":"chunk-Q7V66FH3.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { APIContext, Context } from \"../../types/context\";\nimport { EnvironmentResolvedConfig } from \"../../types/resolved\";\n\nexport const DEFAULT_ENVIRONMENT = \"default\" as const;\n\nexport function createEnvironment<TContext extends Context = Context>(\n name: string,\n userConfig: TContext[\"config\"][\"userConfig\"]\n): EnvironmentResolvedConfig {\n return defu(\n userConfig.environments?.[name] ?? {},\n {\n name,\n title: userConfig.title || titleCase(userConfig.name),\n ssr: false,\n mainFields:\n userConfig.build?.platform === \"browser\"\n ? [\"browser\", \"module\", \"jsnext:main\", \"jsnext\"]\n : [\"module\", \"jsnext:main\", \"jsnext\"],\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"],\n consumer: userConfig.build?.platform === \"browser\" ? \"client\" : \"server\",\n preview:\n userConfig.build?.platform === \"browser\"\n ? {\n port: 5173,\n open: true,\n strictPort: false,\n // https: false,\n host: \"localhost\",\n allowedHosts: [\".\"],\n cors: true,\n headers: {}\n }\n : undefined\n },\n userConfig\n ) as EnvironmentResolvedConfig;\n}\n\nexport function createDefaultEnvironment<\n TContext extends APIContext = APIContext\n>(userConfig: TContext[\"config\"][\"userConfig\"]): EnvironmentResolvedConfig {\n return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);\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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport chalk from \"chalk\";\nimport {\n createDefaultEnvironment,\n createEnvironment\n} from \"../../internal/helpers/environment\";\nimport {\n InitialUserConfig,\n InlineConfig,\n LogFn,\n UserConfig,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n APIContext,\n EnvironmentContext,\n InitContextOptions,\n PluginContext\n} from \"../../types/context\";\nimport {\n UNSAFE_ContextInternal,\n UNSAFE_EnvironmentContext\n} from \"../../types/internal\";\nimport { Plugin } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { loadWorkspaceConfig } from \"../config-file\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesAPIContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements APIContext<TResolvedConfig>\n{\n #environments: Record<string, UNSAFE_EnvironmentContext<TResolvedConfig>> =\n {};\n\n #plugins: Plugin<PluginContext<TResolvedConfig>>[] = [];\n\n #log!: LogFn;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static override async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<APIContext<TResolvedConfig>> {\n const context = new PowerlinesAPIContext<TResolvedConfig>(\n await loadWorkspaceConfig(workspaceRoot, config.root)\n );\n await context.withUserConfig(config);\n\n context.powerlinesPath = await resolvePackage(\"powerlines\");\n if (!context.powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n return context;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return super.$$internal;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override set $$internal(\n value: UNSAFE_ContextInternal<TResolvedConfig>\n ) {\n super.$$internal = value;\n for (const environment of Object.values(this.environments)) {\n environment.$$internal = super.$$internal;\n }\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n UNSAFE_EnvironmentContext<TResolvedConfig>\n > {\n return this.#environments;\n }\n\n public override get log(): LogFn {\n if (!this.#log) {\n this.#log = this.createLog(\"engine\");\n }\n\n return this.#log;\n }\n\n public get plugins(): Array<Plugin<PluginContext<TResolvedConfig>>> {\n return this.#plugins;\n }\n\n protected constructor(workspaceConfig: WorkspaceConfig) {\n super(workspaceConfig);\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @param config - The partial user configuration to use for initialization.\n */\n protected override async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {}\n ) {\n await super.init(config);\n\n await Promise.all(\n toArray(\n this.config.userConfig.environments &&\n Object.keys(this.config.userConfig.environments).length > 0\n ? Object.keys(this.config.userConfig.environments).map(name =>\n createEnvironment(name, this.config.userConfig)\n )\n : createDefaultEnvironment(this.config.userConfig)\n ).map(async env => {\n this.#environments[env.name] = await this.in(env);\n })\n );\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async in(\n environment: EnvironmentResolvedConfig\n ): Promise<UNSAFE_EnvironmentContext<TResolvedConfig>> {\n let context: UNSAFE_EnvironmentContext<TResolvedConfig>;\n if (this.environments[environment.name]) {\n context = this.environments[environment.name] as any;\n } else {\n context = (await PowerlinesEnvironmentContext.fromConfig(\n this.workspaceConfig,\n this.config\n )) as any;\n }\n\n if (isSetObject(this.config.inlineConfig)) {\n await context.withInlineConfig(this.config.inlineConfig);\n }\n\n context.environment = environment;\n context.plugins = [];\n\n for (const plugin of this.plugins) {\n await context.addPlugin(plugin);\n }\n\n return context;\n }\n\n /**\n * Update the context using a new user configuration options\n *\n * @param userConfig - The new user configuration options.\n */\n public override async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withUserConfig(userConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withUserConfig(\n userConfig as UserConfig,\n options\n );\n })\n );\n }\n\n /**\n * Update the context using a new inline configuration options\n *\n * @param inlineConfig - The new inline configuration options.\n */\n public override async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withInlineConfig(inlineConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withInlineConfig(\n inlineConfig as InlineConfig,\n options\n );\n })\n );\n }\n\n /**\n * Add a plugin to the API context and all environments\n *\n * @param plugin - The plugin to add.\n */\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n this.plugins.push(plugin);\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.addPlugin(plugin);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment: EnvironmentContext<TResolvedConfig> | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.log(\n LogLevelLabel.DEBUG,\n `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.in(\n createDefaultEnvironment(this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.WARN,\n `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n return environment;\n }\n\n public async getEnvironmentSafe(\n name?: string\n ): Promise<EnvironmentContext<TResolvedConfig> | undefined> {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../schemas/fs.ts","../../src/types/fs.ts","../../src/lib/fs/vfs.ts"],"names":["BigInt","FileMetadata_KeyValuePair","Struct","_capnp","displayName","id","size","ObjectSize","key","utils","getText","value","$","setText","toString","FileMetadata","KeyValuePair","defaultType","_Properties","type","timestamp","getUint32","setUint32","_adoptProperties","adopt","getPointer","_disownProperties","disown","properties","getList","_hasProperties","isNull","_initProperties","length","initList","copyFrom","FileId","path","FileStorage","code","FileSystem","_Ids","_Storage","_Metadata","_adoptIds","_disownIds","ids","_hasIds","_initIds","_adoptStorage","_disownStorage","storage","_hasStorage","_initStorage","_adoptMetadata","_disownMetadata","metadata","_hasMetadata","_initMetadata","CompositeList","StoragePreset","VirtualFileSystem","FileSystemStorageAdapter","normalized","isParentPath","builtinsPath","replacePath","normalizeId","config","output","builtinPrefix","normalizePath","includes","replacePathTokens","token","RegExp","replace","resolveSync","base","Object","keys","filter","Boolean","sort","reverse","relativeKey","adapter","includeParent","map","relativeBase","slice","undefined","create","context","skipCache","existsSync","joinPaths","dataPath","buffer","readFileBuffer","message","Message","fs","getRoot","result","Promise","all","values","file","write","initRoot","createSync","readFileBufferSync","writeSync","Proxy","get","target","prop","paths","resolverCache","cacheId","cacheDir","cachePath","ttl","lruSize","persistInterval","isSetObject","virtual","VirtualStorageAdapter","FS","artifactsPath","entryPath","reduce","ret","Date","now","item","identifier","extendLog","log","exists","isVirtual","resolved","name","isDirectorySync","isDirectory","resolve","isFileSync","isFile","listSync","getUnique","appendPath","flat","list","remove","normalizedPath","LogLevelLabel","TRACE","hasFileExtension","clear","removeSync","clearSync","glob","patterns","results","pattern","normalizeGlobPatterns","workspaceConfig","workspaceRoot","test","push","absPattern","isAbsolutePath","firstGlobIdx","search","baseDir","findFilePath","Math","max","lastIndexOf","globSync","files","copy","srcPath","destPath","src","URL","fileURLToPath","dest","isSetString","input","sourceStr","isString","source","content","read","skipFormat","copySync","readSync","findFileName","move","moveSync","forEach","filePath","getSync","data","options","resolvedConfig","resolveConfig","format","absolutePath","prettyBytes","Blob","toArray","meta","variant","set","setSync","mkdirSync","dirPath","mkdir","getMetadata","pathOrId","importer","resolverCacheKey","murmurhash","projectRoot","sourceRoot","tsconfig","tsconfigPath","startsWith","combination","getResolutionCombinations","dispose","DEBUG","index","fd","entries","fileId","fileMetadata","props","val","writeFileBuffer","toArrayBuffer","save","Symbol","asyncDispose"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK4BA,OAAO,oBAAA;AAC5B,IAAMC,yBAAAA,GAAN,cAA0CC,CAAAA,CAAAA,MAAAA,CAAM;EANvD;;;AAOE,EAAA,OAAgCC,MAAAA,GAAS;IACvCC,WAAAA,EAAa,cAAA;IACbC,EAAAA,EAAI,kBAAA;IACJC,IAAAA,EAAM,IAAMC,CAAAA,CAAAA,UAAAA,CAAW,CAAA,EAAG,CAAA;AAC5B,GAAA;AACA,EAAA,IAAIC,GAAAA,GAAc;AAChB,IAAA,OAASC,CAAAA,CAAAA,KAAAA,CAAMC,OAAAA,CAAQ,CAAA,EAAG,IAAI,CAAA;AAChC,EAAA;AACA,EAAA,IAAIF,IAAIG,KAAAA,EAAe;AACrBC,IAAEH,CAAAA,CAAAA,KAAAA,CAAMI,OAAAA,CAAQ,CAAA,EAAGF,KAAAA,EAAO,IAAI,CAAA;AAChC,EAAA;AACA,EAAA,IAAIA,KAAAA,GAAgB;AAClB,IAAA,OAASF,CAAAA,CAAAA,KAAAA,CAAMC,OAAAA,CAAQ,CAAA,EAAG,IAAI,CAAA;AAChC,EAAA;AACA,EAAA,IAAIC,MAAMA,KAAAA,EAAe;AACvBC,IAAEH,CAAAA,CAAAA,KAAAA,CAAMI,OAAAA,CAAQ,CAAA,EAAGF,KAAAA,EAAO,IAAI,CAAA;AAChC,EAAA;EACgBG,QAAAA,GAAmB;AAAE,IAAA,OAAO,4BAAA,GAA+B,MAAMA,QAAAA,EAAAA;AAAY,EAAA;AAC/F,CAAA;AAKO,IAAMC,YAAAA,GAAN,MAAMA,aAAAA,SAAuBb,CAAAA,CAAAA,MAAAA,CAAM;EA9B1C;;;AA+BE,EAAA,OAAgBc,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AACnC,QAAA,IAAA,CAAK,cAAA,CAAesJ,KAAK,IAAA,CAAA;AAC3B,MAAA;AAEA,MAAA,MAAM3I,OAAAA,CAAQC,GAAAA,CACZ,IAAA,CAAK,YAAA,EAAY,CAAGlB,GAAAA,CAAI,OAAMrC,QAAAA,KAAWA,QAAAA,CAAQmC,OAAAA,CAAQmJ,OAAAA,EAAO,CAAA,CAAA;AAGlE,MAAA,IAAA,CAAK,IAAA,CAAK7E,aAAAA,CAAcC,KAAAA,EAAO,wCAAA,CAAA;AACjC,IAAA;AACF,EAAA;;;;;;;;;;;;;;;;;;;;;;;;EA4BA,OAAOwF,MAAAA,CAAOC,YAAY,CAAA,GAAI;AAC5B,IAAA,OAAO,KAAKb,OAAAA,EAAO;AACrB,EAAA;AACF","file":"chunk-RNSQODBR.js","sourcesContent":["/* eslint-disable */\n// biome-ignore lint: disable\n// Generated by storm-capnpc\n// Note: Do not edit this file manually - it will be overwritten automatically\nimport * as $ from \"@stryke/capnp\";\nexport const _capnpFileId = BigInt(\"0xa56c61324b9d6e49\");\nexport class FileMetadata_KeyValuePair extends $.Struct {\n public static override readonly _capnp = {\n displayName: \"KeyValuePair\",\n id: \"eabb26cf58b2a14c\",\n size: new $.ObjectSize(0, 2),\n };\n get key(): string {\n return $.utils.getText(0, this);\n }\n set key(value: string) {\n $.utils.setText(0, value, this);\n }\n get value(): string {\n return $.utils.getText(1, this);\n }\n set value(value: string) {\n $.utils.setText(1, value, this);\n }\n public override toString(): string { return \"FileMetadata_KeyValuePair_\" + super.toString(); }\n}\n/**\n* The identifier for the file data.\n*\n*/\nexport class FileMetadata extends $.Struct {\n static readonly KeyValuePair = FileMetadata_KeyValuePair;\n public static override readonly _capnp = {\n displayName: \"FileMetadata\",\n id: \"8e2cab5d7e28c7b3\",\n size: new $.ObjectSize(8, 3),\n defaultType: \"normal\"\n };\n static _Properties: $.ListCtor<FileMetadata_KeyValuePair>;\n /**\n* The type of the file.\n*\n*/\n get id(): string {\n return $.utils.getText(0, this);\n }\n set id(value: string) {\n $.utils.setText(0, value, this);\n }\n /**\n* The timestamp representing the file's creation date.\n*\n*/\n get type(): string {\n return $.utils.getText(1, this, FileMetadata._capnp.defaultType);\n }\n set type(value: string) {\n $.utils.setText(1, value, this);\n }\n /**\n* Additional metadata associated with the file.\n*\n*/\n get timestamp(): number {\n return $.utils.getUint32(0, this);\n }\n set timestamp(value: number) {\n $.utils.setUint32(0, value, this);\n }\n _adoptProperties(value: $.Orphan<$.List<FileMetadata_KeyValuePair>>): void {\n $.utils.adopt(value, $.utils.getPointer(2, this));\n }\n _disownProperties(): $.Orphan<$.List<FileMetadata_KeyValuePair>> {\n return $.utils.disown(this.properties);\n }\n get properties(): $.List<FileMetadata_KeyValuePair> {\n return $.utils.getList(2, FileMetadata._Properties, this);\n }\n _hasProperties(): boolean {\n return !$.utils.isNull($.utils.getPointer(2, this));\n }\n _initProperties(length: number): $.List<FileMetadata_KeyValuePair> {\n return $.utils.initList(2, FileMetadata._Properties, length, this);\n }\n set properties(value: $.List<FileMetadata_KeyValuePair>) {\n $.utils.copyFrom(value, $.utils.getPointer(2, this));\n }\n public override toString(): string { return \"FileMetadata_\" + super.toString(); }\n}\n/**\n* An identifier for the file.\n*\n*/\nexport class FileId extends $.Struct {\n public static override readonly _capnp = {\n displayName: \"FileId\",\n id: \"990d6a471072f997\",\n size: new $.ObjectSize(0, 2),\n };\n /**\n* A virtual (or actual) path to the file in the file system.\n*\n*/\n get id(): string {\n return $.utils.getText(0, this);\n }\n set id(value: string) {\n $.utils.setText(0, value, this);\n }\n get path(): string {\n return $.utils.getText(1, this);\n }\n set path(value: string) {\n $.utils.setText(1, value, this);\n }\n public override toString(): string { return \"FileId_\" + super.toString(); }\n}\n/**\n* An identifier for the file.\n*\n*/\nexport class FileStorage extends $.Struct {\n public static override readonly _capnp = {\n displayName: \"FileStorage\",\n id: \"9dca66ac858c9ebe\",\n size: new $.ObjectSize(0, 2),\n };\n /**\n* A virtual (or actual) path to the file in the file system.\n*\n*/\n get path(): string {\n return $.utils.getText(0, this);\n }\n set path(value: string) {\n $.utils.setText(0, value, this);\n }\n get code(): string {\n return $.utils.getText(1, this);\n }\n set code(value: string) {\n $.utils.setText(1, value, this);\n }\n public override toString(): string { return \"FileStorage_\" + super.toString(); }\n}\nexport class FileSystem extends $.Struct {\n public static override readonly _capnp = {\n displayName: \"FileSystem\",\n id: \"ae0c23d43e56abcf\",\n size: new $.ObjectSize(0, 3),\n };\n static _Ids: $.ListCtor<FileId>;\n static _Storage: $.ListCtor<FileStorage>;\n static _Metadata: $.ListCtor<FileMetadata>;\n _adoptIds(value: $.Orphan<$.List<FileId>>): void {\n $.utils.adopt(value, $.utils.getPointer(0, this));\n }\n _disownIds(): $.Orphan<$.List<FileId>> {\n return $.utils.disown(this.ids);\n }\n get ids(): $.List<FileId> {\n return $.utils.getList(0, FileSystem._Ids, this);\n }\n _hasIds(): boolean {\n return !$.utils.isNull($.utils.getPointer(0, this));\n }\n _initIds(length: number): $.List<FileId> {\n return $.utils.initList(0, FileSystem._Ids, length, this);\n }\n set ids(value: $.List<FileId>) {\n $.utils.copyFrom(value, $.utils.getPointer(0, this));\n }\n _adoptStorage(value: $.Orphan<$.List<FileStorage>>): void {\n $.utils.adopt(value, $.utils.getPointer(1, this));\n }\n _disownStorage(): $.Orphan<$.List<FileStorage>> {\n return $.utils.disown(this.storage);\n }\n get storage(): $.List<FileStorage> {\n return $.utils.getList(1, FileSystem._Storage, this);\n }\n _hasStorage(): boolean {\n return !$.utils.isNull($.utils.getPointer(1, this));\n }\n _initStorage(length: number): $.List<FileStorage> {\n return $.utils.initList(1, FileSystem._Storage, length, this);\n }\n set storage(value: $.List<FileStorage>) {\n $.utils.copyFrom(value, $.utils.getPointer(1, this));\n }\n _adoptMetadata(value: $.Orphan<$.List<FileMetadata>>): void {\n $.utils.adopt(value, $.utils.getPointer(2, this));\n }\n _disownMetadata(): $.Orphan<$.List<FileMetadata>> {\n return $.utils.disown(this.metadata);\n }\n get metadata(): $.List<FileMetadata> {\n return $.utils.getList(2, FileSystem._Metadata, this);\n }\n _hasMetadata(): boolean {\n return !$.utils.isNull($.utils.getPointer(2, this));\n }\n _initMetadata(length: number): $.List<FileMetadata> {\n return $.utils.initList(2, FileSystem._Metadata, length, this);\n }\n set metadata(value: $.List<FileMetadata>) {\n $.utils.copyFrom(value, $.utils.getPointer(2, this));\n }\n public override toString(): string { return \"FileSystem_\" + super.toString(); }\n}\nFileMetadata._Properties = $.CompositeList(FileMetadata_KeyValuePair);\nFileSystem._Ids = $.CompositeList(FileId);\nFileSystem._Storage = $.CompositeList(FileStorage);\nFileSystem._Metadata = $.CompositeList(FileMetadata);\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 { ResolveOptions as BaseResolveOptions } from \"@stryke/fs/resolve\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport { AssetGlob } from \"@stryke/types/file\";\n\nexport type VirtualFileExtension = \"js\" | \"ts\" | \"jsx\" | \"tsx\";\n\n// eslint-disable-next-line ts/naming-convention\nexport const __VFS_PATCH__ = \"__VFS_PATCH__\";\n\n// eslint-disable-next-line ts/naming-convention\nexport const __VFS_REVERT__ = \"__VFS_REVERT__\";\n\nexport enum StoragePreset {\n VIRTUAL = \"virtual\",\n FS = \"fs\"\n}\n\n/**\n * Interface defining the methods and properties for a storage adapter.\n */\nexport interface StorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n name: string;\n\n /**\n * 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 exists: (key: string) => Promise<boolean>;\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 existsSync: (key: string) => boolean;\n\n /**\n * Read a value associated with a key from the storage.\n *\n * @param key - The key to read the value for.\n * @returns A promise that resolves to the value if found, otherwise `null`.\n */\n get: (key: string) => Promise<string | null>;\n\n /**\n * Synchronously reads the value associated with a key from the storage.\n *\n * @param key - The key to read the value for.\n * @returns The value if found, otherwise `null`.\n */\n getSync: (key: string) => string | null;\n\n /**\n * Writes a value to the storage for the given key.\n *\n * @param key - The key to associate the value with.\n * @param value - The value to store.\n */\n set: (key: string, value: string) => Promise<void>;\n\n /**\n * Synchronously writes a value to the storage for the given key.\n *\n * @param key - The key to associate the value with.\n * @param value - The value to store.\n */\n setSync: (key: string, value: string) => void;\n\n /**\n * Removes a value from the storage.\n *\n * @param key - The key whose value should be removed.\n */\n remove: (key: string) => Promise<void>;\n\n /**\n * Synchronously removes a value from the storage.\n *\n * @param key - The key whose value should be removed.\n */\n removeSync: (key: string) => void;\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdir: (dirPath: string) => Promise<void>;\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdirSync: (dirPath: string) => void;\n\n /**\n * Remove all entries from the storage that match the provided base path.\n *\n * @param base - The base path or prefix to clear entries from.\n */\n clear: (base?: string) => Promise<void>;\n\n /**\n * Synchronously remove all entries from the storage that match the provided base path.\n *\n * @param base - The base path or prefix to clear entries from.\n */\n clearSync: (base?: string) => void;\n\n /**\n * Lists all keys under the provided base path.\n *\n * @param base - The base path or prefix to list keys from.\n * @returns A promise resolving to the list of keys.\n */\n list: (base?: string) => Promise<string[]>;\n\n /**\n * Synchronously lists all keys under the provided base path.\n *\n * @param base - The base path or prefix to list keys from.\n * @returns The list of keys.\n */\n listSync: (base?: string) => string[];\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 isDirectory: (key: string) => Promise<boolean>;\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 isDirectorySync: (key: string) => boolean;\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 isFile: (key: string) => Promise<boolean>;\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 isFileSync: (key: string) => boolean;\n\n /**\n * Releases any resources held by the storage adapter.\n */\n dispose: () => MaybePromise<void>;\n}\n\n/**\n * A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.\n */\nexport type StoragePort = Record<string, StorageAdapter>;\n\nexport interface VirtualFileMetadata {\n /**\n * The identifier for the file data.\n */\n id: string;\n\n /**\n * The timestamp of the virtual file.\n */\n timestamp: number;\n\n /**\n * The type of the file.\n *\n * @remarks\n * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:\n * - `builtin`: Indicates that the file is a built-in module provided by the system.\n * - `entry`: Indicates that the file is an entry point for execution.\n * - `normal`: Indicates that the file is a standard file without any special role.\n */\n type: string;\n\n /**\n * Additional metadata associated with the file.\n */\n properties: Record<string, string>;\n}\n\nexport interface VirtualFileData {\n /**\n * The identifier for the file data.\n */\n id?: string;\n\n /**\n * The contents of the virtual file.\n */\n code: string;\n\n /**\n * The type of the file.\n *\n * @remarks\n * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:\n * - `builtin`: Indicates that the file is a built-in module provided by the system.\n * - `entry`: Indicates that the file is an entry point for execution.\n * - `normal`: Indicates that the file is a standard file without any special role.\n */\n type?: string;\n\n /**\n * Additional metadata associated with the file.\n */\n properties?: Record<string, string>;\n}\n\nexport interface VirtualFile\n extends Required<VirtualFileData>, VirtualFileMetadata {\n /**\n * An additional name for the file.\n */\n path: string;\n\n /**\n * The timestamp of the virtual file.\n */\n timestamp: number;\n}\n\nexport interface WriteOptions {\n /**\n * Should the file skip formatting before being written?\n *\n * @defaultValue false\n */\n skipFormat?: boolean;\n\n /**\n * Additional metadata for the file.\n */\n meta?: VirtualFileMetadata;\n}\n\nexport type WriteData = string | NodeJS.ArrayBufferView | VirtualFileData;\n\nexport interface ResolveOptions extends BaseResolveOptions {\n /**\n * If true, the module is being resolved as an entry point.\n */\n isEntry?: boolean;\n\n /**\n * If true, the resolver will skip using the cache when resolving modules.\n */\n skipCache?: boolean;\n\n /**\n * An array of external modules or patterns to exclude from resolution.\n */\n external?: (string | RegExp)[];\n\n /**\n * An array of modules or patterns to include in the resolution, even if they are marked as external.\n */\n noExternal?: (string | RegExp)[];\n\n /**\n * An array of patterns to match when resolving modules.\n */\n skipNodeModulesBundle?: boolean;\n}\n\nexport interface VirtualFileSystemInterface {\n /**\n * The underlying file metadata.\n */\n metadata: Readonly<Record<string, VirtualFileMetadata>>;\n\n /**\n * A map of file paths to their module ids.\n */\n ids: Readonly<Record<string, string>>;\n\n /**\n * A map of module ids to their file paths.\n */\n paths: Readonly<Record<string, string>>;\n\n /**\n * Checks if a file exists in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file exists, otherwise `false`.\n */\n exists: (path: string) => Promise<boolean>;\n\n /**\n * Synchronously Checks if a file exists in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file exists, otherwise `false`.\n */\n existsSync: (path: string) => boolean;\n\n /**\n * Checks if a file is virtual in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns `true` if the file is virtual, otherwise `false`.\n */\n isVirtual: (path: string) => boolean;\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 isDirectory: (key: string) => Promise<boolean>;\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 isDirectorySync: (key: string) => boolean;\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 isFile: (key: string) => Promise<boolean>;\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 isFileSync: (key: string) => boolean;\n\n /**\n * Gets the metadata of a file in the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns The metadata of the file if it exists, otherwise undefined.\n */\n getMetadata: (path: string) => VirtualFileMetadata | undefined;\n\n /**\n * Lists files in a given path.\n *\n * @param path - The path to list files from.\n * @returns An array of file names in the specified path.\n */\n listSync: (path: string) => string[];\n\n /**\n * Lists files in a given path.\n *\n * @param path - The path to list files from.\n * @returns An array of file names in the specified path.\n */\n list: (path: string) => Promise<string[]>;\n\n /**\n * Removes a file or symbolic link in the virtual file system (VFS).\n *\n * @param path - The path to the file to remove.\n * @returns A promise that resolves when the file is removed.\n */\n removeSync: (path: string) => void;\n\n /**\n * Asynchronously removes a file or symbolic link in the virtual file system (VFS).\n *\n * @param path - The path to the file to remove.\n * @returns A promise that resolves when the file is removed.\n */\n remove: (path: string) => Promise<void>;\n\n /**\n * Reads a file from the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n * @returns The contents of the file if it exists, otherwise undefined.\n */\n read: (path: string) => Promise<string | undefined>;\n\n /**\n * Reads a file from the virtual file system (VFS).\n *\n * @param path - The path or id of the file.\n */\n readSync: (path: string) => string | undefined;\n\n /**\n * Writes a file to the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @param data - The contents of the file.\n * @param options - Options for writing the file.\n * @returns A promise that resolves when the file is written.\n */\n write: (path: string, data: string, options?: WriteOptions) => Promise<void>;\n\n /**\n * Writes a file to the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @param data - The contents of the file.\n * @param options - Options for writing the file.\n */\n writeSync: (path: string, data: string, options?: WriteOptions) => void;\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdir: (dirPath: string) => Promise<void>;\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n mkdirSync: (dirPath: string) => void;\n\n /**\n * Moves a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to move\n * @param destPath - The destination path to move to\n */\n move: (srcPath: string, destPath: string) => Promise<void>;\n\n /**\n * Synchronously moves a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to move\n * @param destPath - The destination path to move to\n */\n moveSync: (srcPath: string, destPath: string) => void;\n\n /**\n * Copies a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to copy\n * @param destPath - The destination path to copy to\n */\n copy: (\n srcPath: string | URL | Omit<AssetGlob, \"output\">,\n destPath: string | URL\n ) => Promise<void>;\n\n /**\n * Synchronously copies a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to copy\n * @param destPath - The destination path to copy to\n */\n copySync: (\n srcPath: string | URL | Omit<AssetGlob, \"output\">,\n destPath: string | URL\n ) => void;\n\n /**\n * Glob files in the virtual file system (VFS) based on the provided pattern(s).\n *\n * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return\n * @returns An array of file paths matching the provided pattern(s)\n */\n glob: (\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n ) => Promise<string[]>;\n\n /**\n * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).\n *\n * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return\n * @returns An array of file paths matching the provided pattern(s)\n */\n globSync: (\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n ) => string[];\n\n /**\n * A helper function to resolve modules using the Jiti resolver\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolvedPath = await context.resolve(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns A promise that resolves to the resolved module path.\n */\n resolve: (\n id: string,\n importer?: string,\n options?: ResolveOptions\n ) => Promise<string | undefined>;\n\n /**\n * A synchronous helper function to resolve modules using the Jiti resolver\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolvedPath = context.resolveSync(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns The resolved module path.\n */\n resolveSync: (\n id: string,\n importer?: string,\n options?: ResolveOptions\n ) => string | undefined;\n\n /**\n * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.\n */\n dispose: () => Promise<void>;\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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport * as capnp from \"@stryke/capnp\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport {\n readFileBuffer,\n readFileBufferSync,\n writeFileBuffer\n} from \"@stryke/fs/buffer\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport {\n getResolutionCombinations,\n resolve,\n resolveSync\n} from \"@stryke/fs/resolve\";\nimport { murmurhash } from \"@stryke/hash/murmurhash\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport {\n findFileName,\n findFilePath,\n hasFileExtension\n} from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { prettyBytes } from \"@stryke/string-format/pretty-bytes\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { AssetGlob } from \"@stryke/types/file\";\nimport { create, FlatCache } from \"flat-cache\";\nimport { Blob } from \"node:buffer\";\nimport { fileURLToPath } from \"node:url\";\nimport { format, resolveConfig } from \"prettier\";\nimport { FileSystem } from \"../../../schemas/fs\";\nimport { replacePathTokens } from \"../../plugin-utils/paths\";\nimport { LogFn } from \"../../types/config\";\nimport { Context } from \"../../types/context\";\nimport {\n ResolveOptions,\n StorageAdapter,\n StoragePort,\n StoragePreset,\n VirtualFileMetadata,\n VirtualFileSystemInterface,\n WriteOptions\n} from \"../../types/fs\";\nimport { extendLog } from \"../logger\";\nimport { normalizeGlobPatterns, normalizeId, normalizePath } from \"./helpers\";\nimport { FileSystemStorageAdapter } from \"./storage/file-system\";\nimport { VirtualStorageAdapter } from \"./storage/virtual\";\n\ninterface StorageAdapterState {\n adapter: StorageAdapter;\n relativeKey: string;\n base: string;\n}\n\n/**\n * Represents a virtual file system (VFS) that stores files and their associated metadata in virtual memory.\n *\n * @remarks\n * This class provides methods to manage virtual files, check their existence, retrieve their content, and manipulate the virtual file system. It allows for efficient file management and retrieval without relying on the actual file system.\n */\nexport class VirtualFileSystem implements VirtualFileSystemInterface {\n /**\n * A map of virtual file IDs to their associated metadata.\n */\n #metadata: Record<string, VirtualFileMetadata>;\n\n /**\n * A map of virtual file IDs to their underlying file paths.\n */\n #ids: Record<string, string>;\n\n /**\n * A map of underlying file paths to their virtual file IDs.\n */\n #paths: Record<string, string>;\n\n /**\n * The unified volume that combines the virtual file system with the real file system.\n *\n * @remarks\n * This volume allows for seamless access to both virtual and real files.\n */\n #storage: StoragePort = { \"\": new FileSystemStorageAdapter() };\n\n /**\n * A cache for module resolution results.\n */\n #resolverCache!: FlatCache;\n\n /**\n * Indicator specifying if the virtual file system (VFS) is disposed\n */\n #isDisposed = false;\n\n /**\n * The context of the virtual file system.\n */\n #context: Context;\n\n /**\n * The file system's logging function.\n */\n #log: LogFn;\n\n /**\n * Normalizes a given module id by resolving it against the built-ins path.\n *\n * @param id - The module id to normalize.\n * @returns The normalized module id.\n */\n #normalizeId(id: string): string {\n let normalized = id;\n if (isParentPath(normalized, this.#context.builtinsPath)) {\n normalized = replacePath(normalized, this.#context.builtinsPath);\n }\n\n return normalizeId(normalized, this.#context.config.output.builtinPrefix);\n }\n\n /**\n * Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.\n *\n * @param path - The path to normalize.\n * @returns The normalized path.\n */\n #normalizePath(path: string): string {\n return normalizePath(\n path.includes(\"{\") || path.includes(\"}\")\n ? replacePathTokens(this.#context, path)\n : path,\n this.#context.builtinsPath,\n this.#context.config.output.builtinPrefix\n );\n }\n\n /**\n * Builds a regular expression from a string pattern for path matching.\n *\n * @param path - The string pattern to convert.\n * @returns A regular expression for matching paths.\n */\n #buildRegex(path: string): RegExp {\n const token = \"::GLOBSTAR::\";\n\n return new RegExp(\n `^${this.#normalizePath(path)\n .replace(/\\*\\*/g, token)\n .replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*/g, \"[^/]*\")\n .replace(/\\?/g, \"[^/]\")\n .replace(new RegExp(token, \"g\"), \".*\")}$`\n );\n }\n\n /**\n * Gets the storage adapter and relative key for a given key.\n *\n * @param key - The key to get the storage adapter for.\n * @returns The storage adapter and relative key for the given key.\n */\n #getStorage(key: string): StorageAdapterState {\n const path = this.resolveSync(this.#normalizePath(key)) || key;\n for (const base of Object.keys(this.#storage)\n .filter(Boolean)\n .sort()\n .reverse()) {\n if (isParentPath(path, base)) {\n return {\n base,\n relativeKey: replacePath(path, base),\n adapter: this.#storage[base]!\n };\n }\n }\n\n return {\n base: \"\",\n relativeKey: path,\n adapter: this.#storage[\"\"]!\n };\n }\n\n /**\n * Gets all storage adapters that match a given base key.\n *\n * @param base - The base key to match storage adapters against.\n * @param includeParent - Whether to include parent storage adapters.\n * @returns An array of storage adapters that match the given base key.\n */\n #getStorages(base = \"\", includeParent = false) {\n return Object.keys(this.#storage)\n .sort()\n .reverse()\n .filter(\n key =>\n isParentPath(key, base) || (includeParent && isParentPath(base, key))\n )\n .map(key => ({\n relativeBase:\n base.length > key.length ? base.slice(key.length) : undefined,\n base: key,\n adapter: this.#storage[key]!\n }));\n }\n\n /**\n * Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.\n *\n * @param context - The context of the virtual file system, typically containing options and logging functions.\n * @returns A promise that resolves to a new virtual file system instance.\n */\n public static async create(context: Context): Promise<VirtualFileSystem> {\n if (\n !context.config.skipCache &&\n existsSync(joinPaths(context.dataPath, \"fs.bin\"))\n ) {\n const buffer = await readFileBuffer(\n joinPaths(context.dataPath, \"fs.bin\")\n );\n\n const message = new capnp.Message(buffer, false);\n const fs = message.getRoot(FileSystem);\n\n const result = new VirtualFileSystem(context, fs);\n\n if (fs._hasStorage() && fs.storage.length > 0) {\n await Promise.all(\n fs.storage.values().map(async file => {\n await result.write(file.path, file.code);\n })\n );\n }\n }\n\n const message = new capnp.Message();\n\n return new VirtualFileSystem(context, message.initRoot(FileSystem));\n }\n\n /**\n * Synchronously creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.\n *\n * @param context - The context of the virtual file system, typically containing options and logging functions.\n * @returns A new virtual file system instance.\n */\n public static createSync(context: Context): VirtualFileSystem {\n if (\n !context.config.skipCache &&\n existsSync(joinPaths(context.dataPath, \"fs.bin\"))\n ) {\n const buffer = readFileBufferSync(joinPaths(context.dataPath, \"fs.bin\"));\n\n const message = new capnp.Message(buffer, false);\n const fs = message.getRoot(FileSystem);\n\n const result = new VirtualFileSystem(context, fs);\n\n if (fs._hasStorage() && fs.storage.length > 0) {\n fs.storage.values().map(file => {\n result.writeSync(file.path, file.code);\n });\n }\n }\n\n const message = new capnp.Message();\n\n return new VirtualFileSystem(context, message.initRoot(FileSystem));\n }\n\n /**\n * A map of file ids to their metadata.\n */\n public get metadata(): Readonly<Record<string, VirtualFileMetadata>> {\n return new Proxy(this.#metadata, {\n get: (target, prop: string) => {\n return target[this.#normalizeId(prop)];\n }\n });\n }\n\n /**\n * A map of file paths to their module ids.\n */\n public get ids(): Readonly<Record<string, string>> {\n return new Proxy(this.#paths, {\n get: (target, prop: string) => {\n return target[this.#normalizePath(prop)];\n }\n });\n }\n\n /**\n * A map of module ids to their file paths.\n */\n public get paths(): Readonly<Record<string, string>> {\n return new Proxy(this.#paths, {\n get: (target, prop: string) => {\n return target[this.#normalizeId(prop)];\n }\n });\n }\n\n /**\n * Gets the resolver cache.\n */\n protected get resolverCache(): FlatCache {\n if (!this.#resolverCache) {\n this.#resolverCache = create({\n cacheId: \"module-resolution\",\n cacheDir: this.#context.cachePath,\n ttl: 60 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 100\n });\n }\n\n return this.#resolverCache;\n }\n\n /**\n * Creates a new instance of the {@link VirtualFileSystem}.\n *\n * @param context - The context of the virtual file system, typically containing options and logging functions.\n * @param fs - A buffer containing the serialized virtual file system data.\n */\n private constructor(context: Context, fs: FileSystem) {\n this.#context = context;\n\n if (isSetObject(this.#context.config.output.storage)) {\n this.#storage = {\n ...this.#storage,\n ...this.#context.config.output.storage\n };\n }\n\n this.#storage.virtual ??= new VirtualStorageAdapter({\n base: \"/_virtual\"\n });\n\n if (this.#context.config.output.storage !== StoragePreset.FS) {\n this.#storage[this.#context.artifactsPath] ??= new VirtualStorageAdapter({\n base: this.#context.artifactsPath\n });\n this.#storage[this.#context.builtinsPath] ??= new VirtualStorageAdapter({\n base: this.#context.builtinsPath\n });\n this.#storage[this.#context.entryPath] ??= new VirtualStorageAdapter({\n base: this.#context.entryPath\n });\n }\n\n this.#metadata = {} as Record<string, VirtualFileMetadata>;\n if (fs._hasMetadata()) {\n this.#metadata = fs.metadata.values().reduce(\n (ret, metadata) => {\n ret[metadata.id] = {\n id: metadata.id,\n type: metadata.type,\n timestamp: metadata.timestamp || Date.now(),\n properties: metadata._hasProperties()\n ? metadata.properties.values().reduce(\n (ret, item) => {\n ret[item.key] = item.value;\n return ret;\n },\n {} as Record<string, string>\n )\n : {}\n };\n\n return ret;\n },\n {} as Record<string, VirtualFileMetadata>\n );\n }\n\n this.#ids = {} as Record<string, string>;\n this.#paths = {} as Record<string, string>;\n\n if (fs._hasIds()) {\n this.#ids = fs.ids.values().reduce(\n (ret, identifier) => {\n ret[identifier.path] ??= identifier.id;\n\n return ret;\n },\n {} as Record<string, string>\n );\n this.#paths = fs.ids.values().reduce(\n (ret, identifier) => {\n ret[identifier.id] ??= identifier.path;\n return ret;\n },\n {} as Record<string, string>\n );\n }\n\n this.#log = extendLog(this.#context.log, \"file-system\");\n }\n\n /**\n * Asynchronously checks if a file exists in the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @returns A promise that resolves to `true` if the file exists, otherwise `false`.\n */\n public async exists(path: string): Promise<boolean> {\n const { relativeKey, adapter } = this.#getStorage(path);\n\n return adapter.exists(relativeKey);\n }\n\n /**\n * Synchronously checks if a file exists in the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @returns `true` if the file exists, otherwise `false`.\n */\n public existsSync(path: string): boolean {\n const { relativeKey, adapter } = this.#getStorage(path);\n\n return adapter.existsSync(relativeKey);\n }\n\n /**\n * Checks if a file is virtual in the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @returns `true` if the file is virtual, otherwise `false`.\n */\n public isVirtual(path: string): boolean {\n const resolved = this.resolveSync(path);\n if (!resolved) {\n return false;\n }\n\n return this.#getStorage(resolved)?.adapter?.name === \"virtual\";\n }\n\n /**\n * Checks if a path is a directory in the virtual file system (VFS).\n *\n * @param path - The path to check.\n * @returns `true` if the path is a directory, otherwise `false`.\n */\n public isDirectorySync(path: string): boolean {\n const resolved = this.resolveSync(path);\n if (!resolved) {\n return false;\n }\n\n return !!(\n this.existsSync(resolved) &&\n this.#getStorage(resolved)?.adapter?.isDirectorySync(resolved)\n );\n }\n\n /**\n * Checks if a path is a directory in the virtual file system (VFS).\n *\n * @param path - The path to check.\n * @returns `true` if the path is a directory, otherwise `false`.\n */\n public async isDirectory(path: string): Promise<boolean> {\n const resolved = await this.resolve(path);\n if (!resolved) {\n return false;\n }\n\n return !!(\n (await this.exists(resolved)) &&\n (await this.#getStorage(resolved)?.adapter?.isDirectory(resolved))\n );\n }\n\n /**\n * Checks if a path is a file in the virtual file system (VFS).\n *\n * @param path - The path to check.\n * @returns `true` if the path is a file, otherwise `false`.\n */\n public isFileSync(path: string): boolean {\n const resolved = this.resolveSync(path);\n if (!resolved) {\n return false;\n }\n\n return this.#getStorage(resolved)?.adapter?.isFileSync(resolved) ?? false;\n }\n\n /**\n * Checks if a path is a file in the virtual file system (VFS).\n *\n * @param path - The path to check.\n * @returns `true` if the path is a file, otherwise `false`.\n */\n public async isFile(path: string): Promise<boolean> {\n const resolved = await this.resolve(path);\n if (!resolved) {\n return false;\n }\n\n return (\n (await this.#getStorage(resolved)?.adapter?.isFile(resolved)) ?? false\n );\n }\n\n /**\n * Lists files in a given path.\n *\n * @param path - The path to list files from.\n * @returns An array of file names in the specified path.\n */\n public listSync(path?: string): string[] {\n return getUnique(\n this.#getStorages(path, true)\n .map(storage =>\n storage.adapter.listSync(\n storage.relativeBase\n ? storage.base\n ? appendPath(storage.relativeBase, storage.base)\n : storage.relativeBase\n : storage.base\n )\n )\n .flat()\n );\n }\n\n /**\n * Lists files in a given path.\n *\n * @param path - The path to list files from.\n * @returns An array of file names in the specified path.\n */\n public async list(path?: string): Promise<string[]> {\n return getUnique(\n (\n await Promise.all(\n this.#getStorages(path, true).map(async storage =>\n storage.adapter.list(\n storage.relativeBase\n ? storage.base\n ? appendPath(storage.relativeBase, storage.base)\n : storage.relativeBase\n : storage.base\n )\n )\n )\n ).flat()\n );\n }\n\n /**\n * Removes a file in the virtual file system (VFS).\n *\n * @param path - The path to create the directory at.\n */\n public async remove(path: string): Promise<void> {\n const normalizedPath = this.#normalizePath(path);\n this.#log(LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);\n\n const { relativeKey, adapter } = this.#getStorage(normalizedPath);\n\n if (hasFileExtension(normalizedPath)) {\n await adapter.remove(relativeKey);\n } else {\n await adapter.clear(relativeKey);\n }\n\n const id = this.#ids[normalizedPath];\n if (id && this.#metadata[id]) {\n delete this.#metadata[id];\n delete this.#ids[normalizedPath];\n delete this.#paths[id];\n }\n }\n\n /**\n * Removes a file in the virtual file system (VFS).\n *\n * @param path - The path to create the directory at.\n */\n public removeSync(path: string) {\n const normalizedPath = this.#normalizePath(path);\n this.#log(LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);\n\n const { relativeKey, adapter } = this.#getStorage(normalizedPath);\n\n if (hasFileExtension(normalizedPath)) {\n adapter.removeSync(relativeKey);\n } else {\n adapter.clearSync(relativeKey);\n }\n\n const id = this.#ids[normalizedPath];\n if (id && this.#metadata[id]) {\n delete this.#metadata[id];\n delete this.#ids[normalizedPath];\n delete this.#paths[id];\n }\n }\n\n /**\n * Glob files in the virtual file system (VFS) based on the provided pattern(s).\n *\n * @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return\n * @returns An array of file paths matching the provided pattern(s)\n */\n public async glob(\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n ): Promise<string[]> {\n const results: string[] = [];\n\n for (const pattern of normalizeGlobPatterns(\n this.#context.workspaceConfig.workspaceRoot,\n patterns\n )) {\n const normalized = this.#normalizePath(pattern);\n\n // No glob characters: treat as a single file path\n if (!/[*?[\\]{}]/.test(normalized) && !normalized.includes(\"**\")) {\n if (this.isDirectorySync(normalized)) {\n results.push(...(await this.list(normalized)));\n } else {\n const resolved = await this.resolve(normalized);\n if (resolved && !results.includes(resolved)) {\n results.push(resolved);\n }\n }\n\n continue;\n }\n\n // Make absolute pattern for matching\n const absPattern = isAbsolutePath(normalized)\n ? normalized\n : this.#normalizePath(\n joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized)\n );\n\n // Determine the base directory to start walking from (up to the first glob segment)\n const firstGlobIdx = absPattern.search(/[*?[\\]{}]/);\n const baseDir =\n firstGlobIdx === -1\n ? findFilePath(absPattern)\n : absPattern.slice(\n 0,\n Math.max(0, absPattern.lastIndexOf(\"/\", firstGlobIdx))\n );\n\n await Promise.all(\n (\n await this.list(\n baseDir && isAbsolutePath(baseDir)\n ? baseDir\n : this.#context.workspaceConfig.workspaceRoot\n )\n ).map(async file => {\n if (this.#buildRegex(absPattern).test(file)) {\n const resolved = this.resolveSync(file);\n if (resolved && !results.includes(resolved)) {\n results.push(resolved);\n }\n }\n })\n );\n }\n\n return results;\n }\n\n /**\n * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).\n *\n * @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return\n * @returns An array of file paths matching the provided pattern(s)\n */\n public globSync(\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n ): string[] {\n const results: string[] = [];\n\n for (const pattern of normalizeGlobPatterns(\n this.#context.workspaceConfig.workspaceRoot,\n patterns\n )) {\n const normalized = this.#normalizePath(pattern);\n\n // No glob characters: treat as a single file path\n if (!/[*?[\\]{}]/.test(normalized) && !normalized.includes(\"**\")) {\n if (this.isDirectorySync(normalized)) {\n results.push(...this.listSync(normalized));\n } else {\n const resolved = this.resolveSync(normalized);\n if (resolved && !results.includes(resolved)) {\n results.push(resolved);\n }\n }\n\n continue;\n }\n\n // Make absolute pattern for matching\n const absPattern = isAbsolutePath(normalized)\n ? normalized\n : this.#normalizePath(\n joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized)\n );\n\n // Determine the base directory to start walking from (up to the first glob segment)\n const firstGlobIdx = absPattern.search(/[*?[\\]{}]/);\n const baseDir =\n firstGlobIdx === -1\n ? findFilePath(absPattern)\n : absPattern.slice(\n 0,\n Math.max(0, absPattern.lastIndexOf(\"/\", firstGlobIdx))\n );\n\n const files = this.listSync(\n baseDir && isAbsolutePath(baseDir)\n ? baseDir\n : this.#context.workspaceConfig.workspaceRoot\n );\n for (const file of files) {\n if (this.#buildRegex(absPattern).test(file)) {\n const resolved = this.resolveSync(file);\n if (resolved && !results.includes(resolved)) {\n results.push(resolved);\n }\n }\n }\n }\n\n return results;\n }\n\n /**\n * Copies a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to copy\n * @param destPath - The destination path to copy to\n */\n public async copy(\n srcPath: string | URL | Omit<AssetGlob, \"output\">,\n destPath: string | URL\n ) {\n const src = srcPath instanceof URL ? fileURLToPath(srcPath) : srcPath;\n const dest = destPath instanceof URL ? fileURLToPath(destPath) : destPath;\n\n if (\n (!isSetString(src) && (!isSetObject(src) || !isSetString(src.input))) ||\n !isSetString(dest)\n ) {\n return;\n }\n\n const sourceStr = isString(src)\n ? src\n : src.input\n ? src.input\n : this.#context.workspaceConfig.workspaceRoot;\n const source = await this.resolve(sourceStr);\n if (!source) {\n return;\n }\n\n if (\n this.isDirectorySync(source) ||\n (isSetString(src) && src.includes(\"*\")) ||\n (isSetObject(src) && isSetString(src.glob))\n ) {\n await Promise.all(\n (await this.glob(src)).map(async file => {\n return this.copy(\n file,\n appendPath(replacePath(file, sourceStr), dest)\n );\n })\n );\n } else {\n const content = await this.read(source);\n if (content !== undefined) {\n await this.write(this.#normalizePath(dest), content, {\n skipFormat: true\n });\n }\n }\n }\n\n /**\n * Synchronously copies a file from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to copy\n * @param destPath - The destination path to copy to\n */\n public copySync(\n srcPath: string | URL | Omit<AssetGlob, \"output\">,\n destPath: string | URL\n ) {\n const src = srcPath instanceof URL ? fileURLToPath(srcPath) : srcPath;\n const dest = destPath instanceof URL ? fileURLToPath(destPath) : destPath;\n\n if (\n (!isSetString(src) && (!isSetObject(src) || !isSetString(src.input))) ||\n !isSetString(dest)\n ) {\n return;\n }\n\n const sourceStr = isString(src)\n ? src\n : src.input\n ? src.input\n : this.#context.workspaceConfig.workspaceRoot;\n const source = this.resolveSync(sourceStr);\n if (!source) {\n return;\n }\n\n if (\n this.isDirectorySync(source) ||\n (isSetString(src) && src.includes(\"*\")) ||\n (isSetObject(src) && isSetString(src.glob))\n ) {\n this.globSync(src).map(file => {\n return this.copySync(\n file,\n appendPath(findFilePath(replacePath(file, sourceStr)), dest)\n );\n });\n } else {\n const content = this.readSync(source);\n if (content !== undefined) {\n this.writeSync(\n this.#normalizePath(\n hasFileExtension(dest)\n ? dest\n : appendPath(findFileName(source), dest)\n ),\n content,\n { skipFormat: true }\n );\n }\n }\n }\n\n /**\n * Moves a file (or files) from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to move\n * @param destPath - The destination path to move to\n */\n public async move(srcPath: string, destPath: string) {\n if (hasFileExtension(srcPath)) {\n await this.copy(srcPath, destPath);\n await this.remove(srcPath);\n } else {\n await Promise.all(\n (await this.list(srcPath)).map(async file => {\n await this.copy(file, destPath);\n await this.remove(file);\n })\n );\n }\n }\n\n /**\n * Synchronously moves a file (or files) from one path to another in the virtual file system (VFS).\n *\n * @param srcPath - The source path to move\n * @param destPath - The destination path to move to\n */\n public moveSync(srcPath: string, destPath: string) {\n if (hasFileExtension(srcPath)) {\n this.copySync(srcPath, destPath);\n this.removeSync(srcPath);\n } else {\n this.listSync(srcPath).forEach(file => {\n this.copySync(file, destPath);\n this.removeSync(file);\n });\n }\n }\n\n /**\n * Asynchronously reads a file from the virtual file system (VFS).\n *\n * @param path - The path or ID of the file to read.\n * @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.\n */\n public async read(path: string): Promise<string | undefined> {\n const filePath = await this.resolve(path);\n if (!filePath) {\n return undefined;\n }\n\n const { relativeKey, adapter } = this.#getStorage(filePath);\n this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);\n\n return (await adapter.get(relativeKey)) ?? undefined;\n }\n\n /**\n * Synchronously reads a file from the virtual file system (VFS).\n *\n * @param path - The path or ID of the file to read.\n * @returns The contents of the file as a string, or undefined if the file does not exist.\n */\n public readSync(path: string): string | undefined {\n const filePath = this.resolveSync(path);\n if (!filePath) {\n return undefined;\n }\n\n const { relativeKey, adapter } = this.#getStorage(filePath);\n this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);\n\n return adapter.getSync(relativeKey) ?? undefined;\n }\n\n /**\n * Writes a file to the virtual file system (VFS).\n *\n * @param path - The path to the file.\n * @param data - The contents of the file.\n * @param options - Optional parameters for writing the file.\n * @returns A promise that resolves when the file is written.\n */\n public async write(\n path: string,\n data: string = \"\",\n options: WriteOptions = {}\n ): Promise<void> {\n let code = data;\n if (!options.skipFormat) {\n const resolvedConfig = await resolveConfig(this.#normalizePath(path));\n if (resolvedConfig) {\n code = await format(data, {\n absolutePath: this.#normalizePath(path),\n ...resolvedConfig\n });\n }\n }\n\n const { relativeKey, adapter } = this.#getStorage(path);\n\n this.#log(\n LogLevelLabel.TRACE,\n `Writing ${this.#normalizePath(relativeKey)} to ${\n adapter.name === \"virtual\"\n ? \"the virtual file system\"\n : adapter.name === \"file-system\"\n ? \"the local file system\"\n : adapter.name\n } (size: ${prettyBytes(new Blob(toArray(code)).size)})`\n );\n\n const id = options?.meta?.id || this.#normalizeId(relativeKey);\n this.#metadata[id] = {\n variant: \"normal\",\n timestamp: Date.now(),\n ...(options.meta ?? {})\n } as VirtualFileMetadata;\n this.#paths[id] = this.#normalizePath(relativeKey);\n this.#ids[this.#normalizePath(relativeKey)] = id;\n\n return adapter.set(relativeKey, code);\n }\n\n /**\n * Synchronously writes a file to the virtual file system (VFS).\n *\n * @param path - The file to write.\n * @param data - The contents of the file.\n * @param options - Optional parameters for writing the file.\n */\n public writeSync(\n path: string,\n data: string = \"\",\n options: WriteOptions = {}\n ): void {\n const { relativeKey, adapter } = this.#getStorage(path);\n\n this.#log(\n LogLevelLabel.TRACE,\n `Writing ${this.#normalizePath(relativeKey)} file to ${\n adapter.name === \"virtual\"\n ? \"the virtual file system\"\n : adapter.name === \"file-system\"\n ? \"the local file system\"\n : adapter.name\n } (size: ${prettyBytes(new Blob(toArray(data)).size)})`\n );\n\n const id = options?.meta?.id || this.#normalizeId(relativeKey);\n this.#metadata[id] = {\n variant: \"normal\",\n timestamp: Date.now(),\n ...(options.meta ?? {})\n } as VirtualFileMetadata;\n this.#paths[id] = this.#normalizePath(relativeKey);\n this.#ids[this.#normalizePath(relativeKey)] = id;\n\n return adapter.setSync(relativeKey, data);\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 mkdirSync(dirPath: string) {\n return this.#getStorage(dirPath)?.adapter?.mkdirSync(dirPath);\n }\n\n /**\n * Creates a directory at the specified path.\n *\n * @param path - The path of the directory to create.\n */\n public async mkdir(path: string): Promise<void> {\n return this.#getStorage(path)?.adapter?.mkdir(path);\n }\n\n /**\n * Retrieves the metadata of a file in the virtual file system (VFS).\n *\n * @param pathOrId - The path or ID of the file to retrieve metadata for.\n * @returns The metadata of the file, or undefined if the file does not exist.\n */\n public getMetadata(pathOrId: string): VirtualFileMetadata | undefined {\n const resolved = this.resolveSync(pathOrId);\n if (resolved && this.metadata[resolved]) {\n return this.metadata[resolved];\n }\n\n return undefined;\n }\n\n /**\n * A helper function to resolve modules in the virtual file system (VFS).\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolved = await context.resolvePath(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns A promise that resolves to the resolved module path.\n */\n public async resolve(\n id: string,\n importer?: string,\n options: ResolveOptions = {}\n ): Promise<string | undefined> {\n let path = id;\n if (path.includes(\"{\") || path.includes(\"}\")) {\n path = replacePathTokens(this.#context, path);\n }\n\n if (isAbsolutePath(path)) {\n return path;\n }\n\n const resolverCacheKey = murmurhash({\n path: this.#normalizeId(path),\n importer,\n options\n });\n\n let result!: string | undefined;\n if (!this.#context.config.skipCache) {\n result = this.resolverCache.get<string | undefined>(resolverCacheKey);\n if (result) {\n return result;\n }\n }\n\n result = this.paths[this.#normalizeId(path)];\n if (!result) {\n const paths = options.paths ?? [];\n if (importer && !paths.includes(importer)) {\n paths.push(importer);\n }\n\n paths.push(this.#context.workspaceConfig.workspaceRoot);\n paths.push(\n appendPath(\n this.#context.config.projectRoot,\n this.#context.workspaceConfig.workspaceRoot\n )\n );\n paths.push(\n appendPath(\n this.#context.config.sourceRoot,\n this.#context.workspaceConfig.workspaceRoot\n )\n );\n paths.push(\n ...(\n Object.keys(this.#context.tsconfig?.options?.paths ?? {})\n .filter(tsconfigPath =>\n path.startsWith(tsconfigPath.replace(/\\*$/, \"\"))\n )\n .map(\n tsconfigPath =>\n this.#context.tsconfig?.options?.paths?.[tsconfigPath]\n )\n .flat()\n .filter(Boolean) as string[]\n ).map(tsconfigPath =>\n appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)\n )\n );\n\n for (const combination of getResolutionCombinations(path, { paths })) {\n const { relativeKey, adapter } = this.#getStorage(combination);\n if (await adapter.exists(relativeKey)) {\n result = combination;\n break;\n }\n }\n\n if (!result) {\n try {\n result = await resolve(path, { ...options, paths });\n } catch {\n // Do nothing\n }\n }\n }\n\n if (result && !this.#context.config.skipCache) {\n this.resolverCache.set(resolverCacheKey, result);\n }\n\n return result;\n }\n\n /**\n * A synchronous helper function to resolve modules using the Jiti resolver\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolvedPath = context.resolveSync(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns The resolved module path.\n */\n public resolveSync(\n id: string,\n importer?: string,\n options: ResolveOptions = {}\n ): string | undefined {\n let path = id;\n if (path.includes(\"{\") || path.includes(\"}\")) {\n path = replacePathTokens(this.#context, path);\n }\n\n if (isAbsolutePath(path)) {\n return path;\n }\n\n let result!: string | undefined;\n if (!this.#context.config.skipCache) {\n result = this.resolverCache.get<string | undefined>(\n this.#normalizeId(path)\n );\n if (result) {\n return result;\n }\n }\n\n result = this.paths[this.#normalizeId(path)];\n if (!result) {\n const paths = options.paths ?? [];\n if (importer && !paths.includes(importer)) {\n paths.push(importer);\n }\n\n paths.push(this.#context.workspaceConfig.workspaceRoot);\n paths.push(\n appendPath(\n this.#context.config.projectRoot,\n this.#context.workspaceConfig.workspaceRoot\n )\n );\n paths.push(\n appendPath(\n this.#context.config.sourceRoot,\n this.#context.workspaceConfig.workspaceRoot\n )\n );\n paths.push(\n ...(\n Object.keys(this.#context.tsconfig?.options?.paths ?? {})\n .filter(tsconfigPath =>\n path.startsWith(tsconfigPath.replace(/\\*$/, \"\"))\n )\n .map(\n tsconfigPath =>\n this.#context.tsconfig?.options?.paths?.[tsconfigPath]\n )\n .flat()\n .filter(Boolean) as string[]\n ).map(tsconfigPath =>\n appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)\n )\n );\n\n for (const combination of getResolutionCombinations(path, { paths })) {\n const { relativeKey, adapter } = this.#getStorage(combination);\n if (adapter.existsSync(relativeKey)) {\n result = combination;\n break;\n }\n }\n\n if (!result) {\n try {\n result = resolveSync(path, { ...options, paths });\n } catch {\n // Do nothing\n }\n }\n }\n\n if (result && !this.#context.config.skipCache) {\n this.resolverCache.set(this.#normalizeId(path), result);\n }\n\n return result;\n }\n\n /**\n * Disposes of the virtual file system (VFS) by saving its state to disk.\n */\n public async dispose() {\n if (!this.#isDisposed) {\n this.#isDisposed = true;\n\n this.#log(LogLevelLabel.DEBUG, \"Disposing virtual file system...\");\n await this.remove(joinPaths(this.#context.dataPath, \"fs.bin\"));\n\n const message = new capnp.Message();\n const fs = message.initRoot(FileSystem);\n\n const paths = await this.list();\n\n const storage = fs._initStorage(paths.length);\n await Promise.all(\n paths.map(async (path, index) => {\n const code = await this.read(path);\n\n const fd = storage.get(index);\n fd.path = path;\n fd.code = code || \"\";\n })\n );\n\n const ids = fs._initIds(Object.keys(this.ids).length);\n Object.entries(this.ids)\n .filter(([, path]) => path)\n .forEach(([id, path], index) => {\n const fileId = ids.get(index);\n fileId.id = id;\n fileId.path = path;\n });\n\n const metadata = fs._initMetadata(Object.keys(this.metadata).length);\n Object.entries(this.metadata)\n .filter(([, value]) => value)\n .forEach(([id, value], index) => {\n const fileMetadata = metadata.get(index);\n fileMetadata.id = id;\n fileMetadata.type = value.type;\n fileMetadata.timestamp = value.timestamp ?? BigInt(Date.now());\n\n if (value.properties) {\n const props = fileMetadata._initProperties(\n Object.keys(value.properties).length\n );\n Object.entries(value.properties).forEach(([key, val], index) => {\n const prop = props.get(index);\n prop.key = key;\n prop.value = val;\n });\n }\n });\n\n await writeFileBuffer(\n joinPaths(this.#context.dataPath, \"fs.bin\"),\n message.toArrayBuffer()\n );\n\n if (!this.#context.config.skipCache) {\n this.#resolverCache.save(true);\n }\n\n await Promise.all(\n this.#getStorages().map(async storage => storage.adapter.dispose())\n );\n\n this.#log(LogLevelLabel.TRACE, \"Virtual file system has been disposed.\");\n }\n }\n\n // /**\n // * Initializes the virtual file system (VFS) by patching the file system module if necessary.\n // */\n // public [__VFS_PATCH__]() {\n // if (!this.#isPatched && this.#context.config.output.mode !== \"fs\") {\n // this.#revert = patchFS(fs, this);\n // this.#isPatched = true;\n // }\n // }\n\n // /**\n // * Reverts the file system module to its original state if it was previously patched.\n // */\n // public [__VFS_REVERT__]() {\n // if (this.#isPatched && this.#context.config.output.mode !== \"fs\") {\n // if (!this.#revert) {\n // throw new Error(\n // \"Attempting to revert File System patch prior to calling `__init__` function\"\n // );\n // }\n\n // this.#revert?.();\n // this.#isPatched = false;\n // }\n // }\n\n async [Symbol.asyncDispose]() {\n return this.dispose();\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/plugin.ts","../../src/lib/contexts/environment-context.ts"],"names":["PLUGIN_NON_HOOK_FIELDS","PowerlinesEnvironmentContext","PowerlinesContext","fromConfig","workspaceConfig","config","context","init","powerlinesPath","resolvePackage","Error","environment","plugins","hooks","addPlugin","plugin","resolvedPlugin","isFunction","applyToEnvironment","result","Promise","resolve","isObject","Object","keys","length","isPluginConfig","$$internal","isPlugin","createPluginContext","push","filter","key","includes","reduce","ret","hook","pluginHook","isPluginHook","isHookExternal","enforce","addPluginHook","order","normal","getHookHandler","bind","selectHooks","options","preOrdered","map","h","find","p","name","handle","handler","preEnforced","postOrdered","postEnforced","resolvedConfig"],"mappings":";;;;;;;;AA4YO,IAAMA,sBAAAA,GAAyB;AACpC,EAAA,MAAA;AACA,EAAA,KAAA;AACA,EAAA,SAAA;AACA,EAAA,QAAA;AACA,EAAA,WAAA;AACA,EAAA;;;;ACnWK,IAAMC,4BAAAA,GAAN,MAAMA,6BAAAA,SAGHC,iBAAAA,CAAAA;EAlDV;;;;;;AAwDE,EAAA,MAAA,GAAoD,EAAC;;;;;;;;EAWrD,aAAoBC,UAAAA,CAGlBC,iBACAC,MAAAA,EACwD;AACxD,IAAA,MAAMC,OAAAA,GAAU,IAAIL,6BAAAA,CAClBI,MAAAA,EACAD,eAAAA,CAAAA;AAEF,IAAA,MAAME,QAAQC,IAAAA,EAAI;AAElBD,IAAAA,OAAAA,CAAQE,cAAAA,GAAiB,MAAMC,cAAAA,CAAe,YAAA,CAAA;AAC9C,IAAA,IAAI,CAACH,QAAQE,cAAAA,EAAgB;AAC3B,MAAA,MAAM,IAAIE,MAAM,kDAAA,CAAA;AAClB,IAAA;AAEA,IAAA,OAAOJ,OAAAA;AACT,EAAA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AA,0CAAA,EAA6CwC,CAAAA,CAAEnC,MAAAA,CAAOsC,IAAI,CAAA,EAAA,CAAI,CAAA;AAElE,UAAA;AAEA,UAAA,OAAO;AACLC,YAAAA,MAAAA,EAAQJ,CAAAA,CAAEK,OAAAA;AACVjD,YAAAA,OAAAA,EAASS,MAAAA,CAAOT;AAClB,WAAA;AACF,QAAA,CAAA,CAAA,CAAA;AAEJ,MAAA;AACF,IAAA;AAEA,IAAA,OAAOa,MAAAA;AACT,EAAA;AAEA,EAAA,WAAA,CACEd,QACAD,eAAAA,EACA;AACA,IAAA,KAAA,CAAMA,eAAAA,CAAAA;AAEN,IAAA,IAAA,CAAKuD,cAAAA,GAAiBtD,MAAAA;AACxB,EAAA;AACF","file":"chunk-S2F75YZK.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { FunctionLike, MaybePromise } from \"@stryke/types/base\";\nimport type {\n ExternalIdResult,\n HookFilter,\n TransformResult,\n UnpluginOptions\n} from \"unplugin\";\nimport type { UnpluginBuildVariant } from \"./build\";\nimport type { CommandType } from \"./commands\";\nimport type { EnvironmentConfig, PluginConfig } from \"./config\";\nimport type {\n BuildPluginContext,\n PluginContext,\n UnresolvedContext\n} from \"./context\";\nimport type { EnvironmentResolvedConfig, ResolvedConfig } from \"./resolved\";\n\nexport interface PluginHookObject<\n THookFunction extends FunctionLike,\n TFilter extends keyof HookFilter = never\n> {\n /**\n * The order in which the plugin should be applied.\n */\n order?: \"pre\" | \"post\" | null | undefined;\n\n /**\n * A filter to determine when the hook should be called.\n */\n filter?: Pick<HookFilter, TFilter>;\n\n /**\n * The hook function to be called.\n */\n handler: THookFunction;\n}\n\nexport type PluginHook<\n THookFunction extends FunctionLike,\n TFilter extends keyof HookFilter = never\n> = THookFunction | PluginHookObject<THookFunction, TFilter>;\n\n/**\n * A result returned by the plugin from the `types` hook that describes the declaration types output file.\n */\nexport interface TypesResult {\n directives?: string[];\n code: string;\n}\n\ntype DeepPartial<T> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n\nexport type ConfigResult<TContext extends PluginContext = PluginContext> =\n DeepPartial<TContext[\"config\"]> & Record<string, any>;\n\nexport interface BasePluginHookFunctions<\n TContext extends PluginContext = PluginContext\n> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config: (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<ConfigResult<TContext>>;\n\n /**\n * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @remarks\n * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.\n *\n * @see https://vitejs.dev/guide/api-plugin#configenvironment\n *\n * @param this - The build context.\n * @param name - The name of the environment being configured.\n * @param environment - The Vite-like environment object containing information about the current build environment.\n * @returns A promise that resolves when the hook is complete.\n */\n configEnvironment: (\n this: TContext,\n name: string,\n environment: EnvironmentConfig\n ) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;\n\n /**\n * A hook that is called when the plugin is resolved.\n *\n * @see https://vitejs.dev/guide/api-plugin#configresolved\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n configResolved: (this: TContext) => MaybePromise<void>;\n\n /**\n * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.\n *\n * @param this - The build context.\n * @param code - The source code to generate types for.\n * @returns A promise that resolves when the hook is complete.\n */\n types: (\n this: TContext,\n code: string\n ) => MaybePromise<TypesResult | string | undefined | null>;\n\n /**\n * A hook that is called at the start of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildStart: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called at the end of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildEnd: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>;\n\n /**\n * A hook that is called to write the bundle to disk.\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n writeBundle: (this: TContext) => MaybePromise<void>;\n}\n\nexport type BuildPlugin<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant,\n TOptions extends Required<UnpluginOptions>[TBuildVariant] =\n Required<UnpluginOptions>[TBuildVariant]\n> = {\n [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike\n ? (\n this: ThisParameterType<TOptions[TKey]> & TContext,\n ...args: Parameters<TOptions[TKey]>\n ) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>>\n : TOptions[TKey];\n};\n\nexport type ExternalPluginHookFunctionsVariant<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant\n> = {\n [TKey in keyof BuildPlugin<TContext, TBuildVariant> &\n string as `${TBuildVariant}:${TKey}`]: BuildPlugin<\n TContext,\n TBuildVariant\n >[TKey];\n};\n\nexport type ExternalPluginHookFunctions<TContext extends PluginContext> =\n ExternalPluginHookFunctionsVariant<TContext, \"vite\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"esbuild\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rolldown\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rollup\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"webpack\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rspack\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"farm\">;\n\nexport type PluginHookFunctions<\n TContext extends PluginContext = PluginContext\n> = BasePluginHookFunctions<TContext> & ExternalPluginHookFunctions<TContext>;\n\nexport type PluginHooks<TContext extends PluginContext = PluginContext> = {\n [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<\n BasePluginHookFunctions<TContext>[TKey]\n >;\n} & {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config:\n | PluginHook<\n (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<ConfigResult<TContext>>\n >\n | ConfigResult<TContext>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>,\n \"code\" | \"id\"\n >;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<TransformResult>,\n \"id\"\n >;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>,\n \"id\"\n >;\n};\n\nexport type PluginBuildPlugins<TContext extends PluginContext = PluginContext> =\n {\n [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<\n TContext,\n TBuildVariant\n >;\n };\n\nexport interface Plugin<\n in out TContext extends PluginContext<ResolvedConfig> =\n PluginContext<ResolvedConfig>\n>\n extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {\n /**\n * The name of the plugin, for use in deduplication, error messages and logs.\n */\n name: string;\n\n /**\n * An API object that can be used for inter-plugin communication.\n *\n * @see https://rollupjs.org/plugin-development/#direct-plugin-communication\n */\n api?: Record<string, any>;\n\n /**\n * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.\n *\n * @remarks\n * The Plugin invocation order is as follows:\n * - `enforce: 'pre'` plugins\n * - `order: 'pre'` plugin hooks\n * - any other plugins (normal)\n * - `order: 'post'` plugin hooks\n * - `enforce: 'post'` plugins\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering\n * @see https://rollupjs.org/plugin-development/#build-hooks\n * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post\n * @see https://esbuild.github.io/plugins/#concepts\n */\n enforce?: \"pre\" | \"post\";\n\n /**\n * A function to determine if two plugins are the same and can be de-duplicated.\n *\n * @remarks\n * If this is not provided, plugins are de-duplicated by comparing their names.\n *\n * @param other - The other plugin to compare against.\n * @returns `true` if the two plugins are the same, `false` otherwise.\n */\n dedupe?: false | ((other: Plugin<any>) => boolean);\n\n /**\n * A list of pre-requisite plugins that must be loaded before this plugin can be used.\n */\n dependsOn?: PluginConfig<any>[];\n\n /**\n * Define environments where this plugin should be active. By default, the plugin is active in all environments.\n *\n * @param environment - The environment to check.\n * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.\n */\n applyToEnvironment?: (\n environment: EnvironmentResolvedConfig\n ) => boolean | PluginConfig<any>;\n}\n\nexport const PLUGIN_NON_HOOK_FIELDS = [\n \"name\",\n \"api\",\n \"enforce\",\n \"dedupe\",\n \"dependsOn\",\n \"applyToEnvironment\"\n] as const;\n\nexport type PluginNonHookFields =\n | ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n | UnpluginBuildVariant;\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 { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport {\n addPluginHook,\n getHookHandler,\n isHookExternal,\n isPlugin,\n isPluginConfig,\n isPluginHook\n} from \"../../plugin-utils/helpers\";\nimport { WorkspaceConfig } from \"../../types/config\";\nimport {\n EnvironmentContext,\n EnvironmentContextPlugin,\n PluginContext,\n SelectHooksOptions,\n SelectHooksResult\n} from \"../../types/context\";\nimport { BaseHooksList, HookKeys, HooksList } from \"../../types/hooks\";\nimport { Plugin, PLUGIN_NON_HOOK_FIELDS } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { PowerlinesContext } from \"./context\";\nimport { createPluginContext } from \"./plugin-context\";\n\nexport class PowerlinesEnvironmentContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements EnvironmentContext<TResolvedConfig>\n{\n /**\n * The hooks registered by plugins in this environment\n */\n #hooks: HooksList<PluginContext<TResolvedConfig>> = {} as HooksList<\n PluginContext<TResolvedConfig>\n >;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceConfig - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static async fromConfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceConfig: WorkspaceConfig,\n config: TResolvedConfig\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig>> {\n const context = new PowerlinesEnvironmentContext<TResolvedConfig>(\n config,\n workspaceConfig\n );\n await context.init();\n\n context.powerlinesPath = await resolvePackage(\"powerlines\");\n if (!context.powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n return context;\n }\n\n /**\n * The resolved environment configuration\n */\n public environment!: EnvironmentResolvedConfig;\n\n /**\n * The list of plugins applied to this environment\n */\n public plugins: EnvironmentContextPlugin<TResolvedConfig>[] = [];\n\n /**\n * The resolved configuration options\n */\n public override get config(): TResolvedConfig {\n return super.config;\n }\n\n public get hooks(): HooksList<PluginContext<TResolvedConfig>> {\n return this.#hooks;\n }\n\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n let resolvedPlugin = plugin;\n if (isFunction(plugin.applyToEnvironment)) {\n const result = await Promise.resolve(\n plugin.applyToEnvironment(this.environment)\n );\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (isPluginConfig(result)) {\n return this.$$internal.addPlugin(result);\n }\n\n resolvedPlugin = isPlugin<TResolvedConfig>(result) ? result : plugin;\n }\n\n const context = createPluginContext<TResolvedConfig>(resolvedPlugin, this);\n\n this.plugins.push({\n plugin: resolvedPlugin,\n context\n });\n\n this.#hooks = Object.keys(resolvedPlugin)\n .filter(\n key =>\n !PLUGIN_NON_HOOK_FIELDS.includes(\n key as ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n )\n )\n .reduce((ret, key) => {\n const hook = key as keyof HooksList<PluginContext<TResolvedConfig>>;\n const pluginHook = resolvedPlugin[hook as keyof typeof resolvedPlugin];\n if (!isPluginHook(pluginHook)) {\n return ret;\n }\n\n if (!isHookExternal(hook)) {\n ret[hook] ??= {};\n if (resolvedPlugin.enforce) {\n ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][`${resolvedPlugin.enforce}Enforced`]!\n );\n\n return ret;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n ret[hook].normal ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook].normal\n );\n\n return ret;\n }\n\n ret[hook][`${pluginHook.order}Ordered`] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][`${pluginHook.order}Ordered`]!\n );\n } else {\n ret[hook] ??= [];\n ret[hook].push({\n plugin: resolvedPlugin,\n hook: getHookHandler(pluginHook).bind(context)\n } as any);\n }\n\n return ret;\n }, this.hooks);\n }\n\n /**\n * Retrieves the hook handlers for a specific hook name\n */\n public selectHooks<TKey extends HookKeys<PluginContext<TResolvedConfig>>>(\n hook: TKey,\n options?: SelectHooksOptions\n ): SelectHooksResult<TResolvedConfig, TKey>[] {\n const result = [] as SelectHooksResult<TResolvedConfig, TKey>[];\n\n if (this.hooks[hook]) {\n if (!isHookExternal(hook)) {\n const hooks = this.hooks[hook] as BaseHooksList<\n PluginContext<TResolvedConfig>\n >;\n if (options?.order) {\n if (options?.order === \"pre\") {\n result.push(\n ...(hooks.preOrdered ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n result.push(\n ...(hooks.preEnforced ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n } else if (options?.order === \"post\") {\n result.push(\n ...(hooks.postOrdered ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n result.push(\n ...(hooks.postEnforced ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n } else {\n result.push(\n ...(hooks.normal ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n }\n } else {\n result.push(...this.selectHooks(hook, { order: \"pre\" }));\n result.push(...this.selectHooks(hook, { order: \"normal\" }));\n result.push(...this.selectHooks(hook, { order: \"post\" }));\n }\n } else {\n result.push(\n ...this.hooks[hook].map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${h.plugin.name}\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n }\n }\n\n return result;\n }\n\n protected constructor(\n config: TResolvedConfig,\n workspaceConfig: WorkspaceConfig\n ) {\n super(workspaceConfig);\n\n this.resolvedConfig = config;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","createEnvironment","name","userConfig","defu","environments","title","titleCase","ssr","mainFields","build","platform","extensions","consumer","preview","port","open","strictPort","host","allowedHosts","cors","headers","undefined","createDefaultEnvironment","PowerlinesAPIContext","PowerlinesContext","from","workspaceRoot","config","context","loadWorkspaceConfig","root","withUserConfig","powerlinesPath","resolvePackage","Error","$$internal","value","environment","Object","values","log","createLog","plugins","workspaceConfig","init","Promise","all","toArray","keys","length","map","env","in","PowerlinesEnvironmentContext","fromConfig","isSetObject","inlineConfig","withInlineConfig","plugin","addPlugin","options","isHighPriority","push","getEnvironment","LogLevelLabel","DEBUG","chalk","bold","cyanBright","WARN","getEnvironmentSafe"],"mappings":";;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,SAAA;AAE5B,SAASC,iBAAAA,CACdC,MACAC,UAAAA,EAA4C;AAE5C,EAAA,OAAOC,KACLD,UAAAA,CAAWE,YAAAA,GAAeH,IAAAA,CAAAA,IAAS,EAAC,EACpC;AACEA,IAAAA,IAAAA;AACAI,IAAAA,KAAAA,EAAOH,UAAAA,CAAWG,KAAAA,IAASC,SAAAA,CAAUJ,UAAAA,CAAWD,IAAI,CAAA;IACpDM,GAAAA,EAAK,KAAA;IACLC,UAAAA,EACEN,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAC3B;AAAC,MAAA,SAAA;AAAW,MAAA,QAAA;AAAU,MAAA,aAAA;AAAe,MAAA;AACrC,KAAA,GAAA;AAAC,MAAA,QAAA;AAAU,MAAA,aAAA;AAAe,MAAA;;IAChCC,UAAAA,EAAY;AAAC,MAAA,MAAA;AAAQ,MAAA,KAAA;AAAO,MAAA,MAAA;AAAQ,MAAA,KAAA;AAAO,MAAA,MAAA;AAAQ,MAAA,MAAA;AAAQ,MAAA;;AAC3DC,IAAAA,QAAAA,EAAUV,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAAY,QAAA,GAAW,QAAA;IAChEG,OAAAA,EACEX,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAC3B;MACEI,IAAAA,EAAM,IAAA;MACNC,IAAAA,EAAM,IAAA;MACNC,UAAAA,EAAY,KAAA;;MAEZ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AE6C,WAAW,CAAA,EAAG;AAC/CZ,MAAAA,WAAAA,GAAc,IAAA,CAAKjC,aAAakC,MAAAA,CAAOU,IAAAA,CAAK,KAAK5C,YAAY,CAAA,CAAE,CAAA,CAAE,CAAA;AAEjE,MAAA,IAAA,CAAKoC,GAAAA,CACHwB,aAAAA,CAAcC,KAAAA,EACd,CAAA,0CAAA,EAA6CC,KAAAA,CAAMC,IAAAA,CAAKC,UAAAA,CACtD/B,WAAAA,EAAaA,WAAAA,CAAYpC,IAAAA,CAAAA,CAAAA,CACxB,CAAA;AAEP,IAAA;AAEA,IAAA,IAAI,CAACoC,WAAAA,EAAa;AAChB,MAAA,IAAIpC,IAAAA,EAAM;AACR,QAAA,MAAM,IAAIiC,KAAAA,CAAM,CAAA,aAAA,EAAgBjC,IAAAA,CAAAA,YAAAA,CAAkB,CAAA;AACpD,MAAA;AAEAoC,MAAAA,WAAAA,GAAc,MAAM,IAAA,CAAKe,EAAAA,CACvB9B,yBAAyB,IAAA,CAAKK,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAGjD,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,aAAAA,CAAcK,IAAAA,EACd,CAAA,mGAAA,EAAsGH,KAAAA,CAAMC,IAAAA,CAAKC,UAAAA,CAC/G/B,WAAAA,EAAaA,WAAAA,CAAYpC,IAAAA,CAAAA,CAAAA,CACxB,CAAA;AAEP,IAAA;AAEA,IAAA,OAAOoC,WAAAA;AACT,EAAA;AAEA,EAAA,MAAaiC,mBACXrE,IAAAA,EAC0D;AAC1D,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,CAAK8D,cAAAA,CAAe9D,IAAAA,CAAAA;IACnC,CAAA,CAAA,MAAQ;AACN,MAAA,OAAOoB,MAAAA;AACT,IAAA;AACF,EAAA;AACF","file":"chunk-YQQPMY35.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { APIContext, Context } from \"../../types/context\";\nimport { EnvironmentResolvedConfig } from \"../../types/resolved\";\n\nexport const DEFAULT_ENVIRONMENT = \"default\" as const;\n\nexport function createEnvironment<TContext extends Context = Context>(\n name: string,\n userConfig: TContext[\"config\"][\"userConfig\"]\n): EnvironmentResolvedConfig {\n return defu(\n userConfig.environments?.[name] ?? {},\n {\n name,\n title: userConfig.title || titleCase(userConfig.name),\n ssr: false,\n mainFields:\n userConfig.build?.platform === \"browser\"\n ? [\"browser\", \"module\", \"jsnext:main\", \"jsnext\"]\n : [\"module\", \"jsnext:main\", \"jsnext\"],\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"],\n consumer: userConfig.build?.platform === \"browser\" ? \"client\" : \"server\",\n preview:\n userConfig.build?.platform === \"browser\"\n ? {\n port: 5173,\n open: true,\n strictPort: false,\n // https: false,\n host: \"localhost\",\n allowedHosts: [\".\"],\n cors: true,\n headers: {}\n }\n : undefined\n },\n userConfig\n ) as EnvironmentResolvedConfig;\n}\n\nexport function createDefaultEnvironment<\n TContext extends APIContext = APIContext\n>(userConfig: TContext[\"config\"][\"userConfig\"]): EnvironmentResolvedConfig {\n return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);\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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport chalk from \"chalk\";\nimport {\n createDefaultEnvironment,\n createEnvironment\n} from \"../../internal/helpers/environment\";\nimport {\n InitialUserConfig,\n InlineConfig,\n LogFn,\n UserConfig,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n APIContext,\n EnvironmentContext,\n InitContextOptions,\n PluginContext\n} from \"../../types/context\";\nimport {\n UNSAFE_ContextInternal,\n UNSAFE_EnvironmentContext\n} from \"../../types/internal\";\nimport { Plugin } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { loadWorkspaceConfig } from \"../config-file\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesAPIContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements APIContext<TResolvedConfig>\n{\n #environments: Record<string, UNSAFE_EnvironmentContext<TResolvedConfig>> =\n {};\n\n #plugins: Plugin<PluginContext<TResolvedConfig>>[] = [];\n\n #log!: LogFn;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static override async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<APIContext<TResolvedConfig>> {\n const context = new PowerlinesAPIContext<TResolvedConfig>(\n await loadWorkspaceConfig(workspaceRoot, config.root)\n );\n await context.withUserConfig(config);\n\n context.powerlinesPath = await resolvePackage(\"powerlines\");\n if (!context.powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n return context;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return super.$$internal;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override set $$internal(\n value: UNSAFE_ContextInternal<TResolvedConfig>\n ) {\n super.$$internal = value;\n for (const environment of Object.values(this.environments)) {\n environment.$$internal = super.$$internal;\n }\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n UNSAFE_EnvironmentContext<TResolvedConfig>\n > {\n return this.#environments;\n }\n\n public override get log(): LogFn {\n if (!this.#log) {\n this.#log = this.createLog(\"engine\");\n }\n\n return this.#log;\n }\n\n public get plugins(): Array<Plugin<PluginContext<TResolvedConfig>>> {\n return this.#plugins;\n }\n\n protected constructor(workspaceConfig: WorkspaceConfig) {\n super(workspaceConfig);\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @param config - The partial user configuration to use for initialization.\n */\n protected override async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {}\n ) {\n await super.init(config);\n\n await Promise.all(\n toArray(\n this.config.userConfig.environments &&\n Object.keys(this.config.userConfig.environments).length > 0\n ? Object.keys(this.config.userConfig.environments).map(name =>\n createEnvironment(name, this.config.userConfig)\n )\n : createDefaultEnvironment(this.config.userConfig)\n ).map(async env => {\n this.#environments[env.name] = await this.in(env);\n })\n );\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async in(\n environment: EnvironmentResolvedConfig\n ): Promise<UNSAFE_EnvironmentContext<TResolvedConfig>> {\n let context: UNSAFE_EnvironmentContext<TResolvedConfig>;\n if (this.environments[environment.name]) {\n context = this.environments[environment.name] as any;\n } else {\n context = (await PowerlinesEnvironmentContext.fromConfig(\n this.workspaceConfig,\n this.config\n )) as any;\n }\n\n if (isSetObject(this.config.inlineConfig)) {\n await context.withInlineConfig(this.config.inlineConfig);\n }\n\n context.environment = environment;\n context.plugins = [];\n\n for (const plugin of this.plugins) {\n await context.addPlugin(plugin);\n }\n\n return context;\n }\n\n /**\n * Update the context using a new user configuration options\n *\n * @param userConfig - The new user configuration options.\n */\n public override async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withUserConfig(userConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withUserConfig(\n userConfig as UserConfig,\n options\n );\n })\n );\n }\n\n /**\n * Update the context using a new inline configuration options\n *\n * @param inlineConfig - The new inline configuration options.\n */\n public override async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withInlineConfig(inlineConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withInlineConfig(\n inlineConfig as InlineConfig,\n options\n );\n })\n );\n }\n\n /**\n * Add a plugin to the API context and all environments\n *\n * @param plugin - The plugin to add.\n */\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n this.plugins.push(plugin);\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.addPlugin(plugin);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment: EnvironmentContext<TResolvedConfig> | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.log(\n LogLevelLabel.DEBUG,\n `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.in(\n createDefaultEnvironment(this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.WARN,\n `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n return environment;\n }\n\n public async getEnvironmentSafe(\n name?: string\n ): Promise<EnvironmentContext<TResolvedConfig> | undefined> {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n}\n"]}
|