@powerlines/core 0.48.24 → 0.48.26
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/_virtual/_rolldown/runtime.cjs +8 -0
- package/dist/constants/api.cjs +8 -0
- package/dist/constants/api.d.mts +2 -0
- package/dist/constants/api.d.mts.map +1 -1
- package/dist/constants/api.mjs +8 -0
- package/dist/constants/api.mjs.map +1 -1
- package/dist/constants/commands.cjs +8 -0
- package/dist/constants/commands.d.mts +2 -0
- package/dist/constants/commands.d.mts.map +1 -1
- package/dist/constants/commands.mjs +8 -0
- package/dist/constants/commands.mjs.map +1 -1
- package/dist/constants/devtools.cjs +8 -0
- package/dist/constants/devtools.d.mts +2 -0
- package/dist/constants/devtools.d.mts.map +1 -1
- package/dist/constants/devtools.mjs +8 -0
- package/dist/constants/devtools.mjs.map +1 -1
- package/dist/constants/environments.cjs +8 -0
- package/dist/constants/environments.d.mts +2 -0
- package/dist/constants/environments.d.mts.map +1 -1
- package/dist/constants/environments.mjs +8 -0
- package/dist/constants/environments.mjs.map +1 -1
- package/dist/constants/extensions.cjs +8 -0
- package/dist/constants/extensions.d.mts +2 -0
- package/dist/constants/extensions.d.mts.map +1 -1
- package/dist/constants/extensions.mjs +8 -0
- package/dist/constants/extensions.mjs.map +1 -1
- package/dist/constants/fs.cjs +8 -0
- package/dist/constants/fs.d.mts +2 -0
- package/dist/constants/fs.d.mts.map +1 -1
- package/dist/constants/fs.mjs +8 -0
- package/dist/constants/fs.mjs.map +1 -1
- package/dist/constants/hooks.cjs +8 -0
- package/dist/constants/hooks.d.mts +2 -0
- package/dist/constants/hooks.d.mts.map +1 -1
- package/dist/constants/hooks.mjs +8 -0
- package/dist/constants/hooks.mjs.map +1 -1
- package/dist/constants/index.cjs +8 -0
- package/dist/constants/index.d.mts +2 -0
- package/dist/constants/index.mjs +8 -0
- package/dist/constants/log-level.cjs +8 -0
- package/dist/constants/log-level.d.mts +2 -0
- package/dist/constants/log-level.d.mts.map +1 -1
- package/dist/constants/log-level.mjs +8 -0
- package/dist/constants/log-level.mjs.map +1 -1
- package/dist/constants/meta.cjs +8 -0
- package/dist/constants/meta.d.mts +2 -0
- package/dist/constants/meta.d.mts.map +1 -1
- package/dist/constants/meta.mjs +8 -0
- package/dist/constants/meta.mjs.map +1 -1
- package/dist/constants/plugin.cjs +8 -0
- package/dist/constants/plugin.d.mts +2 -0
- package/dist/constants/plugin.d.mts.map +1 -1
- package/dist/constants/plugin.mjs +8 -0
- package/dist/constants/plugin.mjs.map +1 -1
- package/dist/context/base-context.cjs +8 -0
- package/dist/context/base-context.d.mts +2 -0
- package/dist/context/base-context.d.mts.map +1 -1
- package/dist/context/base-context.mjs +8 -0
- package/dist/context/base-context.mjs.map +1 -1
- package/dist/context/context.cjs +18 -2
- package/dist/context/context.d.cts +4 -0
- package/dist/context/context.d.cts.map +1 -1
- package/dist/context/context.d.mts +6 -0
- package/dist/context/context.d.mts.map +1 -1
- package/dist/context/context.mjs +19 -3
- package/dist/context/context.mjs.map +1 -1
- package/dist/context/environment-context.cjs +8 -0
- package/dist/context/environment-context.d.cts.map +1 -1
- package/dist/context/environment-context.d.mts +2 -0
- package/dist/context/environment-context.d.mts.map +1 -1
- package/dist/context/environment-context.mjs +8 -0
- package/dist/context/environment-context.mjs.map +1 -1
- package/dist/context/execution-context.cjs +9 -1
- package/dist/context/execution-context.d.mts +2 -0
- package/dist/context/execution-context.d.mts.map +1 -1
- package/dist/context/execution-context.mjs +9 -1
- package/dist/context/execution-context.mjs.map +1 -1
- package/dist/context/index.cjs +8 -0
- package/dist/context/index.d.mts +2 -0
- package/dist/context/index.mjs +8 -0
- package/dist/context/plugin-context.cjs +8 -0
- package/dist/context/plugin-context.d.mts +2 -0
- package/dist/context/plugin-context.d.mts.map +1 -1
- package/dist/context/plugin-context.mjs +8 -0
- package/dist/context/plugin-context.mjs.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +8 -0
- package/dist/lib/config.cjs +8 -0
- package/dist/lib/config.d.mts +2 -0
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs +8 -0
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/context-helpers.cjs +8 -0
- package/dist/lib/context-helpers.d.cts +4 -4
- package/dist/lib/context-helpers.d.mts +6 -4
- package/dist/lib/context-helpers.d.mts.map +1 -1
- package/dist/lib/context-helpers.mjs +8 -0
- package/dist/lib/context-helpers.mjs.map +1 -1
- package/dist/lib/entry.cjs +8 -0
- package/dist/lib/entry.d.mts +2 -0
- package/dist/lib/entry.d.mts.map +1 -1
- package/dist/lib/entry.mjs +8 -0
- package/dist/lib/entry.mjs.map +1 -1
- package/dist/lib/environment.cjs +8 -0
- package/dist/lib/environment.d.mts +2 -0
- package/dist/lib/environment.d.mts.map +1 -1
- package/dist/lib/environment.mjs +8 -0
- package/dist/lib/environment.mjs.map +1 -1
- package/dist/lib/events.cjs +8 -0
- package/dist/lib/events.d.mts +2 -0
- package/dist/lib/events.d.mts.map +1 -1
- package/dist/lib/events.mjs +8 -0
- package/dist/lib/events.mjs.map +1 -1
- package/dist/lib/generate-types.cjs +8 -0
- package/dist/lib/generate-types.d.mts +2 -0
- package/dist/lib/generate-types.d.mts.map +1 -1
- package/dist/lib/generate-types.mjs +8 -0
- package/dist/lib/generate-types.mjs.map +1 -1
- package/dist/lib/hooks.cjs +8 -0
- package/dist/lib/hooks.d.mts +2 -0
- package/dist/lib/hooks.d.mts.map +1 -1
- package/dist/lib/hooks.mjs +8 -0
- package/dist/lib/hooks.mjs.map +1 -1
- package/dist/lib/index.cjs +8 -0
- package/dist/lib/index.d.mts +2 -0
- package/dist/lib/index.mjs +8 -0
- package/dist/lib/install-dependencies.cjs +8 -0
- package/dist/lib/install-dependencies.d.mts +2 -0
- package/dist/lib/install-dependencies.d.mts.map +1 -1
- package/dist/lib/install-dependencies.mjs +8 -0
- package/dist/lib/install-dependencies.mjs.map +1 -1
- package/dist/lib/meta.cjs +8 -0
- package/dist/lib/meta.d.mts +2 -0
- package/dist/lib/meta.d.mts.map +1 -1
- package/dist/lib/meta.mjs +8 -0
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/plugins.cjs +8 -0
- package/dist/lib/plugins.d.mts +2 -0
- package/dist/lib/plugins.d.mts.map +1 -1
- package/dist/lib/plugins.mjs +8 -0
- package/dist/lib/plugins.mjs.map +1 -1
- package/dist/lib/resolver.cjs +8 -0
- package/dist/lib/resolver.d.mts +2 -0
- package/dist/lib/resolver.d.mts.map +1 -1
- package/dist/lib/resolver.mjs +8 -0
- package/dist/lib/resolver.mjs.map +1 -1
- package/dist/lib/schemas.cjs +8 -0
- package/dist/lib/schemas.d.mts +2 -0
- package/dist/lib/schemas.mjs +8 -0
- package/dist/lib/streaming-channel.cjs +8 -0
- package/dist/lib/streaming-channel.d.mts +2 -0
- package/dist/lib/streaming-channel.d.mts.map +1 -1
- package/dist/lib/streaming-channel.mjs +8 -0
- package/dist/lib/streaming-channel.mjs.map +1 -1
- package/dist/lib/typescript/index.cjs +8 -0
- package/dist/lib/typescript/index.d.mts +2 -0
- package/dist/lib/typescript/index.mjs +8 -0
- package/dist/lib/typescript/ts-morph.cjs +8 -0
- package/dist/lib/typescript/ts-morph.d.mts +2 -0
- package/dist/lib/typescript/ts-morph.d.mts.map +1 -1
- package/dist/lib/typescript/ts-morph.mjs +8 -0
- package/dist/lib/typescript/ts-morph.mjs.map +1 -1
- package/dist/lib/typescript/tsconfig.cjs +8 -0
- package/dist/lib/typescript/tsconfig.d.mts +2 -0
- package/dist/lib/typescript/tsconfig.d.mts.map +1 -1
- package/dist/lib/typescript/tsconfig.mjs +8 -0
- package/dist/lib/typescript/tsconfig.mjs.map +1 -1
- package/dist/lib/unplugin/helpers.cjs +8 -0
- package/dist/lib/unplugin/helpers.d.mts +2 -0
- package/dist/lib/unplugin/helpers.d.mts.map +1 -1
- package/dist/lib/unplugin/helpers.mjs +8 -0
- package/dist/lib/unplugin/helpers.mjs.map +1 -1
- package/dist/lib/unplugin/index.cjs +8 -0
- package/dist/lib/unplugin/index.d.mts +2 -0
- package/dist/lib/unplugin/index.mjs +8 -0
- package/dist/lib/unplugin/module-resolution.cjs +8 -0
- package/dist/lib/unplugin/module-resolution.d.mts +2 -0
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -1
- package/dist/lib/unplugin/module-resolution.mjs +8 -0
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +8 -0
- package/dist/lib/unplugin/plugin.d.mts +2 -0
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs +8 -0
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/file-header.cjs +8 -0
- package/dist/lib/utilities/file-header.d.mts +2 -0
- package/dist/lib/utilities/file-header.d.mts.map +1 -1
- package/dist/lib/utilities/file-header.mjs +8 -0
- package/dist/lib/utilities/file-header.mjs.map +1 -1
- package/dist/lib/utilities/format.cjs +8 -0
- package/dist/lib/utilities/format.d.mts +2 -0
- package/dist/lib/utilities/format.d.mts.map +1 -1
- package/dist/lib/utilities/format.mjs +8 -0
- package/dist/lib/utilities/format.mjs.map +1 -1
- package/dist/lib/utilities/index.cjs +8 -0
- package/dist/lib/utilities/index.d.mts +2 -0
- package/dist/lib/utilities/index.mjs +8 -0
- package/dist/lib/utilities/source-file.cjs +8 -0
- package/dist/lib/utilities/source-file.d.mts +2 -0
- package/dist/lib/utilities/source-file.d.mts.map +1 -1
- package/dist/lib/utilities/source-file.mjs +8 -0
- package/dist/lib/utilities/source-file.mjs.map +1 -1
- package/dist/lib/utilities/source-map.cjs +8 -0
- package/dist/lib/utilities/source-map.d.mts +2 -0
- package/dist/lib/utilities/source-map.d.mts.map +1 -1
- package/dist/lib/utilities/source-map.mjs +8 -0
- package/dist/lib/utilities/source-map.mjs.map +1 -1
- package/dist/lib/utilities/write-file.cjs +8 -0
- package/dist/lib/utilities/write-file.d.mts +2 -0
- package/dist/lib/utilities/write-file.d.mts.map +1 -1
- package/dist/lib/utilities/write-file.mjs +8 -0
- package/dist/lib/utilities/write-file.mjs.map +1 -1
- package/dist/lib/vfs.cjs +8 -0
- package/dist/lib/vfs.d.mts +2 -0
- package/dist/lib/vfs.d.mts.map +1 -1
- package/dist/lib/vfs.mjs +8 -0
- package/dist/lib/vfs.mjs.map +1 -1
- package/dist/plugin-base.cjs +8 -0
- package/dist/plugin-base.d.mts +2 -0
- package/dist/plugin-base.d.mts.map +1 -1
- package/dist/plugin-base.mjs +8 -0
- package/dist/plugin-base.mjs.map +1 -1
- package/dist/plugin-utils/build-helpers.cjs +8 -0
- package/dist/plugin-utils/build-helpers.d.mts +2 -0
- package/dist/plugin-utils/build-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/build-helpers.mjs +8 -0
- package/dist/plugin-utils/build-helpers.mjs.map +1 -1
- package/dist/plugin-utils/combine-plugins.cjs +8 -0
- package/dist/plugin-utils/combine-plugins.d.mts +2 -0
- package/dist/plugin-utils/combine-plugins.d.mts.map +1 -1
- package/dist/plugin-utils/combine-plugins.mjs +8 -0
- package/dist/plugin-utils/combine-plugins.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +35 -0
- package/dist/plugin-utils/context-helpers.d.cts +25 -1
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +27 -1
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +35 -1
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/docs-helper.cjs +8 -0
- package/dist/plugin-utils/docs-helper.d.mts +2 -0
- package/dist/plugin-utils/docs-helper.d.mts.map +1 -1
- package/dist/plugin-utils/docs-helper.mjs +8 -0
- package/dist/plugin-utils/docs-helper.mjs.map +1 -1
- package/dist/plugin-utils/enable-plugin.cjs +8 -0
- package/dist/plugin-utils/enable-plugin.d.mts +2 -0
- package/dist/plugin-utils/enable-plugin.d.mts.map +1 -1
- package/dist/plugin-utils/enable-plugin.mjs +8 -0
- package/dist/plugin-utils/enable-plugin.mjs.map +1 -1
- package/dist/plugin-utils/extend.cjs +8 -0
- package/dist/plugin-utils/extend.d.mts +2 -0
- package/dist/plugin-utils/extend.d.mts.map +1 -1
- package/dist/plugin-utils/extend.mjs +8 -0
- package/dist/plugin-utils/extend.mjs.map +1 -1
- package/dist/plugin-utils/filter.cjs +8 -0
- package/dist/plugin-utils/filter.d.mts +2 -0
- package/dist/plugin-utils/filter.d.mts.map +1 -1
- package/dist/plugin-utils/filter.mjs +8 -0
- package/dist/plugin-utils/filter.mjs.map +1 -1
- package/dist/plugin-utils/format-package-json.cjs +8 -0
- package/dist/plugin-utils/format-package-json.d.mts +2 -0
- package/dist/plugin-utils/format-package-json.d.mts.map +1 -1
- package/dist/plugin-utils/format-package-json.mjs +8 -0
- package/dist/plugin-utils/format-package-json.mjs.map +1 -1
- package/dist/plugin-utils/format.cjs +8 -0
- package/dist/plugin-utils/format.d.mts +2 -0
- package/dist/plugin-utils/format.d.mts.map +1 -1
- package/dist/plugin-utils/format.mjs +8 -0
- package/dist/plugin-utils/format.mjs.map +1 -1
- package/dist/plugin-utils/get-config-path.cjs +8 -0
- package/dist/plugin-utils/get-config-path.d.mts +2 -0
- package/dist/plugin-utils/get-config-path.d.mts.map +1 -1
- package/dist/plugin-utils/get-config-path.mjs +8 -0
- package/dist/plugin-utils/get-config-path.mjs.map +1 -1
- package/dist/plugin-utils/helpers.cjs +8 -0
- package/dist/plugin-utils/helpers.d.mts +2 -0
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs +8 -0
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +9 -0
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +4 -2
- package/dist/plugin-utils/index.mjs +10 -2
- package/dist/plugin-utils/install.cjs +8 -0
- package/dist/plugin-utils/install.d.mts +2 -0
- package/dist/plugin-utils/install.d.mts.map +1 -1
- package/dist/plugin-utils/install.mjs +8 -0
- package/dist/plugin-utils/install.mjs.map +1 -1
- package/dist/plugin-utils/logging.cjs +8 -0
- package/dist/plugin-utils/logging.d.mts +2 -0
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +8 -0
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/plugin-utils/merge.cjs +8 -0
- package/dist/plugin-utils/merge.d.mts +2 -0
- package/dist/plugin-utils/merge.d.mts.map +1 -1
- package/dist/plugin-utils/merge.mjs +8 -0
- package/dist/plugin-utils/merge.mjs.map +1 -1
- package/dist/plugin-utils/modules.cjs +8 -0
- package/dist/plugin-utils/modules.d.mts +2 -0
- package/dist/plugin-utils/modules.d.mts.map +1 -1
- package/dist/plugin-utils/modules.mjs +8 -0
- package/dist/plugin-utils/modules.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +8 -0
- package/dist/plugin-utils/paths.d.mts +2 -0
- package/dist/plugin-utils/paths.d.mts.map +1 -1
- package/dist/plugin-utils/paths.mjs +8 -0
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/plugin-utils/virtual.cjs +8 -0
- package/dist/plugin-utils/virtual.d.mts +2 -0
- package/dist/plugin-utils/virtual.d.mts.map +1 -1
- package/dist/plugin-utils/virtual.mjs +8 -0
- package/dist/plugin-utils/virtual.mjs.map +1 -1
- package/dist/schemas/fs.cjs +8 -0
- package/dist/schemas/fs.d.mts +2 -0
- package/dist/schemas/fs.d.mts.map +1 -1
- package/dist/schemas/fs.mjs +8 -0
- package/dist/schemas/fs.mjs.map +1 -1
- package/dist/storage/base.cjs +8 -0
- package/dist/storage/base.d.mts +2 -0
- package/dist/storage/base.d.mts.map +1 -1
- package/dist/storage/base.mjs +8 -0
- package/dist/storage/base.mjs.map +1 -1
- package/dist/storage/file-system.cjs +8 -0
- package/dist/storage/file-system.d.mts +2 -0
- package/dist/storage/file-system.d.mts.map +1 -1
- package/dist/storage/file-system.mjs +8 -0
- package/dist/storage/file-system.mjs.map +1 -1
- package/dist/storage/helpers.cjs +8 -0
- package/dist/storage/helpers.d.mts +2 -0
- package/dist/storage/helpers.d.mts.map +1 -1
- package/dist/storage/helpers.mjs +8 -0
- package/dist/storage/helpers.mjs.map +1 -1
- package/dist/storage/index.cjs +8 -0
- package/dist/storage/index.d.mts +2 -0
- package/dist/storage/index.mjs +8 -0
- package/dist/storage/virtual.cjs +8 -0
- package/dist/storage/virtual.d.mts +2 -0
- package/dist/storage/virtual.d.mts.map +1 -1
- package/dist/storage/virtual.mjs +8 -0
- package/dist/storage/virtual.mjs.map +1 -1
- package/dist/types/api.d.cts +3 -3
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +5 -3
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/config.d.cts +2 -2
- package/dist/types/config.d.mts +4 -2
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +7 -3
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +9 -3
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/fs.d.mts +2 -0
- package/dist/types/fs.d.mts.map +1 -1
- package/dist/types/hooks.d.mts +2 -0
- package/dist/types/hooks.d.mts.map +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.mts +3 -1
- package/dist/types/logging.d.mts +2 -0
- package/dist/types/logging.d.mts.map +1 -1
- package/dist/types/plugin.d.mts +2 -0
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/tsconfig.d.mts +2 -0
- package/dist/types/tsconfig.d.mts.map +1 -1
- package/dist/types/unplugin.d.mts +2 -0
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-context.d.cts","names":[],"sources":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AiB,aAAA,CAAc,eAAA,EAAiB,cAAA,GAAiB,IAAA;EAiGlC;;;;;;;;;;;;EAAA,UAvBzB,WAAA,CACP,SAAA,EAAW,gBAAA,CAAiB,eAAA,EAAiB,cAAA,GAC7C,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,eAAA,EACR,gBAAA,EAAkB,sBAAA,CAChB,yBAAA,CAA0B,eAAA;EAlUnB;;;;;EAAA,UAoVQ,WAAA,CAAA,GAAe,yBAAA,CAA0B,eAAA;AAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { HooksList } from "../types/hooks.mjs";
|
|
2
4
|
import { Logger, LoggerOptions } from "../types/logging.mjs";
|
|
3
5
|
import { EnvironmentContext, EnvironmentPlugin, ExecutionContext, PluginContext, SelectHookResult, SelectHooksOptions } from "../types/context.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-context.d.mts","names":[],"sources":["../../src/context/environment-context.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"environment-context.d.mts","names":[],"sources":["../../src/context/environment-context.ts"],"mappings":";;;;;;;;cA2Da,4BAAA,yBACa,cAAA,GAAiB,cAAA,oCAGjC,iBAAA,CACN,yBAAA,CAA0B,eAAA,GAC1B,cAAA,aAES,kBAAA,CAAmB,eAAA,EAAiB,cAAA;EAAA;;;;;;;;;;SAwB3B,IAAA,yBACM,cAAA,GAAiB,cAAA,2BAAA,CAGzC,SAAA,EAAW,gBAAA,CAAiB,eAAA,EAAiB,cAAA,GAC7C,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,eAAA,EACR,gBAAA,EAAkB,sBAAA,CAChB,yBAAA,CAA0B,eAAA,KAE3B,OAAA,CAAQ,4BAAA,CAA6B,eAAA,EAAiB,cAAA;;;AA1C3D;YAuDqB,iBAAA,EAAmB,yBAAA,CAA0B,eAAA;EAvDzB;;;EA6DhC,OAAA,EAAS,iBAAA,CAAkB,eAAA,EAAiB,cAAA;EAxDjD;;;EAAA,IA6DS,EAAA,CAAA;EAjCe;;;EAAA,IAwCf,KAAA,CAAA,GAAS,MAAA,SAElB,SAAA,CAAU,aAAA,CAAc,eAAA,EAAiB,cAAA;EAvC9B;;;;;;;;EAAA,IAoDF,kBAAA,CAAA,GAAsB,gBAAA,CAC/B,eAAA,EACA,cAAA;EAhDC;;;;;;EA2DU,oBAAA,CACX,MAAA,EAAQ,yBAAA,CAA0B,eAAA,mBACjC,OAAA;EA5BwC;;;;;;EA4C3B,YAAA,CAAa,OAAA,EAAS,aAAA,GAAgB,MAAA;EAjBlB;;;;;;EA8BpB,YAAA,CAAa,OAAA,EAAS,aAAA,GAAgB,MAAA;EAgBjB;;;;;;;;EADxB,kBAAA,CACX,MAAA,EAAQ,YAAA,CAAa,aAAA,CAAc,eAAA,EAAiB,cAAA,KACnD,OAAA;EAsGiB;;;EAHb,WAAA,qBAAA,CACL,GAAA,EAAK,IAAA,EACL,OAAA,GAAU,kBAAA,GACT,gBAAA,CAAiB,aAAA,CAAc,eAAA,EAAiB,cAAA,GAAiB,IAAA;EA2ErB;;;;;;;;;;;;EAAA,UADtC,WAAA,CACP,SAAA,EAAW,gBAAA,CAAiB,eAAA,EAAiB,cAAA,GAC7C,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,eAAA,EACR,gBAAA,EAAkB,sBAAA,CAChB,yBAAA,CAA0B,eAAA;EAzU9B;;;;;EAAA,UA2VmB,WAAA,CAAA,GAAe,yBAAA,CAA0B,eAAA;AAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT } from "../constants/environments.mjs";
|
|
2
10
|
import { PLUGIN_NON_HOOK_FIELDS } from "../constants/plugin.mjs";
|
|
3
11
|
import { dedupeHooklist, isPlugin, isPluginConfig, isPluginHookField } from "../plugin-utils/helpers.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-context.mjs","names":["#hooks","#execution"],"sources":["../../src/context/environment-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { omit } from \"@stryke/helpers/omit\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport {\n DEFAULT_ENVIRONMENT,\n GLOBAL_ENVIRONMENT,\n PLUGIN_NON_HOOK_FIELDS\n} from \"../constants\";\nimport { extractHooks } from \"../lib/hooks\";\nimport { resolvePlugins } from \"../lib/plugins\";\nimport {\n dedupeHooklist,\n formatConfig,\n isPlugin,\n isPluginConfig,\n isPluginHookField,\n mergeConfig\n} from \"../plugin-utils\";\nimport type {\n EnvironmentContext,\n EnvironmentPlugin,\n EnvironmentResolvedConfig,\n ExecutionContext,\n ExecutionOptions,\n HooksList,\n HooksListItem,\n InferOverridableConfig,\n Logger,\n LoggerOptions,\n PluginConfig,\n PluginContext,\n ResolvedConfig,\n SelectHookResult,\n SelectHooksOptions\n} from \"../types\";\nimport { PowerlinesContext } from \"./context\";\nimport { createPluginContext } from \"./plugin-context\";\n\nexport class PowerlinesEnvironmentContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesContext<\n EnvironmentResolvedConfig<TResolvedConfig>,\n TSystemContext\n >\n implements EnvironmentContext<TResolvedConfig, TSystemContext>\n{\n /**\n * The hooks registered by plugins in this environment\n */\n #hooks: Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n > = {};\n\n /**\n * The execution context associated with this environment, which provides access to the project configuration, environment, and utility functions for performing the build. The execution context is used to manage the state and behavior of the build process across multiple environments, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\n #execution: ExecutionContext<TResolvedConfig, TSystemContext>;\n\n /**\n * Create a new context from the config.\n *\n * @param execution - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n * @param options - The resolved execution options.\n * @param config - The user configuration options.\n * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.\n * @returns A promise that resolves to an instance of the PowerlinesEnvironmentContext class, initialized with the provided configuration and environment data.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n >(\n execution: ExecutionContext<TResolvedConfig, TSystemContext>,\n options: ExecutionOptions,\n config: TResolvedConfig,\n overriddenConfig: InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>> {\n const context = new PowerlinesEnvironmentContext<\n TResolvedConfig,\n TSystemContext\n >(execution, options, config, overriddenConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The configuration options provided by plugins added by the user (and other plugins)\n */\n protected override environmentConfig: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"] =\n {} as EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"];\n\n /**\n * The list of plugins applied to this environment\n */\n public plugins: EnvironmentPlugin<TResolvedConfig, TSystemContext>[] = [];\n\n /**\n * The unique identifier of the environment associated with this context, which can be used for logging and other purposes to distinguish between different environments in the same process.\n */\n public get id(): string {\n return this.config.environment.id;\n }\n\n /**\n * The hooks registered by plugins in this environment\n */\n public get hooks(): Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n > {\n return this.#hooks;\n }\n\n /**\n * The execution context associated with this environment, which provides access to the project configuration, environment, and utility functions for performing the build. The execution context is used to manage the state and behavior of the build process across multiple environments, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\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 get unstable_execution(): ExecutionContext<\n TResolvedConfig,\n TSystemContext\n > {\n return this.#execution;\n }\n\n /**\n * A setter function to populate the environment config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the environment configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any environment configuration provided during execution.\n *\n * @param config - The environment configuration values to set.\n * @returns A promise that resolves when the environment configuration values have been set.\n */\n public async setEnvironmentConfig(\n config: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating environment configuration object: \\n${formatConfig(config)}`\n });\n\n this.environmentConfig = config;\n await this.resolveConfig();\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public override createLogger(options: LoggerOptions): Logger {\n return super.createLogger({\n ...options,\n environment: this.environmentConfig?.name || this.config.environment?.name\n });\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public override extendLogger(options: LoggerOptions): Logger {\n return super.extendLogger({\n ...options,\n environment: this.environmentConfig?.name || this.config.environment?.name\n });\n }\n\n /**\n * A function used internally to add a plugin to the context and update the configuration options\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 async unstable_addPlugin(\n plugin: PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>\n ): Promise<void> {\n const plugins = await resolvePlugins<TResolvedConfig, TSystemContext>(\n this,\n plugin,\n {\n skipLogging: !!(\n this.environmentConfig?.name &&\n this.environmentConfig.name !== DEFAULT_ENVIRONMENT &&\n this.environmentConfig.name !== GLOBAL_ENVIRONMENT\n )\n }\n );\n for (const plugin of plugins) {\n let resolvedPlugin = plugin as EnvironmentPlugin<\n TResolvedConfig,\n TSystemContext\n >;\n if (isFunction(plugin.applyToEnvironment)) {\n const result = (await Promise.resolve(\n plugin.applyToEnvironment(this.config.environment) as Promise<any>\n )) as\n | boolean\n | PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>;\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (\n isPluginConfig<PluginContext<TResolvedConfig, TSystemContext>>(result)\n ) {\n return this.unstable_addPlugin(result);\n }\n\n resolvedPlugin = (\n isPlugin<PluginContext<TResolvedConfig, TSystemContext>>(result)\n ? result\n : plugin\n ) as EnvironmentPlugin<TResolvedConfig, TSystemContext>;\n }\n\n const id = uuid();\n const context = createPluginContext<TResolvedConfig, TSystemContext>(\n id,\n resolvedPlugin,\n this\n );\n\n resolvedPlugin[\"~internal\"] = {\n id,\n context\n };\n\n this.plugins.push(resolvedPlugin);\n\n this.#hooks = Object.entries(\n Object.keys(resolvedPlugin)\n .filter(\n key =>\n key !== \"~internal\" &&\n !PLUGIN_NON_HOOK_FIELDS.includes(\n key as ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n )\n )\n .reduce(\n (ret, key) =>\n extractHooks<TResolvedConfig, TSystemContext>(\n context,\n ret,\n resolvedPlugin,\n key\n ),\n this.hooks\n )\n ).reduce(\n (ret, [key, value]) => {\n if (isSetObject(value)) {\n Object.entries(value).forEach(([type, list]) => {\n ret[key] ??= {};\n ret[key][type as keyof (typeof ret)[typeof key]] =\n dedupeHooklist<PluginContext<TResolvedConfig, TSystemContext>>(\n list\n );\n });\n }\n\n return ret;\n },\n {} as Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n >\n );\n }\n }\n\n /**\n * Retrieves the hook handlers for a specific hook name\n */\n public selectHooks<TKey extends string>(\n key: TKey,\n options?: SelectHooksOptions\n ): SelectHookResult<PluginContext<TResolvedConfig, TSystemContext>, TKey> {\n const result = [] as SelectHookResult<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >;\n\n if (\n isPluginHookField<PluginContext<TResolvedConfig, TSystemContext>>(key) &&\n this.hooks[key]\n ) {\n if (this.hooks[key]) {\n if (options?.order) {\n const mapHooksToResult = (\n hooksList: HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >[]\n ): SelectHookResult<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n > =>\n hooksList.map(hook => {\n const plugin = this.plugins.find(\n p => p.name === hook.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n hook.plugin.name\n }\".`\n );\n }\n\n return {\n handler: hook.handler,\n plugin: hook.plugin,\n context: plugin[\"~internal\"].context\n };\n });\n\n if (options?.order === \"pre\") {\n result.push(...mapHooksToResult(this.hooks[key].preOrdered ?? []));\n result.push(...mapHooksToResult(this.hooks[key].preEnforced ?? []));\n } else if (options?.order === \"post\") {\n result.push(...mapHooksToResult(this.hooks[key].postOrdered ?? []));\n result.push(\n ...mapHooksToResult(this.hooks[key].postEnforced ?? [])\n );\n } else {\n result.push(...mapHooksToResult(this.hooks[key].normal ?? []));\n }\n } else {\n result.push(...this.selectHooks(key, { order: \"pre\" }));\n result.push(...this.selectHooks(key, { order: \"normal\" }));\n result.push(...this.selectHooks(key, { order: \"post\" }));\n }\n }\n }\n\n return result;\n }\n\n /**\n * A function to add a plugin to the context and update the configuration options. This function is used internally when applying plugins to the environment, and it ensures that the plugin is added to the list of plugins in the context and that any hooks or configuration options provided by the plugin are properly integrated into the context's state.\n *\n * @remarks\n * This function is used internally when applying plugins to the environment, and it ensures that the plugin is added to the list of plugins in the context and that any hooks or configuration options provided by the plugin are properly integrated into the context's state. It should not be called directly by external code, as it is intended for internal use only and may be subject to change without warning.\n *\n * @param execution - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n * @param options - The configuration options for the plugin, which may include properties such as the plugin name, hooks, and any other relevant metadata or settings that should be associated with the plugin when it is added to the context.\n * @param config - The resolved configuration for the environment, which may include properties such as the environment name, SSR settings, and other relevant configuration options that may affect how the plugin is applied to the environment.\n * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.\n * @returns A promise that resolves when the plugin has been added to the context and the configuration has been updated accordingly.\n */\n protected constructor(\n execution: ExecutionContext<TResolvedConfig, TSystemContext>,\n options: ExecutionOptions,\n config: TResolvedConfig,\n overriddenConfig: InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n ) {\n super(options);\n\n this.#execution = execution;\n this.userConfig =\n config.userConfig ?? ({} as TResolvedConfig[\"userConfig\"]);\n this.inlineConfig =\n config.inlineConfig ?? ({} as TResolvedConfig[\"inlineConfig\"]);\n this.pluginConfig = config.pluginConfig ?? {};\n this.overriddenConfig = overriddenConfig;\n }\n\n /**\n * A function to merge the various configuration objects (initial, user, inline, and plugin) into a single resolved configuration object that can be used throughout the Powerlines process. This function takes into account the different sources of configuration and their respective priorities, ensuring that the final configuration reflects the intended settings for the project. The merged configuration is then returned as a new object that can be accessed through the `config` property of the context.\n *\n * @returns The merged configuration object that combines the initial, user, inline, and plugin configurations.\n */\n protected override mergeConfig(): EnvironmentResolvedConfig<TResolvedConfig> {\n return mergeConfig(\n {\n ...omit(this.environmentConfig ?? {}, [\n \"name\",\n \"ssr\",\n \"preview\",\n \"consumer\",\n \"runtime\"\n ]),\n environment: {\n name: this.environmentConfig?.name || DEFAULT_ENVIRONMENT\n },\n environmentConfig: this.environmentConfig ?? {}\n },\n super.mergeConfig()\n ) as EnvironmentResolvedConfig<TResolvedConfig>;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2DA,IAAa,+BAAb,MAAa,qCAIH,kBAKV;;;;CAIE,SAGI,CAAC;;;;CAKL;;;;;;;;;;CAWA,aAAoB,KAIlB,WACA,SACA,QACA,kBAGwE;EACxE,MAAM,UAAU,IAAI,6BAGlB,WAAW,SAAS,QAAQ,gBAAgB;EAC9C,MAAM,QAAQ,KAAK;EAEnB,OAAO;CACT;;;;CAKA,AAAmB,oBACjB,CAAC;;;;CAKH,AAAO,UAAgE,CAAC;;;;CAKxE,IAAW,KAAa;EACtB,OAAO,KAAK,OAAO,YAAY;CACjC;;;;CAKA,IAAW,QAGT;EACA,OAAO,KAAKA;CACd;;;;;;;;;CAUA,IAAW,qBAGT;EACA,OAAO,KAAKC;CACd;;;;;;;CAQA,MAAa,qBACX,QACe;EACf,KAAK,OAAO,MAAM;GAChB,MAAM,EAAE,UAAU,SAAS;GAC3B,SAAS,gDAAgD,aAA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OAAO,OAAO,CAAC,CAAC;GACzD;EACF;EAGF,OAAO;CACT;;;;;;;;;;;;;CAcA,AAAU,YACR,WACA,SACA,QACA,kBAGA;EACA,MAAM,OAAO;EAEb,KAAKC,aAAa;EAClB,KAAK,aACH,OAAO,cAAe,CAAC;EACzB,KAAK,eACH,OAAO,gBAAiB,CAAC;EAC3B,KAAK,eAAe,OAAO,gBAAgB,CAAC;EAC5C,KAAK,mBAAmB;CAC1B;;;;;;CAOA,AAAmB,cAA0D;EAC3E,OAAO,YACL;GACE,GAAG,KAAK,KAAK,qBAAqB,CAAC,GAAG;IACpC;IACA;IACA;IACA;IACA;GACF,CAAC;GACD,aAAa,EACX,MAAM,KAAK,mBAAmB,kBAChC;GACA,mBAAmB,KAAK,qBAAqB,CAAC;EAChD,GACA,MAAM,YAAY,CACpB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"environment-context.mjs","names":["#hooks","#execution"],"sources":["../../src/context/environment-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { omit } from \"@stryke/helpers/omit\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport {\n DEFAULT_ENVIRONMENT,\n GLOBAL_ENVIRONMENT,\n PLUGIN_NON_HOOK_FIELDS\n} from \"../constants\";\nimport { extractHooks } from \"../lib/hooks\";\nimport { resolvePlugins } from \"../lib/plugins\";\nimport {\n dedupeHooklist,\n formatConfig,\n isPlugin,\n isPluginConfig,\n isPluginHookField,\n mergeConfig\n} from \"../plugin-utils\";\nimport type {\n EnvironmentContext,\n EnvironmentPlugin,\n EnvironmentResolvedConfig,\n ExecutionContext,\n ExecutionOptions,\n HooksList,\n HooksListItem,\n InferOverridableConfig,\n Logger,\n LoggerOptions,\n PluginConfig,\n PluginContext,\n ResolvedConfig,\n SelectHookResult,\n SelectHooksOptions\n} from \"../types\";\nimport { PowerlinesContext } from \"./context\";\nimport { createPluginContext } from \"./plugin-context\";\n\nexport class PowerlinesEnvironmentContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesContext<\n EnvironmentResolvedConfig<TResolvedConfig>,\n TSystemContext\n >\n implements EnvironmentContext<TResolvedConfig, TSystemContext>\n{\n /**\n * The hooks registered by plugins in this environment\n */\n #hooks: Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n > = {};\n\n /**\n * The execution context associated with this environment, which provides access to the project configuration, environment, and utility functions for performing the build. The execution context is used to manage the state and behavior of the build process across multiple environments, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\n #execution: ExecutionContext<TResolvedConfig, TSystemContext>;\n\n /**\n * Create a new context from the config.\n *\n * @param execution - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n * @param options - The resolved execution options.\n * @param config - The user configuration options.\n * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.\n * @returns A promise that resolves to an instance of the PowerlinesEnvironmentContext class, initialized with the provided configuration and environment data.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n >(\n execution: ExecutionContext<TResolvedConfig, TSystemContext>,\n options: ExecutionOptions,\n config: TResolvedConfig,\n overriddenConfig: InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>> {\n const context = new PowerlinesEnvironmentContext<\n TResolvedConfig,\n TSystemContext\n >(execution, options, config, overriddenConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The configuration options provided by plugins added by the user (and other plugins)\n */\n protected override environmentConfig: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"] =\n {} as EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"];\n\n /**\n * The list of plugins applied to this environment\n */\n public plugins: EnvironmentPlugin<TResolvedConfig, TSystemContext>[] = [];\n\n /**\n * The unique identifier of the environment associated with this context, which can be used for logging and other purposes to distinguish between different environments in the same process.\n */\n public get id(): string {\n return this.config.environment.id;\n }\n\n /**\n * The hooks registered by plugins in this environment\n */\n public get hooks(): Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n > {\n return this.#hooks;\n }\n\n /**\n * The execution context associated with this environment, which provides access to the project configuration, environment, and utility functions for performing the build. The execution context is used to manage the state and behavior of the build process across multiple environments, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\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 get unstable_execution(): ExecutionContext<\n TResolvedConfig,\n TSystemContext\n > {\n return this.#execution;\n }\n\n /**\n * A setter function to populate the environment config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the environment configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any environment configuration provided during execution.\n *\n * @param config - The environment configuration values to set.\n * @returns A promise that resolves when the environment configuration values have been set.\n */\n public async setEnvironmentConfig(\n config: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating environment configuration object: \\n${formatConfig(config)}`\n });\n\n this.environmentConfig = config;\n await this.resolveConfig();\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public override createLogger(options: LoggerOptions): Logger {\n return super.createLogger({\n ...options,\n environment: this.environmentConfig?.name || this.config.environment?.name\n });\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public override extendLogger(options: LoggerOptions): Logger {\n return super.extendLogger({\n ...options,\n environment: this.environmentConfig?.name || this.config.environment?.name\n });\n }\n\n /**\n * A function used internally to add a plugin to the context and update the configuration options\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 async unstable_addPlugin(\n plugin: PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>\n ): Promise<void> {\n const plugins = await resolvePlugins<TResolvedConfig, TSystemContext>(\n this,\n plugin,\n {\n skipLogging: !!(\n this.environmentConfig?.name &&\n this.environmentConfig.name !== DEFAULT_ENVIRONMENT &&\n this.environmentConfig.name !== GLOBAL_ENVIRONMENT\n )\n }\n );\n for (const plugin of plugins) {\n let resolvedPlugin = plugin as EnvironmentPlugin<\n TResolvedConfig,\n TSystemContext\n >;\n if (isFunction(plugin.applyToEnvironment)) {\n const result = (await Promise.resolve(\n plugin.applyToEnvironment(this.config.environment) as Promise<any>\n )) as\n | boolean\n | PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>;\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (\n isPluginConfig<PluginContext<TResolvedConfig, TSystemContext>>(result)\n ) {\n return this.unstable_addPlugin(result);\n }\n\n resolvedPlugin = (\n isPlugin<PluginContext<TResolvedConfig, TSystemContext>>(result)\n ? result\n : plugin\n ) as EnvironmentPlugin<TResolvedConfig, TSystemContext>;\n }\n\n const id = uuid();\n const context = createPluginContext<TResolvedConfig, TSystemContext>(\n id,\n resolvedPlugin,\n this\n );\n\n resolvedPlugin[\"~internal\"] = {\n id,\n context\n };\n\n this.plugins.push(resolvedPlugin);\n\n this.#hooks = Object.entries(\n Object.keys(resolvedPlugin)\n .filter(\n key =>\n key !== \"~internal\" &&\n !PLUGIN_NON_HOOK_FIELDS.includes(\n key as ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n )\n )\n .reduce(\n (ret, key) =>\n extractHooks<TResolvedConfig, TSystemContext>(\n context,\n ret,\n resolvedPlugin,\n key\n ),\n this.hooks\n )\n ).reduce(\n (ret, [key, value]) => {\n if (isSetObject(value)) {\n Object.entries(value).forEach(([type, list]) => {\n ret[key] ??= {};\n ret[key][type as keyof (typeof ret)[typeof key]] =\n dedupeHooklist<PluginContext<TResolvedConfig, TSystemContext>>(\n list\n );\n });\n }\n\n return ret;\n },\n {} as Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n >\n );\n }\n }\n\n /**\n * Retrieves the hook handlers for a specific hook name\n */\n public selectHooks<TKey extends string>(\n key: TKey,\n options?: SelectHooksOptions\n ): SelectHookResult<PluginContext<TResolvedConfig, TSystemContext>, TKey> {\n const result = [] as SelectHookResult<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >;\n\n if (\n isPluginHookField<PluginContext<TResolvedConfig, TSystemContext>>(key) &&\n this.hooks[key]\n ) {\n if (this.hooks[key]) {\n if (options?.order) {\n const mapHooksToResult = (\n hooksList: HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >[]\n ): SelectHookResult<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n > =>\n hooksList.map(hook => {\n const plugin = this.plugins.find(\n p => p.name === hook.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n hook.plugin.name\n }\".`\n );\n }\n\n return {\n handler: hook.handler,\n plugin: hook.plugin,\n context: plugin[\"~internal\"].context\n };\n });\n\n if (options?.order === \"pre\") {\n result.push(...mapHooksToResult(this.hooks[key].preOrdered ?? []));\n result.push(...mapHooksToResult(this.hooks[key].preEnforced ?? []));\n } else if (options?.order === \"post\") {\n result.push(...mapHooksToResult(this.hooks[key].postOrdered ?? []));\n result.push(\n ...mapHooksToResult(this.hooks[key].postEnforced ?? [])\n );\n } else {\n result.push(...mapHooksToResult(this.hooks[key].normal ?? []));\n }\n } else {\n result.push(...this.selectHooks(key, { order: \"pre\" }));\n result.push(...this.selectHooks(key, { order: \"normal\" }));\n result.push(...this.selectHooks(key, { order: \"post\" }));\n }\n }\n }\n\n return result;\n }\n\n /**\n * A function to add a plugin to the context and update the configuration options. This function is used internally when applying plugins to the environment, and it ensures that the plugin is added to the list of plugins in the context and that any hooks or configuration options provided by the plugin are properly integrated into the context's state.\n *\n * @remarks\n * This function is used internally when applying plugins to the environment, and it ensures that the plugin is added to the list of plugins in the context and that any hooks or configuration options provided by the plugin are properly integrated into the context's state. It should not be called directly by external code, as it is intended for internal use only and may be subject to change without warning.\n *\n * @param execution - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n * @param options - The configuration options for the plugin, which may include properties such as the plugin name, hooks, and any other relevant metadata or settings that should be associated with the plugin when it is added to the context.\n * @param config - The resolved configuration for the environment, which may include properties such as the environment name, SSR settings, and other relevant configuration options that may affect how the plugin is applied to the environment.\n * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.\n * @returns A promise that resolves when the plugin has been added to the context and the configuration has been updated accordingly.\n */\n protected constructor(\n execution: ExecutionContext<TResolvedConfig, TSystemContext>,\n options: ExecutionOptions,\n config: TResolvedConfig,\n overriddenConfig: InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n ) {\n super(options);\n\n this.#execution = execution;\n this.userConfig = config.userConfig ?? {};\n this.inlineConfig =\n config.inlineConfig ?? ({} as TResolvedConfig[\"inlineConfig\"]);\n this.pluginConfig = config.pluginConfig ?? {};\n this.overriddenConfig = overriddenConfig;\n }\n\n /**\n * A function to merge the various configuration objects (initial, user, inline, and plugin) into a single resolved configuration object that can be used throughout the Powerlines process. This function takes into account the different sources of configuration and their respective priorities, ensuring that the final configuration reflects the intended settings for the project. The merged configuration is then returned as a new object that can be accessed through the `config` property of the context.\n *\n * @returns The merged configuration object that combines the initial, user, inline, and plugin configurations.\n */\n protected override mergeConfig(): EnvironmentResolvedConfig<TResolvedConfig> {\n return mergeConfig(\n {\n ...omit(this.environmentConfig ?? {}, [\n \"name\",\n \"ssr\",\n \"preview\",\n \"consumer\",\n \"runtime\"\n ]),\n environment: {\n name: this.environmentConfig?.name || DEFAULT_ENVIRONMENT\n },\n environmentConfig: this.environmentConfig ?? {}\n },\n super.mergeConfig()\n ) as EnvironmentResolvedConfig<TResolvedConfig>;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAa,+BAAb,MAAa,qCAIH,kBAKV;;;;CAIE,SAGI,CAAC;;;;CAKL;;;;;;;;;;CAWA,aAAoB,KAIlB,WACA,SACA,QACA,kBAGwE;EACxE,MAAM,UAAU,IAAI,6BAGlB,WAAW,SAAS,QAAQ,gBAAgB;EAC9C,MAAM,QAAQ,KAAK;EAEnB,OAAO;CACT;;;;CAKA,AAAmB,oBACjB,CAAC;;;;CAKH,AAAO,UAAgE,CAAC;;;;CAKxE,IAAW,KAAa;EACtB,OAAO,KAAK,OAAO,YAAY;CACjC;;;;CAKA,IAAW,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L,OAAO,KAAK,GAAG,KAAK,YAAY,KAAK,EAAE,OAAO,MAAM,CAAC,CAAC;IACtD,OAAO,KAAK,GAAG,KAAK,YAAY,KAAK,EAAE,OAAO,SAAS,CAAC,CAAC;IACzD,OAAO,KAAK,GAAG,KAAK,YAAY,KAAK,EAAE,OAAO,OAAO,CAAC,CAAC;GACzD;EACF;EAGF,OAAO;CACT;;;;;;;;;;;;;CAcA,AAAU,YACR,WACA,SACA,QACA,kBAGA;EACA,MAAM,OAAO;EAEb,KAAKC,aAAa;EAClB,KAAK,aAAa,OAAO,cAAc,CAAC;EACxC,KAAK,eACH,OAAO,gBAAiB,CAAC;EAC3B,KAAK,eAAe,OAAO,gBAAgB,CAAC;EAC5C,KAAK,mBAAmB;CAC1B;;;;;;CAOA,AAAmB,cAA0D;EAC3E,OAAO,YACL;GACE,GAAG,KAAK,KAAK,qBAAqB,CAAC,GAAG;IACpC;IACA;IACA;IACA;IACA;GACF,CAAC;GACD,aAAa,EACX,MAAM,KAAK,mBAAmB,kBAChC;GACA,mBAAmB,KAAK,qBAAqB,CAAC;EAChD,GACA,MAAM,YAAY,CACpB;CACF;AACF"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
const require_constants_environments = require('../constants/environments.cjs');
|
|
@@ -42,7 +50,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends requir
|
|
|
42
50
|
* The unique identifier of the execution context, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
43
51
|
*/
|
|
44
52
|
get id() {
|
|
45
|
-
return this.
|
|
53
|
+
return this.executionId;
|
|
46
54
|
}
|
|
47
55
|
/**
|
|
48
56
|
* A record of all environments by name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-context.d.mts","names":[],"sources":["../../src/context/execution-context.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"execution-context.d.mts","names":[],"sources":["../../src/context/execution-context.ts"],"mappings":";;;;;;;;;;;cAmDa,0BAAA,yBACa,cAAA,GAAiB,cAAA,oCAGjC,iBAAA,CAAkB,eAAA,EAAiB,cAAA,aAChC,gBAAA,CAAiB,eAAA,EAAiB,cAAA;EAAA;;;;;;;;SAsBzB,IAAA,yBACM,cAAA,GAAiB,cAAA,2BAAA,CAGzC,OAAA,EAAS,gBAAA,EACT,YAAA,GAAe,eAAA,kBACf,MAAA,GAAS,cAAA,GACR,OAAA,CAAQ,gBAAA,CAAiB,eAAA,EAAiB,cAAA;;;;MAqBlC,EAAA,CAAA;;AAvDb;;MA8Da,YAAA,CAAA,GAAgB,MAAA,SAEzB,4BAAA,CAA6B,eAAA,EAAiB,cAAA;EAAA,IAKrC,OAAA,CAAA,GAAW,KAAA,CACpB,MAAA,CAAO,aAAA,CAAc,eAAA,EAAiB,cAAA;EArEC;;;EAAA,IA6ErB,EAAA,CAAA,GAAM,0BAAA;EAzEmB;;;;;EAAA,UAoFpC,WAAA,CAAa,OAAA,EAAS,gBAAA;EAvDH;;;;;;EAiEN,eAAA,CACpB,MAAA,EAAQ,eAAA,mBACP,OAAA;EAvCwB;;;;;;EA6DX,YAAA,CAAa,OAAA,EAAS,aAAA,GAAgB,MAAA;EAlCvB;;;;;;EAgDf,YAAA,CAAa,OAAA,EAAS,aAAA,GAAgB,MAAA;EAeb;;;;;;EAD5B,iBAAA,CACX,WAAA,EAAa,yBAAA,CAA0B,eAAA,mBACtC,OAAA,CAAQ,4BAAA,CAA6B,eAAA,EAAiB,cAAA;EAuGhB;;;EAvBnB,aAAA,CAAA,GAAa,OAAA;EAuEJ;;;;;;EAhDlB,cAAA,CAAe,IAAA,YAAa,OAAA,CAAA,4BAAA,CAAA,eAAA,EAAA,cAAA;EAiEX;;;;;;EApBjB,kBAAA,CACX,IAAA,YACC,OAAA,CACD,4BAAA,CAA6B,eAAA,EAAiB,cAAA;EA3SrC;;;;;;;;EA4TE,aAAA,CAAA,GAAiB,OAAA,CAC5B,4BAAA,CAA6B,eAAA,EAAiB,cAAA;EA9TL;;;;;;;;EA4V9B,kBAAA,CACX,MAAA,EAAQ,YAAA,CAAa,aAAA,CAAc,eAAA,EAAiB,cAAA,KAAgB,OAAA;AAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT } from "../constants/environments.mjs";
|
|
2
10
|
import { resolvePlugins } from "../lib/plugins.mjs";
|
|
3
11
|
import { PowerlinesContext } from "./context.mjs";
|
|
@@ -39,7 +47,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
39
47
|
* The unique identifier of the execution context, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
40
48
|
*/
|
|
41
49
|
get id() {
|
|
42
|
-
return this.
|
|
50
|
+
return this.executionId;
|
|
43
51
|
}
|
|
44
52
|
/**
|
|
45
53
|
* A record of all environments by name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-context.mjs","names":["#environments","#plugins"],"sources":["../../src/context/execution-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { deepClone } from \"@stryke/helpers/deep-clone\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport {\n DEFAULT_ENVIRONMENT,\n GLOBAL_ENVIRONMENT\n} from \"../constants/environments\";\nimport {\n createDefaultEnvironment,\n createEnvironment\n} from \"../lib/environment\";\nimport { resolvePlugins } from \"../lib/plugins\";\nimport type {\n EnvironmentResolvedConfig,\n ExecutionContext,\n ExecutionOptions,\n InferOverridableConfig,\n Logger,\n LoggerOptions,\n Plugin,\n PluginConfig,\n PluginContext,\n ResolvedConfig,\n VirtualFileSystemInterface\n} from \"../types\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesExecutionContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesContext<TResolvedConfig, TSystemContext>\n implements ExecutionContext<TResolvedConfig, TSystemContext>\n{\n /**\n * A record of all environments by name\n */\n #environments: Record<\n string,\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > = {};\n\n /**\n * The plugins added to this execution context, which may be used to track the plugins that have been added to the context and ensure that they are properly registered and executed during the build process. 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 #plugins: Plugin<PluginContext<TResolvedConfig, TSystemContext>>[] = [];\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param options - The execution options to create the context with.\n * @param inlineConfig - The inline configuration for the context.\n * @returns A promise that resolves to the new context.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n >(\n options: ExecutionOptions,\n inlineConfig?: TResolvedConfig[\"inlineConfig\"],\n system?: TSystemContext\n ): Promise<ExecutionContext<TResolvedConfig, TSystemContext>> {\n const context = new PowerlinesExecutionContext<\n TResolvedConfig,\n TSystemContext\n >(options);\n if (system) {\n context.system = system;\n }\n\n await context.init();\n\n if (inlineConfig) {\n await context.setInlineConfig(inlineConfig);\n }\n\n return context;\n }\n\n /**\n * The unique identifier of the execution context, which can be used for logging and other purposes to distinguish between different executions in the same process.\n */\n public get id(): string {\n return this.options.executionId;\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > {\n return this.#environments;\n }\n\n public get plugins(): Array<\n Plugin<PluginContext<TResolvedConfig, TSystemContext>>\n > {\n return this.#plugins;\n }\n\n /**\n * The virtual file system interface for the project\n */\n public override get fs(): VirtualFileSystemInterface {\n throw new Error(\n \"The virtual file system is not available on the execution context. Please use the environment context instead.\"\n );\n }\n\n /**\n * Creates a new instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n */\n protected constructor(options: ExecutionOptions) {\n super(options);\n }\n\n /**\n * A setter function to populate the inline config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the inline configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.\n *\n * @param config - The inline configuration values to set.\n * @returns A promise that resolves when the inline configuration values have been set.\n */\n public override async setInlineConfig(\n config: TResolvedConfig[\"inlineConfig\"]\n ): Promise<void> {\n await super.setInlineConfig(config);\n if (this.inlineConfig.command === \"new\") {\n const workspacePackageJsonPath = joinPaths(this.cwd, \"package.json\");\n if (!existsSync(workspacePackageJsonPath)) {\n throw new Error(\n `The workspace package.json file could not be found at ${workspacePackageJsonPath}`\n );\n }\n\n this.packageJson = await readJsonFile<PackageJson>(\n workspacePackageJsonPath\n );\n }\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public override createLogger(options: LoggerOptions): Logger {\n return super.createLogger({\n ...options,\n executionId: this.id,\n configIndex: this.options.configIndex\n });\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public override extendLogger(options: LoggerOptions): Logger {\n return super.extendLogger({\n ...options,\n executionId: this.id,\n configIndex: this.options.configIndex\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 createEnvironment(\n environment: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>> {\n const context = await PowerlinesEnvironmentContext.from<\n TResolvedConfig,\n TSystemContext\n >(\n this,\n deepClone(this.options),\n deepClone(this.config) as TResolvedConfig,\n deepClone(this.overriddenConfig) as InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n );\n\n context.tsconfig = this.tsconfig;\n context.system = this.system;\n\n context.dependencies = deepClone<typeof this.dependencies>(\n this.dependencies\n );\n context.devDependencies = deepClone<typeof this.devDependencies>(\n this.devDependencies\n );\n context.persistedMeta = deepClone<typeof this.persistedMeta>(\n this.persistedMeta\n );\n context.resolvePatterns = deepClone<typeof this.resolvePatterns>(\n this.resolvePatterns\n );\n\n context.powerlinesPath ??= this.powerlinesPath;\n context.resolver ??= this.resolver;\n\n await context.setEnvironmentConfig(\n deepClone(\n environment\n ) as EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n );\n\n context.plugins = [];\n for (const plugin of this.plugins) {\n await context.unstable_addPlugin(plugin);\n }\n\n for (const [key, value] of Object.entries(this)) {\n if (\n ![\n \"fs\",\n \"system\",\n \"options\",\n \"config\",\n \"inlineConfig\",\n \"userConfig\",\n \"pluginConfig\",\n \"overriddenConfig\",\n \"environmentConfig\",\n \"dependencies\",\n \"devDependencies\",\n \"persistedMeta\",\n \"packageJson\",\n \"projectJson\",\n \"tsconfig\",\n \"resolver\",\n \"plugins\",\n \"environments\"\n ].includes(key)\n ) {\n if (isObject(value) || Array.isArray(value)) {\n (context as any)[key] = deepClone(value);\n } else {\n (context as any)[key] = value;\n }\n }\n }\n\n return context;\n }\n\n /**\n * Update the context using a new inline configuration options\n */\n public override async resolveConfig() {\n await super.resolveConfig();\n\n await Promise.all(\n toArray(\n this.config.environments &&\n Object.keys(this.config.environments).length > 0\n ? Object.keys(this.config.environments).map(name =>\n createEnvironment(name, this.config)\n )\n : createDefaultEnvironment(this.config)\n ).map(async env => {\n this.#environments[env.name] = await this.createEnvironment(env);\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:\n | PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n | 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.trace({\n meta: { category: \"plugins\" },\n message: `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.config.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.createEnvironment(\n createDefaultEnvironment(this.config)\n );\n\n this.warn({\n meta: { category: \"plugins\" },\n message: `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment.config.environment?.name\n )}`\n });\n }\n\n return environment;\n }\n\n /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\n */\n public async getEnvironmentSafe(\n name?: string\n ): Promise<\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext> | undefined\n > {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n\n /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > {\n let environment: PowerlinesEnvironmentContext<\n TResolvedConfig,\n TSystemContext\n >;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.createEnvironment(\n createEnvironment<TResolvedConfig>(GLOBAL_ENVIRONMENT, this.config)\n );\n\n this.debug({\n meta: { category: \"plugins\" },\n message: `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n });\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n\n /**\n * A function used internally to add a plugin to the context and update the configuration options\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 async unstable_addPlugin(\n plugin: PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>\n ) {\n this.plugins.push(\n ...(await resolvePlugins<TResolvedConfig, TSystemContext>(this, plugin, {\n skipLogging:\n Object.keys(this.environments).filter(\n key =>\n key && key !== DEFAULT_ENVIRONMENT && key !== GLOBAL_ENVIRONMENT\n ).length > 0\n }))\n );\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.unstable_addPlugin(plugin);\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAmDA,IAAa,6BAAb,MAAa,mCAIH,kBAEV;;;;CAIE,gBAGI,CAAC;;;;CAKL,WAAqE,CAAC;;;;;;;;CAStE,aAAoB,KAIlB,SACA,cACA,QAC4D;EAC5D,MAAM,UAAU,IAAI,2BAGlB,OAAO;EACT,IAAI,QACF,QAAQ,SAAS;EAGnB,MAAM,QAAQ,KAAK;EAEnB,IAAI,cACF,MAAM,QAAQ,gBAAgB,YAAY;EAG5C,OAAO;CACT;;;;CAKA,IAAW,KAAa;EACtB,OAAO,KAAK,QAAQ;CACtB;;;;CAKA,IAAW,eAGT;EACA,OAAO,KAAKA;CACd;CAEA,IAAW,UAET;EACA,OAAO,KAAKC;CACd;;;;CAKA,IAAoB,KAAiC;EACnD,MAAM,IAAI,MACR,gHACF;CACF;;;;;;CAOA,AAAU,YAAY,SAA2B;EAC/C,MAAM,OAAO;CACf;;;;;;;CAQA,MAAsB,gBACpB,QACe;EACf,MAAM,MAAM,gBAAgB,MAAM;EAClC,IAAI,KAAK,aAAa,YAAY,OAAO;GACvC,MAAM,2BAA2B,UAAU,KAAK,KAAK,cAAc;GACnE,IAAI,CAAC,WAAW,wBAAwB,GACtC,MAAM,IAAI,MACR,yDAAyD,0BAC3D;GAGF,KAAK,cAAc,MAAM,aACvB,wBACF;EACF;CACF;;;;;;;CAQA,AAAgB,aAAa,SAAgC;EAC3D,OAAO,MAAM,aAAa;GACxB,GAAG;GACH,aAAa,KAAK;GAClB,aAAa,KAAK,QAAQ;EAC5B,CAAC;CACH;;;;;;;CAQA,AAAgB,aAAa,SAAgC;EAC3D,OAAO,MAAM,aAAa;GACxB,GAAG;GACH,aAAa,KAAK;GAClB,aAAa,KAAK,QAAQ;EAC5B,CA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QAAQ,IACZ,OAAO,KAAK,KAAK,YAAY,EAAE,IAAI,OAAM,SAAQ;GAC/C,MAAM,KAAK,aAAa,MAAO,mBAAmB,MAAM;EAC1D,CAAC,CACH;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"execution-context.mjs","names":["#environments","#plugins"],"sources":["../../src/context/execution-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { deepClone } from \"@stryke/helpers/deep-clone\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport {\n DEFAULT_ENVIRONMENT,\n GLOBAL_ENVIRONMENT\n} from \"../constants/environments\";\nimport {\n createDefaultEnvironment,\n createEnvironment\n} from \"../lib/environment\";\nimport { resolvePlugins } from \"../lib/plugins\";\nimport type {\n EnvironmentResolvedConfig,\n ExecutionContext,\n ExecutionOptions,\n InferOverridableConfig,\n Logger,\n LoggerOptions,\n Plugin,\n PluginConfig,\n PluginContext,\n ResolvedConfig,\n VirtualFileSystemInterface\n} from \"../types\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesExecutionContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesContext<TResolvedConfig, TSystemContext>\n implements ExecutionContext<TResolvedConfig, TSystemContext>\n{\n /**\n * A record of all environments by name\n */\n #environments: Record<\n string,\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > = {};\n\n /**\n * The plugins added to this execution context, which may be used to track the plugins that have been added to the context and ensure that they are properly registered and executed during the build process. 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 #plugins: Plugin<PluginContext<TResolvedConfig, TSystemContext>>[] = [];\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param options - The execution options to create the context with.\n * @param inlineConfig - The inline configuration for the context.\n * @returns A promise that resolves to the new context.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n >(\n options: ExecutionOptions,\n inlineConfig?: TResolvedConfig[\"inlineConfig\"],\n system?: TSystemContext\n ): Promise<ExecutionContext<TResolvedConfig, TSystemContext>> {\n const context = new PowerlinesExecutionContext<\n TResolvedConfig,\n TSystemContext\n >(options);\n if (system) {\n context.system = system;\n }\n\n await context.init();\n\n if (inlineConfig) {\n await context.setInlineConfig(inlineConfig);\n }\n\n return context;\n }\n\n /**\n * The unique identifier of the execution context, which can be used for logging and other purposes to distinguish between different executions in the same process.\n */\n public get id(): string {\n return this.executionId;\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > {\n return this.#environments;\n }\n\n public get plugins(): Array<\n Plugin<PluginContext<TResolvedConfig, TSystemContext>>\n > {\n return this.#plugins;\n }\n\n /**\n * The virtual file system interface for the project\n */\n public override get fs(): VirtualFileSystemInterface {\n throw new Error(\n \"The virtual file system is not available on the execution context. Please use the environment context instead.\"\n );\n }\n\n /**\n * Creates a new instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n */\n protected constructor(options: ExecutionOptions) {\n super(options);\n }\n\n /**\n * A setter function to populate the inline config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the inline configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.\n *\n * @param config - The inline configuration values to set.\n * @returns A promise that resolves when the inline configuration values have been set.\n */\n public override async setInlineConfig(\n config: TResolvedConfig[\"inlineConfig\"]\n ): Promise<void> {\n await super.setInlineConfig(config);\n if (this.inlineConfig.command === \"new\") {\n const workspacePackageJsonPath = joinPaths(this.cwd, \"package.json\");\n if (!existsSync(workspacePackageJsonPath)) {\n throw new Error(\n `The workspace package.json file could not be found at ${workspacePackageJsonPath}`\n );\n }\n\n this.packageJson = await readJsonFile<PackageJson>(\n workspacePackageJsonPath\n );\n }\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public override createLogger(options: LoggerOptions): Logger {\n return super.createLogger({\n ...options,\n executionId: this.id,\n configIndex: this.options.configIndex\n });\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public override extendLogger(options: LoggerOptions): Logger {\n return super.extendLogger({\n ...options,\n executionId: this.id,\n configIndex: this.options.configIndex\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 createEnvironment(\n environment: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>> {\n const context = await PowerlinesEnvironmentContext.from<\n TResolvedConfig,\n TSystemContext\n >(\n this,\n deepClone(this.options),\n deepClone(this.config) as TResolvedConfig,\n deepClone(this.overriddenConfig) as InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n );\n\n context.tsconfig = this.tsconfig;\n context.system = this.system;\n\n context.dependencies = deepClone<typeof this.dependencies>(\n this.dependencies\n );\n context.devDependencies = deepClone<typeof this.devDependencies>(\n this.devDependencies\n );\n context.persistedMeta = deepClone<typeof this.persistedMeta>(\n this.persistedMeta\n );\n context.resolvePatterns = deepClone<typeof this.resolvePatterns>(\n this.resolvePatterns\n );\n\n context.powerlinesPath ??= this.powerlinesPath;\n context.resolver ??= this.resolver;\n\n await context.setEnvironmentConfig(\n deepClone(\n environment\n ) as EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n );\n\n context.plugins = [];\n for (const plugin of this.plugins) {\n await context.unstable_addPlugin(plugin);\n }\n\n for (const [key, value] of Object.entries(this)) {\n if (\n ![\n \"fs\",\n \"system\",\n \"options\",\n \"config\",\n \"inlineConfig\",\n \"userConfig\",\n \"pluginConfig\",\n \"overriddenConfig\",\n \"environmentConfig\",\n \"dependencies\",\n \"devDependencies\",\n \"persistedMeta\",\n \"packageJson\",\n \"projectJson\",\n \"tsconfig\",\n \"resolver\",\n \"plugins\",\n \"environments\"\n ].includes(key)\n ) {\n if (isObject(value) || Array.isArray(value)) {\n (context as any)[key] = deepClone(value);\n } else {\n (context as any)[key] = value;\n }\n }\n }\n\n return context;\n }\n\n /**\n * Update the context using a new inline configuration options\n */\n public override async resolveConfig() {\n await super.resolveConfig();\n\n await Promise.all(\n toArray(\n this.config.environments &&\n Object.keys(this.config.environments).length > 0\n ? Object.keys(this.config.environments).map(name =>\n createEnvironment(name, this.config)\n )\n : createDefaultEnvironment(this.config)\n ).map(async env => {\n this.#environments[env.name] = await this.createEnvironment(env);\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:\n | PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n | 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.trace({\n meta: { category: \"plugins\" },\n message: `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.config.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.createEnvironment(\n createDefaultEnvironment(this.config)\n );\n\n this.warn({\n meta: { category: \"plugins\" },\n message: `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment.config.environment?.name\n )}`\n });\n }\n\n return environment;\n }\n\n /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\n */\n public async getEnvironmentSafe(\n name?: string\n ): Promise<\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext> | undefined\n > {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n\n /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > {\n let environment: PowerlinesEnvironmentContext<\n TResolvedConfig,\n TSystemContext\n >;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.createEnvironment(\n createEnvironment<TResolvedConfig>(GLOBAL_ENVIRONMENT, this.config)\n );\n\n this.debug({\n meta: { category: \"plugins\" },\n message: `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n });\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n\n /**\n * A function used internally to add a plugin to the context and update the configuration options\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 async unstable_addPlugin(\n plugin: PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>\n ) {\n this.plugins.push(\n ...(await resolvePlugins<TResolvedConfig, TSystemContext>(this, plugin, {\n skipLogging:\n Object.keys(this.environments).filter(\n key =>\n key && key !== DEFAULT_ENVIRONMENT && key !== GLOBAL_ENVIRONMENT\n ).length > 0\n }))\n );\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.unstable_addPlugin(plugin);\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAa,6BAAb,MAAa,mCAIH,kBAEV;;;;CAIE,gBAGI,CAAC;;;;CAKL,WAAqE,CAAC;;;;;;;;CAStE,aAAoB,KAIlB,SACA,cACA,QAC4D;EAC5D,MAAM,UAAU,IAAI,2BAGlB,OAAO;EACT,IAAI,QACF,QAAQ,SAAS;EAGnB,MAAM,QAAQ,KAAK;EAEnB,IAAI,cACF,MAAM,QAAQ,gBAAgB,YAAY;EAG5C,OAAO;CACT;;;;CAKA,IAAW,KAAa;EACtB,OAAO,KAAK;CACd;;;;CAKA,IAAW,eAGT;EACA,OAAO,KAAKA;CACd;CAEA,IAAW,UAET;EACA,OAAO,KAAKC;CACd;;;;CAKA,IAAoB,KAAiC;EACnD,MAAM,IAAI,MACR,gHACF;CACF;;;;;;CAOA,AAAU,YAAY,SAA2B;EAC/C,MAAM,OAAO;CACf;;;;;;;CAQA,MAAsB,gBACpB,QACe;EACf,MAAM,MAAM,gBAAgB,MAAM;EAClC,IAAI,KAAK,aAAa,YAAY,OAAO;GACvC,MAAM,2BAA2B,UAAU,KAAK,KAAK,cAAc;GACnE,IAAI,CAAC,WAAW,wBAAwB,GACtC,MAAM,IAAI,MACR,yDAAyD,0BAC3D;GAGF,KAAK,cAAc,MAAM,aACvB,wBACF;EACF;CACF;;;;;;;CAQA,AAAgB,aAAa,SAAgC;EAC3D,OAAO,MAAM,aAAa;GACxB,GAAG;GACH,aAAa,KAAK;GAClB,aAAa,KAAK,QAAQ;EAC5B,CAAC;C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AM,QAAQ,EACtE,aACE,OAAO,KAAK,KAAK,YAAY,EAAE,QAC7B,QACE,OAAO,qBAA+B,oBAC1C,EAAE,SAAS,EACf,CAAC,CACH;EAEA,MAAM,QAAQ,IACZ,OAAO,KAAK,KAAK,YAAY,EAAE,IAAI,OAAM,SAAQ;GAC/C,MAAM,KAAK,aAAa,MAAO,mBAAmB,MAAM;EAC1D,CAAC,CACH;CACF;AACF"}
|
package/dist/context/index.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_context_base_context = require('./base-context.cjs');
|
|
3
11
|
const require_context_context = require('./context.cjs');
|
package/dist/context/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { PowerlinesBaseContext } from "./base-context.mjs";
|
|
2
4
|
import { PowerlinesContext } from "./context.mjs";
|
|
3
5
|
import { PowerlinesEnvironmentContext } from "./environment-context.mjs";
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { PowerlinesBaseContext } from "./base-context.mjs";
|
|
2
10
|
import { PowerlinesContext } from "./context.mjs";
|
|
3
11
|
import { createPluginContext } from "./plugin-context.mjs";
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
3
11
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-context.d.mts","names":[],"sources":["../../src/context/plugin-context.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-context.d.mts","names":[],"sources":["../../src/context/plugin-context.ts"],"mappings":";;;;;;;;;;;;;;;;iBAuCgB,mBAAA,yBACU,cAAA,GAAiB,cAAA,2BAAA,CAGzC,QAAA,UACA,MAAA,EAAQ,MAAA,CAAO,aAAA,CAAc,eAAA,EAAiB,cAAA,IAC9C,WAAA,EAAa,4BAAA,CAA6B,eAAA,EAAiB,cAAA,IAC1D,aAAA,CAAc,eAAA,EAAiB,cAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
10
|
import { isString } from "@stryke/type-checks/is-string";
|
|
3
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-context.mjs","names":[],"sources":["../../src/context/plugin-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { UnpluginMessage } from \"unplugin\";\nimport type {\n EnvironmentContext,\n LoggerMessage,\n LogLevel,\n Plugin,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\n/**\n * Create a Proxy-based PluginContext\n *\n * @param pluginId - The unique identifier of the plugin\n * @param plugin - The plugin instance\n * @param environment - The environment context\n * @returns The proxied plugin context\n */\nexport function createPluginContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>(\n pluginId: string,\n plugin: Plugin<PluginContext<TResolvedConfig, TSystemContext>>,\n environment: PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n): PluginContext<TResolvedConfig, TSystemContext> {\n const logger = environment.extendLogger({\n plugin: plugin.name\n });\n\n const normalizeMessage = (\n message: string | UnpluginMessage\n ): LoggerMessage => {\n return {\n meta: {\n ...(isSetObject(message) ? message.meta : {}),\n environment: environment.config.environment.name,\n plugin: plugin.name\n },\n message: isString(message) ? message : message.message\n };\n };\n\n return new Proxy({} as PluginContext<TResolvedConfig, TSystemContext>, {\n get(_, prop) {\n if (prop === \"environment\") {\n return environment;\n }\n\n if (prop === \"id\") {\n return pluginId;\n }\n\n if (prop === \"logger\") {\n return logger;\n }\n\n if (prop === \"log\") {\n return (type: LogLevel, message: string | UnpluginMessage) => {\n logger.log(type, normalizeMessage(message));\n };\n }\n\n if (prop === \"fatal\") {\n return (message: string | UnpluginMessage) => {\n logger.error(normalizeMessage(message));\n };\n }\n\n if (prop === \"error\") {\n return (message: string | UnpluginMessage) => {\n logger.error(normalizeMessage(message));\n };\n }\n\n if (prop === \"warn\") {\n return (message: string | UnpluginMessage) => {\n logger.warn(normalizeMessage(message));\n };\n }\n\n if (prop === \"info\") {\n return (message: string | UnpluginMessage) => {\n logger.info(normalizeMessage(message));\n };\n }\n\n if (prop === \"debug\") {\n return (message: string | UnpluginMessage) => {\n logger.debug(normalizeMessage(message));\n };\n }\n\n if (prop === \"trace\") {\n return (message: string | UnpluginMessage) => {\n logger.trace(normalizeMessage(message));\n };\n }\n\n return environment[\n prop as keyof EnvironmentContext<TResolvedConfig, TSystemContext>\n ];\n },\n set(_, prop, value) {\n if (prop === \"unstable_addPlugin\") {\n logger.warn(\n \"Plugins should not be calling the 'addPlugin' function directly. This function is meant to be used internally by Powerlines and may cause unexpected behavior if used incorrectly.\"\n );\n return false;\n }\n\n if (\n [\n \"id\",\n \"environment\",\n \"config\",\n \"log\",\n \"logger\",\n \"error\",\n \"warn\",\n \"plugins\",\n \"hooks\",\n \"fs\",\n \"selectHooks\"\n ].includes(prop as string)\n ) {\n logger.warn(`Cannot set the read-only \"${String(prop)}\" property`);\n\n return false;\n }\n\n (environment as Record<string, any>)[prop as string] = value;\n return true;\n }\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-context.mjs","names":[],"sources":["../../src/context/plugin-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { UnpluginMessage } from \"unplugin\";\nimport type {\n EnvironmentContext,\n LoggerMessage,\n LogLevel,\n Plugin,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\n/**\n * Create a Proxy-based PluginContext\n *\n * @param pluginId - The unique identifier of the plugin\n * @param plugin - The plugin instance\n * @param environment - The environment context\n * @returns The proxied plugin context\n */\nexport function createPluginContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>(\n pluginId: string,\n plugin: Plugin<PluginContext<TResolvedConfig, TSystemContext>>,\n environment: PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n): PluginContext<TResolvedConfig, TSystemContext> {\n const logger = environment.extendLogger({\n plugin: plugin.name\n });\n\n const normalizeMessage = (\n message: string | UnpluginMessage\n ): LoggerMessage => {\n return {\n meta: {\n ...(isSetObject(message) ? message.meta : {}),\n environment: environment.config.environment.name,\n plugin: plugin.name\n },\n message: isString(message) ? message : message.message\n };\n };\n\n return new Proxy({} as PluginContext<TResolvedConfig, TSystemContext>, {\n get(_, prop) {\n if (prop === \"environment\") {\n return environment;\n }\n\n if (prop === \"id\") {\n return pluginId;\n }\n\n if (prop === \"logger\") {\n return logger;\n }\n\n if (prop === \"log\") {\n return (type: LogLevel, message: string | UnpluginMessage) => {\n logger.log(type, normalizeMessage(message));\n };\n }\n\n if (prop === \"fatal\") {\n return (message: string | UnpluginMessage) => {\n logger.error(normalizeMessage(message));\n };\n }\n\n if (prop === \"error\") {\n return (message: string | UnpluginMessage) => {\n logger.error(normalizeMessage(message));\n };\n }\n\n if (prop === \"warn\") {\n return (message: string | UnpluginMessage) => {\n logger.warn(normalizeMessage(message));\n };\n }\n\n if (prop === \"info\") {\n return (message: string | UnpluginMessage) => {\n logger.info(normalizeMessage(message));\n };\n }\n\n if (prop === \"debug\") {\n return (message: string | UnpluginMessage) => {\n logger.debug(normalizeMessage(message));\n };\n }\n\n if (prop === \"trace\") {\n return (message: string | UnpluginMessage) => {\n logger.trace(normalizeMessage(message));\n };\n }\n\n return environment[\n prop as keyof EnvironmentContext<TResolvedConfig, TSystemContext>\n ];\n },\n set(_, prop, value) {\n if (prop === \"unstable_addPlugin\") {\n logger.warn(\n \"Plugins should not be calling the 'addPlugin' function directly. This function is meant to be used internally by Powerlines and may cause unexpected behavior if used incorrectly.\"\n );\n return false;\n }\n\n if (\n [\n \"id\",\n \"environment\",\n \"config\",\n \"log\",\n \"logger\",\n \"error\",\n \"warn\",\n \"plugins\",\n \"hooks\",\n \"fs\",\n \"selectHooks\"\n ].includes(prop as string)\n ) {\n logger.warn(`Cannot set the read-only \"${String(prop)}\" property`);\n\n return false;\n }\n\n (environment as Record<string, any>)[prop as string] = value;\n return true;\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,oBAId,UACA,QACA,aACgD;CAChD,MAAM,SAAS,YAAY,aAAa,EACtC,QAAQ,OAAO,KACjB,CAAC;CAED,MAAM,oBACJ,YACkB;EAClB,OAAO;GACL,MAAM;IACJ,GAAI,YAAY,OAAO,IAAI,QAAQ,OAAO,CAAC;IAC3C,aA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|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_lib_resolver = require('./lib/resolver.cjs');
|
|
3
11
|
const require_lib_config = require('./lib/config.cjs');
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolveOptions, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WriteData, WriteOptions } from "./types/fs.cjs";
|
|
2
|
-
import { BaseCommandType,
|
|
2
|
+
import { BaseCommandType, BaseExecutionApiMethods, CommandType, Commands, ExecutionApiMethods, SupportedCommands } from "./types/api.cjs";
|
|
3
3
|
import { BuilderVariant, UnpluginBuilderVariant, UnpluginHookFunctions, UnpluginOptions } from "./types/unplugin.cjs";
|
|
4
4
|
import { BasePlugin, HookFunctions, Hooks, Plugin, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, TypesResult } from "./types/plugin.cjs";
|
|
5
5
|
import { CallHookOptions, HookListOrders, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, NormalizedStringFilter, PluginFilter, TransformHookFilter } from "./types/hooks.cjs";
|
|
@@ -30,4 +30,4 @@ import { getMagicString, getSourceFile, getString } from "./lib/utilities/source
|
|
|
30
30
|
import { generateSourceMap } from "./lib/utilities/source-map.cjs";
|
|
31
31
|
import { writeFile } from "./lib/utilities/write-file.cjs";
|
|
32
32
|
import { VirtualFileSystem } from "./lib/vfs.cjs";
|
|
33
|
-
export { BaseCommandType, BaseContext,
|
|
33
|
+
export { BaseCommandType, BaseContext, BaseExecutionApiMethods, BaseExecutionOptions, BasePlugin, BufferedChunk, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, ConfigParams, Context, CopyConfig, CreateContextOptions, CreateInlineConfig, CreateResolverOptions, CreateStreamReaderOptions, CreateStreamSinkOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, CustomLogger, CustomLoggerMessage, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentPlugin, EnvironmentResolvedConfig, ExecutionApiMethods, ExecutionContext, ExecutionOptions, FetchOptions, FileHeaderOptions, FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, FrameworkOptions, HookFunctions, HookListOrders, Hooks, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferOverridableConfig, InitContextOptions, InlineConfig, InlineConfigPaths, Level, LintInlineConfig, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, MetaInfo, Mode, NormalizedStringFilter, Options, OutputConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFilter, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, PowerlinesMessage, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionMode, ResolveConfig, ResolveOptions, ResolvePackageConfigsResult, ResolvePluginsOptions, ResolveResult, ResolvedAssetGlob, ResolvedConfig, ResolvedCopyConfig, ResolvedEntryFileReference, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, SupportedCommands, TSCompilerOptions, TSConfig, TestInlineConfig, TransformHookFilter, TransformResult, TypegenContext, TypesInlineConfig, TypesResult, UnimportContext, UnpluginBuilderVariant, UnpluginHookFunctions, UnpluginOptions, UnresolvedContext, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystem, VirtualFileSystemHost, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkspaceConfig, WriteData, WriteOptions, _capnpFileId, callHook, combineContexts, createEventEmitter, createProgram, createResolver, createStreamReader, createStreamSink, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, emitBuiltinTypes, extractHooks, findIncludeMatch, findMatch, format, formatFolder, formatTypes, generateSourceMap, getConfigProps, getDefaultLogLevel, getDefaultMode, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getMagicString, getParsedTypeScriptConfig, getPersistedMeta, getPrefixedRootHash, getSourceFile, getString, getTsconfigDtsPath, getTsconfigFilePath, getTypescriptFileHeader, getUniqueInputs, handleTypes, initPlugin, initializeTsconfig, installDependencies, isFileReference, isIncludeMatchFound, isMatchFound, isResolvedEntryFileReference, isUnpluginBuilderVariant, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, mergeConfigs, mergeResults, normalizeBasePath, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, resolvePackageConfigs, resolvePlugin, resolvePluginConfig, resolvePlugins, resolveRoot, resolveTsconfig, tryResolveWorkspaceConfig, tryTsconfigFilePath, writeFile, writeMetaFile };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { ResolveOptions, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WriteData, WriteOptions } from "./types/fs.mjs";
|
|
2
|
-
import { BaseCommandType,
|
|
4
|
+
import { BaseCommandType, BaseExecutionApiMethods, CommandType, Commands, ExecutionApiMethods, SupportedCommands } from "./types/api.mjs";
|
|
3
5
|
import { BuilderVariant, UnpluginBuilderVariant, UnpluginHookFunctions, UnpluginOptions } from "./types/unplugin.mjs";
|
|
4
6
|
import { BasePlugin, HookFunctions, Hooks, Plugin, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, TypesResult } from "./types/plugin.mjs";
|
|
5
7
|
import { CallHookOptions, HookListOrders, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, NormalizedStringFilter, PluginFilter, TransformHookFilter } from "./types/hooks.mjs";
|
|
@@ -30,4 +32,4 @@ import { getMagicString, getSourceFile, getString } from "./lib/utilities/source
|
|
|
30
32
|
import { generateSourceMap } from "./lib/utilities/source-map.mjs";
|
|
31
33
|
import { writeFile } from "./lib/utilities/write-file.mjs";
|
|
32
34
|
import { VirtualFileSystem } from "./lib/vfs.mjs";
|
|
33
|
-
export { BaseCommandType, BaseContext,
|
|
35
|
+
export { BaseCommandType, BaseContext, BaseExecutionApiMethods, BaseExecutionOptions, BasePlugin, BufferedChunk, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, ConfigParams, Context, CopyConfig, CreateContextOptions, CreateInlineConfig, CreateResolverOptions, CreateStreamReaderOptions, CreateStreamSinkOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, CustomLogger, CustomLoggerMessage, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentPlugin, EnvironmentResolvedConfig, ExecutionApiMethods, ExecutionContext, ExecutionOptions, FetchOptions, FileHeaderOptions, FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, FrameworkOptions, HookFunctions, HookListOrders, Hooks, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferOverridableConfig, InitContextOptions, InlineConfig, InlineConfigPaths, Level, LintInlineConfig, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, MetaInfo, Mode, NormalizedStringFilter, Options, OutputConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFilter, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, PowerlinesMessage, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionMode, ResolveConfig, ResolveOptions, ResolvePackageConfigsResult, ResolvePluginsOptions, ResolveResult, ResolvedAssetGlob, ResolvedConfig, ResolvedCopyConfig, ResolvedEntryFileReference, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, SupportedCommands, TSCompilerOptions, TSConfig, TestInlineConfig, TransformHookFilter, TransformResult, TypegenContext, TypesInlineConfig, TypesResult, UnimportContext, UnpluginBuilderVariant, UnpluginHookFunctions, UnpluginOptions, UnresolvedContext, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystem, VirtualFileSystemHost, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkspaceConfig, WriteData, WriteOptions, _capnpFileId, callHook, combineContexts, createEventEmitter, createProgram, createResolver, createStreamReader, createStreamSink, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, emitBuiltinTypes, extractHooks, findIncludeMatch, findMatch, format, formatFolder, formatTypes, generateSourceMap, getConfigProps, getDefaultLogLevel, getDefaultMode, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getMagicString, getParsedTypeScriptConfig, getPersistedMeta, getPrefixedRootHash, getSourceFile, getString, getTsconfigDtsPath, getTsconfigFilePath, getTypescriptFileHeader, getUniqueInputs, handleTypes, initPlugin, initializeTsconfig, installDependencies, isFileReference, isIncludeMatchFound, isMatchFound, isResolvedEntryFileReference, isUnpluginBuilderVariant, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, mergeConfigs, mergeResults, normalizeBasePath, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, resolvePackageConfigs, resolvePlugin, resolvePluginConfig, resolvePlugins, resolveRoot, resolveTsconfig, tryResolveWorkspaceConfig, tryTsconfigFilePath, writeFile, writeMetaFile };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { createResolver } from "./lib/resolver.mjs";
|
|
2
10
|
import { defineConfig, getDefaultLogLevel, getDefaultMode, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, normalizeBasePath, resolvePackageConfigs, resolveRoot, tryResolveWorkspaceConfig } from "./lib/config.mjs";
|
|
3
11
|
import { format, formatFolder } from "./lib/utilities/format.mjs";
|
package/dist/lib/config.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
const require_plugin_utils_logging = require('../plugin-utils/logging.cjs');
|
package/dist/lib/config.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { LogLevelResolvedConfig } from "../types/logging.mjs";
|
|
2
4
|
import { Context } from "../types/context.mjs";
|
|
3
5
|
import { FrameworkOptions, InlineConfig, Mode, ParsedUserConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, WorkspaceConfig } from "../types/config.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/lib/config.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/lib/config.ts"],"mappings":";;;;;;;;;iBA4DgB,iBAAA,CAAkB,IAAkB;AAAA,UAMnC,2BAAA;;;;EAIf,WAAA,GAAc,WAAA;;;;EAKd,WAAA,GAAc,MAAM;AAAA;;;;AAf8B;AAMpD;;;;;;iBAsBsB,qBAAA,CACpB,GAAA,UACA,IAAA,WACC,OAAO,CAAC,2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AAAA,iBAC5D,YAAA,CAAa,MAAA,EAAQ,mBAAA,GAAsB,mBAAmB;AAAA,iBAC9D,YAAA,CAAa,MAAA,EAAQ,YAAA,GAAe,YAAY;AAAA,iBAChD,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAgB"}
|
package/dist/lib/config.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { resolveLogLevel } from "../plugin-utils/logging.mjs";
|
|
2
10
|
import { createResolver } from "./resolver.mjs";
|
|
3
11
|
import { getWorkspaceConfig, tryGetWorkspaceConfig } from "@storm-software/config-tools/get-config";
|