@powerlines/core 0.11.0 → 0.11.2
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/constants/api.cjs +18 -0
- package/dist/constants/api.d.cts +6 -0
- package/dist/constants/api.d.cts.map +1 -0
- package/dist/constants/api.d.mts +6 -0
- package/dist/constants/api.d.mts.map +1 -0
- package/dist/constants/api.mjs +16 -0
- package/dist/constants/api.mjs.map +1 -0
- package/dist/constants/commands.cjs +3 -11
- package/dist/constants/commands.d.cts +1 -1
- package/dist/constants/commands.d.cts.map +1 -1
- package/dist/constants/commands.d.mts +1 -1
- package/dist/constants/commands.d.mts.map +1 -1
- package/dist/constants/commands.mjs +3 -11
- package/dist/constants/commands.mjs.map +1 -1
- package/dist/constants/devtools.cjs +23 -0
- package/dist/constants/devtools.d.cts +13 -0
- package/dist/constants/devtools.d.cts.map +1 -0
- package/dist/constants/devtools.d.mts +13 -0
- package/dist/constants/devtools.d.mts.map +1 -0
- package/dist/constants/devtools.mjs +14 -0
- package/dist/constants/devtools.mjs.map +1 -0
- package/dist/constants/environments.cjs +1 -0
- package/dist/constants/extensions.cjs +21 -0
- package/dist/constants/extensions.d.cts +5 -0
- package/dist/constants/extensions.d.cts.map +1 -0
- package/dist/constants/extensions.d.mts +5 -0
- package/dist/constants/extensions.d.mts.map +1 -0
- package/dist/constants/extensions.mjs +20 -0
- package/dist/constants/extensions.mjs.map +1 -0
- package/dist/constants/fs.cjs +1 -0
- package/dist/constants/hooks.cjs +1 -0
- package/dist/constants/index.cjs +48 -24
- package/dist/constants/index.d.cts +5 -1
- package/dist/constants/index.d.mts +5 -1
- package/dist/constants/index.mjs +6 -2
- package/dist/constants/log-level.cjs +90 -0
- package/dist/constants/log-level.d.cts +63 -0
- package/dist/constants/log-level.d.cts.map +1 -0
- package/dist/constants/log-level.d.mts +63 -0
- package/dist/constants/log-level.d.mts.map +1 -0
- package/dist/constants/log-level.mjs +82 -0
- package/dist/constants/log-level.mjs.map +1 -0
- package/dist/constants/meta.cjs +1 -0
- package/dist/constants/plugin.cjs +3 -2
- package/dist/constants/plugin.d.cts +2 -2
- package/dist/constants/plugin.d.mts +2 -2
- package/dist/context/base-context.cjs +127 -0
- package/dist/context/base-context.d.cts +81 -0
- package/dist/context/base-context.d.cts.map +1 -0
- package/dist/context/base-context.d.mts +81 -0
- package/dist/context/base-context.d.mts.map +1 -0
- package/dist/context/base-context.mjs +125 -0
- package/dist/context/base-context.mjs.map +1 -0
- package/dist/context/context.cjs +934 -0
- package/dist/context/context.d.cts +369 -0
- package/dist/context/context.d.cts.map +1 -0
- package/dist/context/context.d.mts +369 -0
- package/dist/context/context.d.mts.map +1 -0
- package/dist/context/context.mjs +932 -0
- package/dist/context/context.mjs.map +1 -0
- package/dist/context/environment-context.cjs +219 -0
- package/dist/context/environment-context.d.cts +100 -0
- package/dist/context/environment-context.d.cts.map +1 -0
- package/dist/context/environment-context.d.mts +100 -0
- package/dist/context/environment-context.d.mts.map +1 -0
- package/dist/context/environment-context.mjs +218 -0
- package/dist/context/environment-context.mjs.map +1 -0
- package/dist/context/execution-context.cjs +230 -0
- package/dist/context/execution-context.d.cts +101 -0
- package/dist/context/execution-context.d.cts.map +1 -0
- package/dist/context/execution-context.d.mts +101 -0
- package/dist/context/execution-context.d.mts.map +1 -0
- package/dist/context/execution-context.mjs +228 -0
- package/dist/context/execution-context.mjs.map +1 -0
- package/dist/context/index.cjs +12 -0
- package/dist/context/index.d.cts +6 -0
- package/dist/context/index.d.mts +6 -0
- package/dist/context/index.mjs +7 -0
- package/dist/context/plugin-context.cjs +83 -0
- package/dist/context/plugin-context.d.cts +18 -0
- package/dist/context/plugin-context.d.cts.map +1 -0
- package/dist/context/plugin-context.d.mts +18 -0
- package/dist/context/plugin-context.d.mts.map +1 -0
- package/dist/context/plugin-context.mjs +82 -0
- package/dist/context/plugin-context.mjs.map +1 -0
- package/dist/index.cjs +62 -6
- package/dist/index.d.cts +23 -11
- package/dist/index.d.mts +23 -11
- package/dist/index.mjs +17 -5
- package/dist/lib/config.cjs +167 -28
- package/dist/lib/config.d.cts +95 -14
- package/dist/lib/config.d.cts.map +1 -1
- package/dist/lib/config.d.mts +95 -14
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs +160 -28
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/context-helpers.cjs +43 -0
- package/dist/lib/context-helpers.d.cts +19 -0
- package/dist/lib/context-helpers.d.cts.map +1 -0
- package/dist/lib/context-helpers.d.mts +19 -0
- package/dist/lib/context-helpers.d.mts.map +1 -0
- package/dist/lib/context-helpers.mjs +41 -0
- package/dist/lib/context-helpers.mjs.map +1 -0
- package/dist/lib/entry.cjs +9 -9
- package/dist/lib/entry.d.cts +5 -5
- package/dist/lib/entry.d.cts.map +1 -1
- package/dist/lib/entry.d.mts +5 -5
- package/dist/lib/entry.d.mts.map +1 -1
- package/dist/lib/entry.mjs +9 -9
- package/dist/lib/entry.mjs.map +1 -1
- package/dist/lib/environment.cjs +72 -0
- package/dist/lib/environment.d.cts +12 -0
- package/dist/lib/environment.d.cts.map +1 -0
- package/dist/lib/environment.d.mts +12 -0
- package/dist/lib/environment.d.mts.map +1 -0
- package/dist/lib/environment.mjs +67 -0
- package/dist/lib/environment.mjs.map +1 -0
- package/dist/lib/events.cjs +43 -0
- package/dist/lib/events.d.cts +10 -0
- package/dist/lib/events.d.cts.map +1 -0
- package/dist/lib/events.d.mts +10 -0
- package/dist/lib/events.d.mts.map +1 -0
- package/dist/lib/events.mjs +42 -0
- package/dist/lib/events.mjs.map +1 -0
- package/dist/lib/generate-types.cjs +371 -0
- package/dist/lib/generate-types.d.cts +67 -0
- package/dist/lib/generate-types.d.cts.map +1 -0
- package/dist/lib/generate-types.d.mts +67 -0
- package/dist/lib/generate-types.d.mts.map +1 -0
- package/dist/lib/generate-types.mjs +368 -0
- package/dist/lib/generate-types.mjs.map +1 -0
- package/dist/lib/hooks.cjs +152 -0
- package/dist/lib/hooks.d.cts +28 -0
- package/dist/lib/hooks.d.cts.map +1 -0
- package/dist/lib/hooks.d.mts +28 -0
- package/dist/lib/hooks.d.mts.map +1 -0
- package/dist/lib/hooks.mjs +147 -0
- package/dist/lib/hooks.mjs.map +1 -0
- package/dist/lib/index.cjs +64 -6
- package/dist/lib/index.d.cts +15 -3
- package/dist/lib/index.d.mts +15 -3
- package/dist/lib/index.mjs +19 -5
- package/dist/lib/install-dependencies.cjs +25 -0
- package/dist/lib/install-dependencies.d.cts +12 -0
- package/dist/lib/install-dependencies.d.cts.map +1 -0
- package/dist/lib/install-dependencies.d.mts +12 -0
- package/dist/lib/install-dependencies.d.mts.map +1 -0
- package/dist/lib/install-dependencies.mjs +24 -0
- package/dist/lib/install-dependencies.mjs.map +1 -0
- package/dist/lib/meta.cjs +57 -0
- package/dist/lib/meta.d.cts +34 -0
- package/dist/lib/meta.d.cts.map +1 -0
- package/dist/lib/meta.d.mts +34 -0
- package/dist/lib/meta.d.mts.map +1 -0
- package/dist/lib/meta.mjs +54 -0
- package/dist/lib/meta.mjs.map +1 -0
- package/dist/lib/plugins.cjs +150 -0
- package/dist/lib/plugins.d.cts +40 -0
- package/dist/lib/plugins.d.cts.map +1 -0
- package/dist/lib/plugins.d.mts +40 -0
- package/dist/lib/plugins.d.mts.map +1 -0
- package/dist/lib/plugins.mjs +146 -0
- package/dist/lib/plugins.mjs.map +1 -0
- package/dist/lib/resolver.cjs +35 -0
- package/dist/lib/resolver.d.cts +21 -0
- package/dist/lib/resolver.d.cts.map +1 -0
- package/dist/lib/resolver.d.mts +21 -0
- package/dist/lib/resolver.d.mts.map +1 -0
- package/dist/lib/resolver.mjs +33 -0
- package/dist/lib/resolver.mjs.map +1 -0
- package/dist/lib/schemas.cjs +9 -0
- package/dist/lib/schemas.d.cts +2 -0
- package/dist/lib/schemas.d.mts +2 -0
- package/dist/lib/schemas.mjs +3 -0
- package/dist/lib/streaming-channel.cjs +260 -0
- package/dist/lib/streaming-channel.d.cts +133 -0
- package/dist/lib/streaming-channel.d.cts.map +1 -0
- package/dist/lib/streaming-channel.d.mts +133 -0
- package/dist/lib/streaming-channel.d.mts.map +1 -0
- package/dist/lib/streaming-channel.mjs +258 -0
- package/dist/lib/streaming-channel.mjs.map +1 -0
- package/dist/lib/typescript/index.cjs +16 -0
- package/dist/lib/typescript/index.d.cts +3 -0
- package/dist/lib/typescript/index.d.mts +3 -0
- package/dist/lib/typescript/index.mjs +4 -0
- package/dist/lib/typescript/ts-morph.cjs +105 -0
- package/dist/lib/typescript/ts-morph.d.cts +38 -0
- package/dist/lib/typescript/ts-morph.d.cts.map +1 -0
- package/dist/lib/typescript/ts-morph.d.mts +38 -0
- package/dist/lib/typescript/ts-morph.d.mts.map +1 -0
- package/dist/lib/typescript/ts-morph.mjs +102 -0
- package/dist/lib/typescript/ts-morph.mjs.map +1 -0
- package/dist/lib/typescript/tsconfig.cjs +253 -0
- package/dist/lib/typescript/tsconfig.d.cts +77 -0
- package/dist/lib/typescript/tsconfig.d.cts.map +1 -0
- package/dist/lib/typescript/tsconfig.d.mts +77 -0
- package/dist/lib/typescript/tsconfig.d.mts.map +1 -0
- package/dist/lib/typescript/tsconfig.mjs +240 -0
- package/dist/lib/typescript/tsconfig.mjs.map +1 -0
- package/dist/lib/unplugin/helpers.cjs +2 -2
- package/dist/lib/unplugin/module-resolution.cjs +19 -20
- package/dist/lib/unplugin/module-resolution.d.cts +2 -2
- package/dist/lib/unplugin/module-resolution.d.cts.map +1 -1
- package/dist/lib/unplugin/module-resolution.d.mts +2 -2
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -1
- package/dist/lib/unplugin/module-resolution.mjs +18 -19
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +55 -61
- package/dist/lib/unplugin/plugin.d.cts +10 -4
- package/dist/lib/unplugin/plugin.d.cts.map +1 -1
- package/dist/lib/unplugin/plugin.d.mts +10 -4
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs +55 -61
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/file-header.cjs +2 -2
- package/dist/lib/utilities/file-header.mjs +2 -2
- package/dist/lib/utilities/file-header.mjs.map +1 -1
- package/dist/lib/utilities/format.cjs +16 -8
- package/dist/lib/utilities/format.d.cts.map +1 -1
- package/dist/lib/utilities/format.d.mts.map +1 -1
- package/dist/lib/utilities/format.mjs +15 -8
- package/dist/lib/utilities/format.mjs.map +1 -1
- package/dist/lib/utilities/index.cjs +2 -2
- package/dist/lib/utilities/index.mjs +2 -2
- package/dist/lib/utilities/source-file.cjs +1 -1
- package/dist/lib/utilities/source-map.cjs +1 -1
- package/dist/lib/utilities/write-file.cjs +1 -2
- package/dist/lib/utilities/write-file.d.cts +1 -1
- package/dist/lib/utilities/write-file.d.cts.map +1 -1
- package/dist/lib/utilities/write-file.d.mts +1 -1
- package/dist/lib/utilities/write-file.d.mts.map +1 -1
- package/dist/lib/utilities/write-file.mjs +1 -2
- package/dist/lib/utilities/write-file.mjs.map +1 -1
- package/dist/lib/vfs.cjs +1104 -0
- package/dist/lib/vfs.d.cts +321 -0
- package/dist/lib/vfs.d.cts.map +1 -0
- package/dist/lib/vfs.d.mts +321 -0
- package/dist/lib/vfs.d.mts.map +1 -0
- package/dist/lib/vfs.mjs +1102 -0
- package/dist/lib/vfs.mjs.map +1 -0
- package/dist/plugin-base.cjs +5 -9
- package/dist/plugin-base.mjs +5 -9
- package/dist/plugin-base.mjs.map +1 -1
- package/dist/plugin-utils/build-helpers.cjs +2 -2
- package/dist/plugin-utils/build-helpers.d.cts +2 -2
- package/dist/plugin-utils/build-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/build-helpers.d.mts +2 -2
- package/dist/plugin-utils/build-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/build-helpers.mjs +2 -2
- package/dist/plugin-utils/build-helpers.mjs.map +1 -1
- package/dist/plugin-utils/combine-plugins.d.cts +7 -8
- package/dist/plugin-utils/combine-plugins.d.cts.map +1 -1
- package/dist/plugin-utils/combine-plugins.d.mts +7 -8
- package/dist/plugin-utils/combine-plugins.d.mts.map +1 -1
- package/dist/plugin-utils/combine-plugins.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +29 -16
- package/dist/plugin-utils/context-helpers.d.cts +10 -2
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +10 -2
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +29 -17
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/docs-helper.cjs +17 -0
- package/dist/plugin-utils/docs-helper.d.cts +11 -0
- package/dist/plugin-utils/docs-helper.d.cts.map +1 -0
- package/dist/plugin-utils/docs-helper.d.mts +11 -0
- package/dist/plugin-utils/docs-helper.d.mts.map +1 -0
- package/dist/plugin-utils/docs-helper.mjs +16 -0
- package/dist/plugin-utils/docs-helper.mjs.map +1 -0
- package/dist/plugin-utils/extend.mjs.map +1 -1
- package/dist/plugin-utils/filter.cjs +101 -0
- package/dist/plugin-utils/filter.d.cts +16 -0
- package/dist/plugin-utils/filter.d.cts.map +1 -0
- package/dist/plugin-utils/filter.d.mts +16 -0
- package/dist/plugin-utils/filter.d.mts.map +1 -0
- package/dist/plugin-utils/filter.mjs +91 -0
- package/dist/plugin-utils/filter.mjs.map +1 -0
- package/dist/plugin-utils/format-package-json.cjs +1 -1
- package/dist/plugin-utils/format-package-json.mjs +1 -1
- package/dist/plugin-utils/format-package-json.mjs.map +1 -1
- package/dist/plugin-utils/format.cjs +44 -0
- package/dist/plugin-utils/format.d.cts +11 -0
- package/dist/plugin-utils/format.d.cts.map +1 -0
- package/dist/plugin-utils/format.d.mts +11 -0
- package/dist/plugin-utils/format.d.mts.map +1 -0
- package/dist/plugin-utils/format.mjs +43 -0
- package/dist/plugin-utils/format.mjs.map +1 -0
- package/dist/plugin-utils/get-config-path.cjs +34 -32
- package/dist/plugin-utils/get-config-path.d.cts +4 -1
- package/dist/plugin-utils/get-config-path.d.cts.map +1 -1
- package/dist/plugin-utils/get-config-path.d.mts +4 -1
- package/dist/plugin-utils/get-config-path.d.mts.map +1 -1
- package/dist/plugin-utils/get-config-path.mjs +34 -32
- package/dist/plugin-utils/get-config-path.mjs.map +1 -1
- package/dist/plugin-utils/helpers.cjs +25 -10
- package/dist/plugin-utils/helpers.d.cts +31 -24
- package/dist/plugin-utils/helpers.d.cts.map +1 -1
- package/dist/plugin-utils/helpers.d.mts +31 -24
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs +22 -8
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +48 -4
- package/dist/plugin-utils/index.d.cts +9 -3
- package/dist/plugin-utils/index.d.mts +9 -3
- package/dist/plugin-utils/index.mjs +11 -5
- package/dist/plugin-utils/install.cjs +47 -0
- package/dist/plugin-utils/install.d.cts +23 -0
- package/dist/plugin-utils/install.d.cts.map +1 -0
- package/dist/plugin-utils/install.d.mts +23 -0
- package/dist/plugin-utils/install.d.mts.map +1 -0
- package/dist/plugin-utils/install.mjs +45 -0
- package/dist/plugin-utils/install.mjs.map +1 -0
- package/dist/plugin-utils/logging.cjs +605 -0
- package/dist/plugin-utils/logging.d.cts +111 -0
- package/dist/plugin-utils/logging.d.cts.map +1 -0
- package/dist/plugin-utils/logging.d.mts +111 -0
- package/dist/plugin-utils/logging.d.mts.map +1 -0
- package/dist/plugin-utils/logging.mjs +588 -0
- package/dist/plugin-utils/logging.mjs.map +1 -0
- package/dist/plugin-utils/merge.cjs +4 -4
- package/dist/plugin-utils/merge.d.cts +0 -1
- package/dist/plugin-utils/merge.d.cts.map +1 -1
- package/dist/plugin-utils/merge.d.mts.map +1 -1
- package/dist/plugin-utils/merge.mjs +3 -3
- package/dist/plugin-utils/merge.mjs.map +1 -1
- package/dist/plugin-utils/modules.cjs +1 -1
- package/dist/plugin-utils/modules.mjs +1 -1
- package/dist/plugin-utils/modules.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +18 -4
- package/dist/plugin-utils/paths.d.cts +12 -2
- package/dist/plugin-utils/paths.d.cts.map +1 -1
- package/dist/plugin-utils/paths.d.mts +12 -2
- package/dist/plugin-utils/paths.d.mts.map +1 -1
- package/dist/plugin-utils/paths.mjs +18 -4
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/plugin-utils/virtual.cjs +80 -0
- package/dist/plugin-utils/virtual.d.cts +69 -0
- package/dist/plugin-utils/virtual.d.cts.map +1 -0
- package/dist/plugin-utils/virtual.d.mts +69 -0
- package/dist/plugin-utils/virtual.d.mts.map +1 -0
- package/dist/plugin-utils/virtual.mjs +73 -0
- package/dist/plugin-utils/virtual.mjs.map +1 -0
- package/dist/schemas/fs.cjs +232 -0
- package/dist/schemas/fs.d.cts +127 -0
- package/dist/schemas/fs.d.cts.map +1 -0
- package/dist/schemas/fs.d.mts +127 -0
- package/dist/schemas/fs.d.mts.map +1 -0
- package/dist/schemas/fs.mjs +226 -0
- package/dist/schemas/fs.mjs.map +1 -0
- package/dist/storage/base.cjs +216 -0
- package/dist/storage/base.d.cts +201 -0
- package/dist/storage/base.d.cts.map +1 -0
- package/dist/storage/base.d.mts +201 -0
- package/dist/storage/base.d.mts.map +1 -0
- package/dist/storage/base.mjs +215 -0
- package/dist/storage/base.mjs.map +1 -0
- package/dist/storage/file-system.cjs +180 -0
- package/dist/storage/file-system.d.cts +129 -0
- package/dist/storage/file-system.d.cts.map +1 -0
- package/dist/storage/file-system.d.mts +129 -0
- package/dist/storage/file-system.d.mts.map +1 -0
- package/dist/storage/file-system.mjs +179 -0
- package/dist/storage/file-system.mjs.map +1 -0
- package/dist/storage/helpers.cjs +37 -0
- package/dist/storage/helpers.d.cts +25 -0
- package/dist/storage/helpers.d.cts.map +1 -0
- package/dist/storage/helpers.d.mts +25 -0
- package/dist/storage/helpers.d.mts.map +1 -0
- package/dist/storage/helpers.mjs +34 -0
- package/dist/storage/helpers.mjs.map +1 -0
- package/dist/storage/index.cjs +12 -0
- package/dist/storage/index.d.cts +5 -0
- package/dist/storage/index.d.mts +5 -0
- package/dist/storage/index.mjs +6 -0
- package/dist/storage/virtual.cjs +98 -0
- package/dist/storage/virtual.d.cts +80 -0
- package/dist/storage/virtual.d.cts.map +1 -0
- package/dist/storage/virtual.d.mts +80 -0
- package/dist/storage/virtual.d.mts.map +1 -0
- package/dist/storage/virtual.mjs +97 -0
- package/dist/storage/virtual.mjs.map +1 -0
- package/dist/types/api.d.cts +18 -99
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +18 -99
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/config.d.cts +239 -141
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +240 -142
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +205 -136
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +208 -139
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/fs.d.cts +49 -5
- package/dist/types/fs.d.cts.map +1 -1
- package/dist/types/fs.d.mts +50 -6
- package/dist/types/fs.d.mts.map +1 -1
- package/dist/types/hooks.d.cts +26 -38
- package/dist/types/hooks.d.cts.map +1 -1
- package/dist/types/hooks.d.mts +26 -38
- package/dist/types/hooks.d.mts.map +1 -1
- package/dist/types/index.d.cts +9 -0
- package/dist/types/index.d.mts +8 -8
- package/dist/types/logging.d.cts +161 -0
- package/dist/types/logging.d.cts.map +1 -0
- package/dist/types/logging.d.mts +161 -0
- package/dist/types/logging.d.mts.map +1 -0
- package/dist/types/plugin.d.cts +23 -24
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +23 -24
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/tsconfig.d.cts +15 -12
- package/dist/types/tsconfig.d.cts.map +1 -1
- package/dist/types/tsconfig.d.mts +16 -13
- package/dist/types/tsconfig.d.mts.map +1 -1
- package/dist/types/unplugin.d.cts +10 -25
- package/dist/types/unplugin.d.cts.map +1 -1
- package/dist/types/unplugin.d.mts +10 -25
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +270 -425
- package/schemas/fs.capnp +42 -0
- package/dist/lib/logger.cjs +0 -59
- package/dist/lib/logger.d.cts +0 -23
- package/dist/lib/logger.d.cts.map +0 -1
- package/dist/lib/logger.d.mts +0 -23
- package/dist/lib/logger.d.mts.map +0 -1
- package/dist/lib/logger.mjs +0 -56
- package/dist/lib/logger.mjs.map +0 -1
- package/dist/types/_internal.cjs +0 -0
- package/dist/types/_internal.d.cts +0 -106
- package/dist/types/_internal.d.cts.map +0 -1
- package/dist/types/_internal.d.mts +0 -106
- package/dist/types/_internal.d.mts.map +0 -1
- package/dist/types/_internal.mjs +0 -1
- package/dist/types/commands.d.cts +0 -13
- package/dist/types/commands.d.cts.map +0 -1
- package/dist/types/commands.d.mts +0 -13
- package/dist/types/commands.d.mts.map +0 -1
|
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_plugin_utils_helpers = require('./helpers.cjs');
|
|
4
4
|
let defu = require("defu");
|
|
5
|
-
defu = require_runtime.__toESM(defu);
|
|
6
|
-
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
5
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
7
6
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
8
7
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
8
|
let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
9
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
10
10
|
let _stryke_type_checks_is_set_array = require("@stryke/type-checks/is-set-array");
|
|
11
11
|
|
|
12
12
|
//#region src/plugin-utils/merge.ts
|
|
@@ -66,8 +66,8 @@ const mergeConfig = (0, defu.createDefu)((obj, key, value) => {
|
|
|
66
66
|
if ((0, _stryke_type_checks_is_set_array.isSetArray)(obj[key])) obj[key] = (0, _stryke_helpers_get_unique.getUnique)(obj[key]);
|
|
67
67
|
return true;
|
|
68
68
|
}
|
|
69
|
-
if ((0,
|
|
70
|
-
|
|
69
|
+
if (!(0, _stryke_type_checks_is_set.isSet)(obj[key]) && (0, _stryke_type_checks_is_string.isString)(value)) {
|
|
70
|
+
obj[key] = value;
|
|
71
71
|
return true;
|
|
72
72
|
}
|
|
73
73
|
return false;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Plugin } from "../types/plugin.cjs";
|
|
2
2
|
import { PluginContext } from "../types/context.cjs";
|
|
3
3
|
import { PartialPlugin, ResolvedConfig } from "../types/config.cjs";
|
|
4
|
-
|
|
5
4
|
//#region src/plugin-utils/merge.d.ts
|
|
6
5
|
type MergeResult<TContext extends PluginContext, TPluginA extends Plugin<TContext> | PartialPlugin<TContext>, TPluginB extends Plugin<TContext> | PartialPlugin<TContext>> = TPluginA extends Plugin<TContext> ? Plugin<TContext> : TPluginB extends Plugin<TContext> ? Plugin<TContext> : PartialPlugin<TContext>;
|
|
7
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.cts","names":[],"sources":["../../src/plugin-utils/merge.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge.d.cts","names":[],"sources":["../../src/plugin-utils/merge.ts"],"mappings":";;;;KAgCY,WAAA,kBACO,aAAA,mBACA,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,oBACjC,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,KAElD,QAAA,SAAiB,MAAA,CAAO,QAAA,IACpB,MAAA,CAAO,QAAA,IACP,QAAA,SAAiB,MAAA,CAAO,QAAA,IACtB,MAAA,CAAO,QAAA,IACP,aAAA,CAAc,QAAA;;;;;AATtB;;;iBAwCgB,KAAA,kBAAuB,aAAA,GAAgB,aAAA,CAAA,CACrD,OAAA,EAAS,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,GAC1C,OAAA,EAAS,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,IACzC,WAAA,CAAY,QAAA,SAAiB,OAAA,SAAgB,OAAA;;;;;;;;;;;;;;;;;cAwBnC,WAAA,MAuCH,OAAA,gBAAuB,cAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.mts","names":[],"sources":["../../src/plugin-utils/merge.ts"],"mappings":";;;;KAgCY,WAAA,kBACO,aAAA,mBACA,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,oBACjC,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,KAElD,QAAA,SAAiB,MAAA,CAAO,QAAA,IACpB,MAAA,CAAO,QAAA,IACP,QAAA,SAAiB,MAAA,CAAO,QAAA,IACtB,MAAA,CAAO,QAAA,IACP,aAAA,CAAc,QAAA;;;;;AATtB;;;iBAwCgB,KAAA,kBAAuB,aAAA,GAAgB,aAAA,CAAA,CACrD,OAAA,EAAS,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,GAC1C,OAAA,EAAS,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,IACzC,WAAA,CAAY,QAAA,SAAiB,OAAA,SAAgB,OAAA;;;;;;;;;;;;;;;;;cAwBnC,WAAA,
|
|
1
|
+
{"version":3,"file":"merge.d.mts","names":[],"sources":["../../src/plugin-utils/merge.ts"],"mappings":";;;;KAgCY,WAAA,kBACO,aAAA,mBACA,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,oBACjC,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,KAElD,QAAA,SAAiB,MAAA,CAAO,QAAA,IACpB,MAAA,CAAO,QAAA,IACP,QAAA,SAAiB,MAAA,CAAO,QAAA,IACtB,MAAA,CAAO,QAAA,IACP,aAAA,CAAc,QAAA;;;;;AATtB;;;iBAwCgB,KAAA,kBAAuB,aAAA,GAAgB,aAAA,CAAA,CACrD,OAAA,EAAS,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,GAC1C,OAAA,EAAS,MAAA,CAAO,QAAA,IAAY,aAAA,CAAc,QAAA,IACzC,WAAA,CAAY,QAAA,SAAiB,OAAA,SAAgB,OAAA;;;;;;;;;;;;;;;;;cAwBnC,WAAA,MAuCH,OAAA,gBAAuB,cAAA;AAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getHookHandler, isPluginHook } from "./helpers.mjs";
|
|
2
2
|
import defu, { createDefu } from "defu";
|
|
3
|
-
import { getUnique } from "@stryke/helpers/get-unique";
|
|
4
3
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
5
4
|
import { isString } from "@stryke/type-checks/is-string";
|
|
6
5
|
import { isSet } from "@stryke/type-checks/is-set";
|
|
6
|
+
import { getUnique } from "@stryke/helpers/get-unique";
|
|
7
7
|
import { isSetArray } from "@stryke/type-checks/is-set-array";
|
|
8
8
|
|
|
9
9
|
//#region src/plugin-utils/merge.ts
|
|
@@ -63,8 +63,8 @@ const mergeConfig = createDefu((obj, key, value) => {
|
|
|
63
63
|
if (isSetArray(obj[key])) obj[key] = getUnique(obj[key]);
|
|
64
64
|
return true;
|
|
65
65
|
}
|
|
66
|
-
if (
|
|
67
|
-
|
|
66
|
+
if (!isSet(obj[key]) && isString(value)) {
|
|
67
|
+
obj[key] = value;
|
|
68
68
|
return true;
|
|
69
69
|
}
|
|
70
70
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.mjs","names":[],"sources":["../../src/plugin-utils/merge.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 { getUnique } from \"@stryke/helpers/get-unique\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu, { createDefu } from \"defu\";\nimport type {\n PartialPlugin,\n Plugin,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { getHookHandler, isPluginHook } from \"./helpers\";\n\nexport type MergeResult<\n TContext extends PluginContext,\n TPluginA extends Plugin<TContext> | PartialPlugin<TContext>,\n TPluginB extends Plugin<TContext> | PartialPlugin<TContext>\n> =\n TPluginA extends Plugin<TContext>\n ? Plugin<TContext>\n : TPluginB extends Plugin<TContext>\n ? Plugin<TContext>\n : PartialPlugin<TContext>;\n\nconst mergePlugin = createDefu((obj, key, value) => {\n if (isPluginHook(obj[key]) && isPluginHook(value)) {\n obj[key] = {\n ...obj[key],\n ...value,\n handler: async (...params: any[]) => {\n const [resultA, resultB] = await Promise.all([\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(obj[key]) as any)(...params),\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(value) as any)(...params)\n ]);\n\n return resultB && resultA ? defu(resultA, resultB) : resultA || resultB;\n }\n };\n return true;\n }\n\n return false;\n});\n\n/**\n * Merges two {@link Plugin | plugins} or {@link PartialPlugin | partial plugins} together.\n *\n * @param pluginA - The first {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @param pluginB - The second {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @returns The merged {@link Plugin | plugin} or {@link PartialPlugin | partial plugin}.\n */\nexport function merge<TContext extends PluginContext = PluginContext>(\n pluginA: Plugin<TContext> | PartialPlugin<TContext>,\n pluginB: Plugin<TContext> | PartialPlugin<TContext>\n): MergeResult<TContext, typeof pluginA, typeof pluginB> {\n return mergePlugin(pluginA, pluginB) as MergeResult<\n TContext,\n typeof pluginA,\n typeof pluginB\n >;\n}\n\n/**\n * Merges two configuration objects together, with special handling for string values.\n * If the value from the second object is a non-empty string, it will overwrite the value from the first object.\n *\n * @example\n * ```ts\n * const configA = { name: \"Default\", version: \"1.0.0\" };\n * const configB = { name: \"Custom\", description: \"A custom config\" };\n * const mergedConfig = mergeConfig(configA, configB);\n * // Result: { name: \"Custom\", version: \"1.0.0\", description: \"A custom config\" }\n * ```\n *\n * @param objA - The first configuration object.\n * @param objB - The second configuration object.\n * @returns The merged configuration object.\n */\nexport const mergeConfig = createDefu((obj, key, value) => {\n type TValue = (typeof obj)[typeof key];\n\n if (key === \"input\" && isSet(value)) {\n if (isString(obj[key]) && Array.isArray(value) && value.length === 0) {\n return true;\n }\n\n obj[key] = value;\n if (isSetArray(obj[key])) {\n obj[key] = getUnique(obj[key]) as TValue;\n }\n\n return true;\n }\n\n if (key === \"compatibilityDate\" && isSetString(value)) {\n obj[key] = value;\n return true;\n }\n\n if (\n (key === \"format\" || key === \"output.format\") &&\n (isSetString(value) || isSetArray(value))\n ) {\n obj[key] = value;\n if (isSetArray(obj[key])) {\n obj[key] = getUnique(obj[key]) as TValue;\n }\n\n return true;\n }\n\n if (
|
|
1
|
+
{"version":3,"file":"merge.mjs","names":[],"sources":["../../src/plugin-utils/merge.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 { getUnique } from \"@stryke/helpers/get-unique\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu, { createDefu } from \"defu\";\nimport type {\n PartialPlugin,\n Plugin,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { getHookHandler, isPluginHook } from \"./helpers\";\n\nexport type MergeResult<\n TContext extends PluginContext,\n TPluginA extends Plugin<TContext> | PartialPlugin<TContext>,\n TPluginB extends Plugin<TContext> | PartialPlugin<TContext>\n> =\n TPluginA extends Plugin<TContext>\n ? Plugin<TContext>\n : TPluginB extends Plugin<TContext>\n ? Plugin<TContext>\n : PartialPlugin<TContext>;\n\nconst mergePlugin = createDefu((obj, key, value) => {\n if (isPluginHook(obj[key]) && isPluginHook(value)) {\n obj[key] = {\n ...obj[key],\n ...value,\n handler: async (...params: any[]) => {\n const [resultA, resultB] = await Promise.all([\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(obj[key]) as any)(...params),\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(value) as any)(...params)\n ]);\n\n return resultB && resultA ? defu(resultA, resultB) : resultA || resultB;\n }\n };\n return true;\n }\n\n return false;\n});\n\n/**\n * Merges two {@link Plugin | plugins} or {@link PartialPlugin | partial plugins} together.\n *\n * @param pluginA - The first {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @param pluginB - The second {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @returns The merged {@link Plugin | plugin} or {@link PartialPlugin | partial plugin}.\n */\nexport function merge<TContext extends PluginContext = PluginContext>(\n pluginA: Plugin<TContext> | PartialPlugin<TContext>,\n pluginB: Plugin<TContext> | PartialPlugin<TContext>\n): MergeResult<TContext, typeof pluginA, typeof pluginB> {\n return mergePlugin(pluginA, pluginB) as MergeResult<\n TContext,\n typeof pluginA,\n typeof pluginB\n >;\n}\n\n/**\n * Merges two configuration objects together, with special handling for string values.\n * If the value from the second object is a non-empty string, it will overwrite the value from the first object.\n *\n * @example\n * ```ts\n * const configA = { name: \"Default\", version: \"1.0.0\" };\n * const configB = { name: \"Custom\", description: \"A custom config\" };\n * const mergedConfig = mergeConfig(configA, configB);\n * // Result: { name: \"Custom\", version: \"1.0.0\", description: \"A custom config\" }\n * ```\n *\n * @param objA - The first configuration object.\n * @param objB - The second configuration object.\n * @returns The merged configuration object.\n */\nexport const mergeConfig = createDefu((obj, key, value) => {\n type TValue = (typeof obj)[typeof key];\n\n if (key === \"input\" && isSet(value)) {\n if (isString(obj[key]) && Array.isArray(value) && value.length === 0) {\n return true;\n }\n\n obj[key] = value;\n if (isSetArray(obj[key])) {\n obj[key] = getUnique(obj[key]) as TValue;\n }\n\n return true;\n }\n\n if (key === \"compatibilityDate\" && isSetString(value)) {\n obj[key] = value;\n return true;\n }\n\n if (\n (key === \"format\" || key === \"output.format\") &&\n (isSetString(value) || isSetArray(value))\n ) {\n obj[key] = value;\n if (isSetArray(obj[key])) {\n obj[key] = getUnique(obj[key]) as TValue;\n }\n\n return true;\n }\n\n if (!isSet(obj[key]) && isString(value)) {\n obj[key] = value;\n return true;\n }\n\n return false;\n}) as (...configs: unknown[]) => ResolvedConfig;\n"],"mappings":";;;;;;;;;AA2CA,MAAM,cAAc,YAAY,KAAK,KAAK,UAAU;AAClD,KAAI,aAAa,IAAI,KAAK,IAAI,aAAa,MAAM,EAAE;AACjD,MAAI,OAAO;GACT,GAAG,IAAI;GACP,GAAG;GACH,SAAS,OAAO,GAAG,WAAkB;IACnC,MAAM,CAAC,SAAS,WAAW,MAAM,QAAQ,IAAI,CAE1C,eAAe,IAAI,KAAK,CAAS,GAAG,OAAO,EAE3C,eAAe,MAAM,CAAS,GAAG,OAAO,CAC1C,CAAC;AAEF,WAAO,WAAW,UAAU,KAAK,SAAS,QAAQ,GAAG,WAAW;;GAEnE;AACD,SAAO;;AAGT,QAAO;EACP;;;;;;;;AASF,SAAgB,MACd,SACA,SACuD;AACvD,QAAO,YAAY,SAAS,QAAQ;;;;;;;;;;;;;;;;;;AAuBtC,MAAa,cAAc,YAAY,KAAK,KAAK,UAAU;AAGzD,KAAI,QAAQ,WAAW,MAAM,MAAM,EAAE;AACnC,MAAI,SAAS,IAAI,KAAK,IAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,WAAW,EACjE,QAAO;AAGT,MAAI,OAAO;AACX,MAAI,WAAW,IAAI,KAAK,CACtB,KAAI,OAAO,UAAU,IAAI,KAAK;AAGhC,SAAO;;AAGT,KAAI,QAAQ,uBAAuB,YAAY,MAAM,EAAE;AACrD,MAAI,OAAO;AACX,SAAO;;AAGT,MACG,QAAQ,YAAY,QAAQ,qBAC5B,YAAY,MAAM,IAAI,WAAW,MAAM,GACxC;AACA,MAAI,OAAO;AACX,MAAI,WAAW,IAAI,KAAK,CACtB,KAAI,OAAO,UAAU,IAAI,KAAK;AAGhC,SAAO;;AAGT,KAAI,CAAC,MAAM,IAAI,KAAK,IAAI,SAAS,MAAM,EAAE;AACvC,MAAI,OAAO;AACX,SAAO;;AAGT,QAAO;EACP"}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
9
9
|
* @returns `true` if the module is a built-in module, otherwise `false`.
|
|
10
10
|
*/
|
|
11
11
|
function isBuiltinModule(context, moduleName) {
|
|
12
|
-
const prefix = context.config?.framework || "powerlines";
|
|
12
|
+
const prefix = context.config?.framework?.name || "powerlines";
|
|
13
13
|
return moduleName.startsWith(`${prefix.replace(/:$/, "")}:`) || Object.keys(context.fs.metadata).filter((key) => context.fs.metadata[key]?.type === "builtin").includes(moduleName);
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @returns `true` if the module is a built-in module, otherwise `false`.
|
|
8
8
|
*/
|
|
9
9
|
function isBuiltinModule(context, moduleName) {
|
|
10
|
-
const prefix = context.config?.framework || "powerlines";
|
|
10
|
+
const prefix = context.config?.framework?.name || "powerlines";
|
|
11
11
|
return moduleName.startsWith(`${prefix.replace(/:$/, "")}:`) || Object.keys(context.fs.metadata).filter((key) => context.fs.metadata[key]?.type === "builtin").includes(moduleName);
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.mjs","names":[],"sources":["../../src/plugin-utils/modules.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 { Context } from \"../types/context\";\n\n/**\n * Determine if a module ID is a built-in Powerlines module ID.\n *\n * @param context - The Powerlines context.\n * @param moduleName - The name of the module to check.\n * @returns `true` if the module is a built-in module, otherwise `false`.\n */\nexport function isBuiltinModule(context: Context, moduleName: string): boolean {\n const prefix: string = context.config?.framework || \"powerlines\";\n\n return (\n moduleName.startsWith(`${prefix.replace(/:$/, \"\")}:`) ||\n Object.keys(context.fs.metadata)\n .filter(key => context.fs.metadata[key]?.type === \"builtin\")\n .includes(moduleName)\n );\n}\n"],"mappings":";;;;;;;;AA2BA,SAAgB,gBAAgB,SAAkB,YAA6B;CAC7E,MAAM,SAAiB,QAAQ,QAAQ,
|
|
1
|
+
{"version":3,"file":"modules.mjs","names":[],"sources":["../../src/plugin-utils/modules.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 { Context } from \"../types/context\";\n\n/**\n * Determine if a module ID is a built-in Powerlines module ID.\n *\n * @param context - The Powerlines context.\n * @param moduleName - The name of the module to check.\n * @returns `true` if the module is a built-in module, otherwise `false`.\n */\nexport function isBuiltinModule(context: Context, moduleName: string): boolean {\n const prefix: string = context.config?.framework?.name || \"powerlines\";\n\n return (\n moduleName.startsWith(`${prefix.replace(/:$/, \"\")}:`) ||\n Object.keys(context.fs.metadata)\n .filter(key => context.fs.metadata[key]?.type === \"builtin\")\n .includes(moduleName)\n );\n}\n"],"mappings":";;;;;;;;AA2BA,SAAgB,gBAAgB,SAAkB,YAA6B;CAC7E,MAAM,SAAiB,QAAQ,QAAQ,WAAW,QAAQ;AAE1D,QACE,WAAW,WAAW,GAAG,OAAO,QAAQ,MAAM,GAAG,CAAC,GAAG,IACrD,OAAO,KAAK,QAAQ,GAAG,SAAS,CAC7B,QAAO,QAAO,QAAQ,GAAG,SAAS,MAAM,SAAS,UAAU,CAC3D,SAAS,WAAW"}
|
|
@@ -10,10 +10,11 @@ let _stryke_path_join = require("@stryke/path/join");
|
|
|
10
10
|
*
|
|
11
11
|
* @remarks
|
|
12
12
|
* The following tokens are supported:
|
|
13
|
-
* - `{
|
|
13
|
+
* - `{cwd}` - The current working directory.
|
|
14
|
+
* - `{workspaceRoot}` - The current working directory (same as `{cwd}`).
|
|
14
15
|
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
15
16
|
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
16
|
-
* - `{sourceRoot}` - The source root directory of the project (usually
|
|
17
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `{root}/src`).
|
|
17
18
|
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
18
19
|
* - `{cachePath}` - The environment's directory for cached files.
|
|
19
20
|
* - `{dataPath}` - The environment's directory for data files.
|
|
@@ -28,14 +29,27 @@ let _stryke_path_join = require("@stryke/path/join");
|
|
|
28
29
|
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
29
30
|
* - `{entryPath}` - The configured directory for generated entry files.
|
|
30
31
|
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const path = replacePathTokens(context, "{root}/dist");
|
|
35
|
+
* // If context.config.root is "/home/user/project", this will return "/home/user/project/dist"
|
|
36
|
+
*
|
|
37
|
+
* const pathWithCopy = replacePathTokens(context, "{copy}");
|
|
38
|
+
* // If context.config.output.copy.path is "/home/user/project/dist-copy", this will return "/home/user/project/dist-copy"
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
31
41
|
* @param context - The context containing the values for the path tokens.
|
|
32
42
|
* @param path - The path string with tokens to replace.
|
|
33
43
|
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
34
44
|
*/
|
|
35
45
|
function replacePathTokens(context, path) {
|
|
36
46
|
if (!path) return path;
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
let result = path.replaceAll("{cwd}", context.config.cwd || process.cwd()).replaceAll("{workspaceRoot}", context.config.cwd || process.cwd()).replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", (0, _stryke_path_join.joinPaths)(context.config.root, "src")).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{artifactsPath}", (0, _stryke_path_replace.replacePath)(context.artifactsPath, context.config.cwd)).replaceAll("{builtinPath}", (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.config.cwd)).replaceAll("{builtinsPath}", (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.config.cwd)).replaceAll("{entryPath}", (0, _stryke_path_replace.replacePath)(context.entryPath, context.config.cwd));
|
|
48
|
+
if (context.config.output) {
|
|
49
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(context.config.output.path)) result = result.replaceAll("{outputPath}", context.config.output.path).replaceAll("{output}", context.config.output.path);
|
|
50
|
+
if (context.config.output.copy && (0, _stryke_type_checks_is_set_string.isSetString)(context.config.output.copy?.path)) result = result.replaceAll("{copyPath}", context.config.output.copy.path).replaceAll("{copy}", context.config.output.copy.path);
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
//#endregion
|
|
@@ -7,10 +7,11 @@ import { IsUndefined } from "@stryke/types/base";
|
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
9
|
* The following tokens are supported:
|
|
10
|
-
* - `{
|
|
10
|
+
* - `{cwd}` - The current working directory.
|
|
11
|
+
* - `{workspaceRoot}` - The current working directory (same as `{cwd}`).
|
|
11
12
|
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
12
13
|
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
13
|
-
* - `{sourceRoot}` - The source root directory of the project (usually
|
|
14
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `{root}/src`).
|
|
14
15
|
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
15
16
|
* - `{cachePath}` - The environment's directory for cached files.
|
|
16
17
|
* - `{dataPath}` - The environment's directory for data files.
|
|
@@ -25,6 +26,15 @@ import { IsUndefined } from "@stryke/types/base";
|
|
|
25
26
|
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
26
27
|
* - `{entryPath}` - The configured directory for generated entry files.
|
|
27
28
|
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const path = replacePathTokens(context, "{root}/dist");
|
|
32
|
+
* // If context.config.root is "/home/user/project", this will return "/home/user/project/dist"
|
|
33
|
+
*
|
|
34
|
+
* const pathWithCopy = replacePathTokens(context, "{copy}");
|
|
35
|
+
* // If context.config.output.copy.path is "/home/user/project/dist-copy", this will return "/home/user/project/dist-copy"
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
28
38
|
* @param context - The context containing the values for the path tokens.
|
|
29
39
|
* @param path - The path string with tokens to replace.
|
|
30
40
|
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.cts","names":[],"sources":["../../src/plugin-utils/paths.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"paths.d.cts","names":[],"sources":["../../src/plugin-utils/paths.ts"],"mappings":";;;;;;AA6DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,iBAAA,CACd,OAAA,EAAS,iBAAA,EACT,IAAA,YACC,WAAA,QAAmB,IAAA"}
|
|
@@ -7,10 +7,11 @@ import { IsUndefined } from "@stryke/types/base";
|
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
9
|
* The following tokens are supported:
|
|
10
|
-
* - `{
|
|
10
|
+
* - `{cwd}` - The current working directory.
|
|
11
|
+
* - `{workspaceRoot}` - The current working directory (same as `{cwd}`).
|
|
11
12
|
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
12
13
|
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
13
|
-
* - `{sourceRoot}` - The source root directory of the project (usually
|
|
14
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `{root}/src`).
|
|
14
15
|
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
15
16
|
* - `{cachePath}` - The environment's directory for cached files.
|
|
16
17
|
* - `{dataPath}` - The environment's directory for data files.
|
|
@@ -25,6 +26,15 @@ import { IsUndefined } from "@stryke/types/base";
|
|
|
25
26
|
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
26
27
|
* - `{entryPath}` - The configured directory for generated entry files.
|
|
27
28
|
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const path = replacePathTokens(context, "{root}/dist");
|
|
32
|
+
* // If context.config.root is "/home/user/project", this will return "/home/user/project/dist"
|
|
33
|
+
*
|
|
34
|
+
* const pathWithCopy = replacePathTokens(context, "{copy}");
|
|
35
|
+
* // If context.config.output.copy.path is "/home/user/project/dist-copy", this will return "/home/user/project/dist-copy"
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
28
38
|
* @param context - The context containing the values for the path tokens.
|
|
29
39
|
* @param path - The path string with tokens to replace.
|
|
30
40
|
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.mts","names":[],"sources":["../../src/plugin-utils/paths.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"paths.d.mts","names":[],"sources":["../../src/plugin-utils/paths.ts"],"mappings":";;;;;;AA6DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,iBAAA,CACd,OAAA,EAAS,iBAAA,EACT,IAAA,YACC,WAAA,QAAmB,IAAA"}
|
|
@@ -8,10 +8,11 @@ import { joinPaths } from "@stryke/path/join";
|
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
10
|
* The following tokens are supported:
|
|
11
|
-
* - `{
|
|
11
|
+
* - `{cwd}` - The current working directory.
|
|
12
|
+
* - `{workspaceRoot}` - The current working directory (same as `{cwd}`).
|
|
12
13
|
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
13
14
|
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
14
|
-
* - `{sourceRoot}` - The source root directory of the project (usually
|
|
15
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `{root}/src`).
|
|
15
16
|
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
16
17
|
* - `{cachePath}` - The environment's directory for cached files.
|
|
17
18
|
* - `{dataPath}` - The environment's directory for data files.
|
|
@@ -26,14 +27,27 @@ import { joinPaths } from "@stryke/path/join";
|
|
|
26
27
|
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
27
28
|
* - `{entryPath}` - The configured directory for generated entry files.
|
|
28
29
|
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const path = replacePathTokens(context, "{root}/dist");
|
|
33
|
+
* // If context.config.root is "/home/user/project", this will return "/home/user/project/dist"
|
|
34
|
+
*
|
|
35
|
+
* const pathWithCopy = replacePathTokens(context, "{copy}");
|
|
36
|
+
* // If context.config.output.copy.path is "/home/user/project/dist-copy", this will return "/home/user/project/dist-copy"
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
29
39
|
* @param context - The context containing the values for the path tokens.
|
|
30
40
|
* @param path - The path string with tokens to replace.
|
|
31
41
|
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
32
42
|
*/
|
|
33
43
|
function replacePathTokens(context, path) {
|
|
34
44
|
if (!path) return path;
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
let result = path.replaceAll("{cwd}", context.config.cwd || process.cwd()).replaceAll("{workspaceRoot}", context.config.cwd || process.cwd()).replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", joinPaths(context.config.root, "src")).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.config.cwd)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.config.cwd)).replaceAll("{builtinsPath}", replacePath(context.builtinsPath, context.config.cwd)).replaceAll("{entryPath}", replacePath(context.entryPath, context.config.cwd));
|
|
46
|
+
if (context.config.output) {
|
|
47
|
+
if (isSetString(context.config.output.path)) result = result.replaceAll("{outputPath}", context.config.output.path).replaceAll("{output}", context.config.output.path);
|
|
48
|
+
if (context.config.output.copy && isSetString(context.config.output.copy?.path)) result = result.replaceAll("{copyPath}", context.config.output.copy.path).replaceAll("{copy}", context.config.output.copy.path);
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
37
51
|
}
|
|
38
52
|
|
|
39
53
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.mjs","names":[],"sources":["../../src/plugin-utils/paths.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 { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { IsUndefined } from \"@stryke/types/base\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Replaces tokens in the given path string with their corresponding values from the context.\n *\n * @remarks\n * The following tokens are supported:\n * - `{workspaceRoot}` - The
|
|
1
|
+
{"version":3,"file":"paths.mjs","names":[],"sources":["../../src/plugin-utils/paths.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 { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { IsUndefined } from \"@stryke/types/base\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Replaces tokens in the given path string with their corresponding values from the context.\n *\n * @remarks\n * The following tokens are supported:\n * - `{cwd}` - The current working directory.\n * - `{workspaceRoot}` - The current working directory (same as `{cwd}`).\n * - `{root}` - The root directory of the project (same as `{projectRoot}`).\n * - `{projectRoot}` - The root directory of the project (same as `{root}`).\n * - `{sourceRoot}` - The source root directory of the project (usually `{root}/src`).\n * - `{powerlinesPath}` - The directory where Powerlines is installed.\n * - `{cachePath}` - The environment's directory for cached files.\n * - `{dataPath}` - The environment's directory for data files.\n * - `{logPath}` - The environment's directory for log files.\n * - `{tempPath}` - The environment's directory for temporary files.\n * - `{configPath}` - The environment's directory for configuration files.\n * - `{output}` - The configured output directory for the project.\n * - `{outputPath}` - The configured output directory for the project.\n * - `{copy}` - The configured final/copied distribution directory for the project.\n * - `{copyPath}` - The configured final/copied distribution directory for the project.\n * - `{artifactsPath}` - The configured directory for build artifacts.\n * - `{builtinPath}` - The configured directory for generated built-in plugins.\n * - `{entryPath}` - The configured directory for generated entry files.\n *\n * @example\n * ```ts\n * const path = replacePathTokens(context, \"{root}/dist\");\n * // If context.config.root is \"/home/user/project\", this will return \"/home/user/project/dist\"\n *\n * const pathWithCopy = replacePathTokens(context, \"{copy}\");\n * // If context.config.output.copy.path is \"/home/user/project/dist-copy\", this will return \"/home/user/project/dist-copy\"\n * ```\n *\n * @param context - The context containing the values for the path tokens.\n * @param path - The path string with tokens to replace.\n * @returns The path string with tokens replaced by their corresponding values from the context.\n */\nexport function replacePathTokens(\n context: UnresolvedContext,\n path?: string\n): IsUndefined<typeof path> extends true ? undefined : string {\n if (!path) {\n return path as IsUndefined<typeof path> extends true ? undefined : string;\n }\n\n let result = path\n .replaceAll(\"{cwd}\", context.config.cwd || process.cwd())\n .replaceAll(\"{workspaceRoot}\", context.config.cwd || process.cwd())\n .replaceAll(\"{root}\", context.config.root)\n .replaceAll(\"{projectRoot}\", context.config.root)\n .replaceAll(\"{sourceRoot}\", joinPaths(context.config.root, \"src\"))\n .replaceAll(\"{powerlinesPath}\", context.powerlinesPath)\n .replaceAll(\"{cachePath}\", context.cachePath)\n .replaceAll(\"{dataPath}\", context.dataPath)\n .replaceAll(\"{logPath}\", context.envPaths.log)\n .replaceAll(\"{tempPath}\", context.envPaths.temp)\n .replaceAll(\"{configPath}\", context.envPaths.config)\n .replaceAll(\n \"{artifactsPath}\",\n replacePath(context.artifactsPath, context.config.cwd)\n )\n .replaceAll(\n \"{builtinPath}\",\n replacePath(context.builtinsPath, context.config.cwd)\n )\n .replaceAll(\n \"{builtinsPath}\",\n replacePath(context.builtinsPath, context.config.cwd)\n )\n .replaceAll(\n \"{entryPath}\",\n replacePath(context.entryPath, context.config.cwd)\n );\n\n if (context.config.output) {\n if (isSetString(context.config.output.path)) {\n result = result\n .replaceAll(\"{outputPath}\", context.config.output.path)\n .replaceAll(\"{output}\", context.config.output.path);\n }\n if (\n context.config.output.copy &&\n isSetString(context.config.output.copy?.path)\n ) {\n result = result\n .replaceAll(\"{copyPath}\", context.config.output.copy.path)\n .replaceAll(\"{copy}\", context.config.output.copy.path);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,kBACd,SACA,MAC4D;AAC5D,KAAI,CAAC,KACH,QAAO;CAGT,IAAI,SAAS,KACV,WAAW,SAAS,QAAQ,OAAO,OAAO,QAAQ,KAAK,CAAC,CACxD,WAAW,mBAAmB,QAAQ,OAAO,OAAO,QAAQ,KAAK,CAAC,CAClE,WAAW,UAAU,QAAQ,OAAO,KAAK,CACzC,WAAW,iBAAiB,QAAQ,OAAO,KAAK,CAChD,WAAW,gBAAgB,UAAU,QAAQ,OAAO,MAAM,MAAM,CAAC,CACjE,WAAW,oBAAoB,QAAQ,eAAe,CACtD,WAAW,eAAe,QAAQ,UAAU,CAC5C,WAAW,cAAc,QAAQ,SAAS,CAC1C,WAAW,aAAa,QAAQ,SAAS,IAAI,CAC7C,WAAW,cAAc,QAAQ,SAAS,KAAK,CAC/C,WAAW,gBAAgB,QAAQ,SAAS,OAAO,CACnD,WACC,mBACA,YAAY,QAAQ,eAAe,QAAQ,OAAO,IAAI,CACvD,CACA,WACC,iBACA,YAAY,QAAQ,cAAc,QAAQ,OAAO,IAAI,CACtD,CACA,WACC,kBACA,YAAY,QAAQ,cAAc,QAAQ,OAAO,IAAI,CACtD,CACA,WACC,eACA,YAAY,QAAQ,WAAW,QAAQ,OAAO,IAAI,CACnD;AAEH,KAAI,QAAQ,OAAO,QAAQ;AACzB,MAAI,YAAY,QAAQ,OAAO,OAAO,KAAK,CACzC,UAAS,OACN,WAAW,gBAAgB,QAAQ,OAAO,OAAO,KAAK,CACtD,WAAW,YAAY,QAAQ,OAAO,OAAO,KAAK;AAEvD,MACE,QAAQ,OAAO,OAAO,QACtB,YAAY,QAAQ,OAAO,OAAO,MAAM,KAAK,CAE7C,UAAS,OACN,WAAW,cAAc,QAAQ,OAAO,OAAO,KAAK,KAAK,CACzD,WAAW,UAAU,QAAQ,OAAO,OAAO,KAAK,KAAK;;AAI5D,QAAO"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/plugin-utils/virtual.ts
|
|
4
|
+
const ESCAPE_REGEX = /[-/\\^$*+?.()|[\]{}]/g;
|
|
5
|
+
function escapeRegex(str) {
|
|
6
|
+
return str.replace(ESCAPE_REGEX, "\\$&");
|
|
7
|
+
}
|
|
8
|
+
const VIRTUAL_MODULE_PREFIX = "\0";
|
|
9
|
+
const VIRTUAL_MODULE_PREFIX_REGEX = prefixRegex("\0");
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a RegExp that matches a value that has the specified prefix. This is useful for plugin hook filters.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { prefixRegex } from '@rolldown/pluginutils';
|
|
16
|
+
* const plugin = {
|
|
17
|
+
* name: 'plugin',
|
|
18
|
+
* resolveId: {
|
|
19
|
+
* filter: { id: prefixRegex('foo') },
|
|
20
|
+
* handler(id) {} // will only be called for IDs starting with `foo`
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param str - the string to match.
|
|
26
|
+
* @param options - options for the RegExp.
|
|
27
|
+
* @return a RegExp that matches the specified string with the specified prefix.
|
|
28
|
+
*/
|
|
29
|
+
function prefixRegex(str, options = {}) {
|
|
30
|
+
const { flags, prefix, isPrefixOptional = false } = options;
|
|
31
|
+
return new RegExp(`^${prefix ? isPrefixOptional ? `(${escapeRegex(prefix)})?` : `${escapeRegex(prefix)}` : ""}${escapeRegex(str)}`, flags);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Adds the virtual module prefix to the given ID.
|
|
35
|
+
*
|
|
36
|
+
* @param id - The ID to add the virtual module prefix to.
|
|
37
|
+
* @returns The ID with the virtual module prefix added.
|
|
38
|
+
*/
|
|
39
|
+
function addVirtualPrefix(id) {
|
|
40
|
+
return `${"\0"}${id}`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Removes the virtual module prefix from the given ID, if it exists.
|
|
44
|
+
*
|
|
45
|
+
* @param id - The ID to remove the virtual module prefix from.
|
|
46
|
+
* @returns The ID without the virtual module prefix.
|
|
47
|
+
*/
|
|
48
|
+
function removeVirtualPrefix(id) {
|
|
49
|
+
return id.replace(VIRTUAL_MODULE_PREFIX_REGEX, "");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Checks if the given ID is a virtual module by checking if it starts with the virtual module prefix.
|
|
53
|
+
*
|
|
54
|
+
* @param id - The ID to check.
|
|
55
|
+
* @returns True if the ID is a virtual module, false otherwise.
|
|
56
|
+
*/
|
|
57
|
+
function isVirtualModule(id) {
|
|
58
|
+
return id.startsWith("\0");
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a regular expression that matches the given ID with the virtual module prefix.
|
|
62
|
+
*
|
|
63
|
+
* @param id - The ID to create a regular expression for.
|
|
64
|
+
* @returns A regular expression that matches the given ID with the virtual module prefix.
|
|
65
|
+
*/
|
|
66
|
+
function createVirtualPrefixRegex(id) {
|
|
67
|
+
return prefixRegex(removeVirtualPrefix(id), {
|
|
68
|
+
prefix: "\0",
|
|
69
|
+
isPrefixOptional: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
exports.VIRTUAL_MODULE_PREFIX = VIRTUAL_MODULE_PREFIX;
|
|
75
|
+
exports.VIRTUAL_MODULE_PREFIX_REGEX = VIRTUAL_MODULE_PREFIX_REGEX;
|
|
76
|
+
exports.addVirtualPrefix = addVirtualPrefix;
|
|
77
|
+
exports.createVirtualPrefixRegex = createVirtualPrefixRegex;
|
|
78
|
+
exports.isVirtualModule = isVirtualModule;
|
|
79
|
+
exports.prefixRegex = prefixRegex;
|
|
80
|
+
exports.removeVirtualPrefix = removeVirtualPrefix;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//#region src/plugin-utils/virtual.d.ts
|
|
2
|
+
declare const VIRTUAL_MODULE_PREFIX = "\0";
|
|
3
|
+
declare const VIRTUAL_MODULE_PREFIX_REGEX: RegExp;
|
|
4
|
+
interface PrefixRegexOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Flags for the RegExp.
|
|
7
|
+
*/
|
|
8
|
+
flags?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The prefix to match. This will be escaped and used as the prefix in the generated RegExp.
|
|
11
|
+
*/
|
|
12
|
+
prefix?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the prefix is optional. If true, the generated RegExp will match both strings that start with the prefix and strings that do not start with the prefix. Default is false.
|
|
15
|
+
*/
|
|
16
|
+
isPrefixOptional?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Constructs a RegExp that matches a value that has the specified prefix. This is useful for plugin hook filters.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { prefixRegex } from '@rolldown/pluginutils';
|
|
24
|
+
* const plugin = {
|
|
25
|
+
* name: 'plugin',
|
|
26
|
+
* resolveId: {
|
|
27
|
+
* filter: { id: prefixRegex('foo') },
|
|
28
|
+
* handler(id) {} // will only be called for IDs starting with `foo`
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param str - the string to match.
|
|
34
|
+
* @param options - options for the RegExp.
|
|
35
|
+
* @return a RegExp that matches the specified string with the specified prefix.
|
|
36
|
+
*/
|
|
37
|
+
declare function prefixRegex(str: string, options?: PrefixRegexOptions): RegExp;
|
|
38
|
+
/**
|
|
39
|
+
* Adds the virtual module prefix to the given ID.
|
|
40
|
+
*
|
|
41
|
+
* @param id - The ID to add the virtual module prefix to.
|
|
42
|
+
* @returns The ID with the virtual module prefix added.
|
|
43
|
+
*/
|
|
44
|
+
declare function addVirtualPrefix(id: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Removes the virtual module prefix from the given ID, if it exists.
|
|
47
|
+
*
|
|
48
|
+
* @param id - The ID to remove the virtual module prefix from.
|
|
49
|
+
* @returns The ID without the virtual module prefix.
|
|
50
|
+
*/
|
|
51
|
+
declare function removeVirtualPrefix(id: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Checks if the given ID is a virtual module by checking if it starts with the virtual module prefix.
|
|
54
|
+
*
|
|
55
|
+
* @param id - The ID to check.
|
|
56
|
+
* @returns True if the ID is a virtual module, false otherwise.
|
|
57
|
+
*/
|
|
58
|
+
declare function isVirtualModule(id: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a regular expression that matches the given ID with the virtual module prefix.
|
|
61
|
+
*
|
|
62
|
+
* @param id - The ID to create a regular expression for.
|
|
63
|
+
* @returns A regular expression that matches the given ID with the virtual module prefix.
|
|
64
|
+
*/
|
|
65
|
+
declare function createVirtualPrefixRegex(id: string): RegExp;
|
|
66
|
+
declare type __ΩPrefixRegexOptions = any[];
|
|
67
|
+
//#endregion
|
|
68
|
+
export { PrefixRegexOptions, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __ΩPrefixRegexOptions, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, prefixRegex, removeVirtualPrefix };
|
|
69
|
+
//# sourceMappingURL=virtual.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual.d.cts","names":[],"sources":["../../src/plugin-utils/virtual.ts"],"mappings":";cAuBa,qBAAA;AAAA,cACA,2BAAA,EAA2B,MAAA;AAAA,UAEvB,kBAAA;;;;EAIf,KAAA;EAN0D;;;EAW1D,MAAA;EATe;;;EAcf,gBAAA;AAAA;;;;;AAsBF;;;;;;;;;;AAwBA;;;;;iBAxBgB,WAAA,CACd,GAAA,UACA,OAAA,GAAS,kBAAA,GACR,MAAA;;;;;AAyCH;;iBApBgB,gBAAA,CAAiB,EAAA;;;AA8BjC;;;;iBApBgB,mBAAA,CAAoB,EAAA;;;;;;;iBAUpB,eAAA,CAAgB,EAAA;;;;;;;iBAUhB,wBAAA,CAAyB,EAAA,WAAa,MAAA;AAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//#region src/plugin-utils/virtual.d.ts
|
|
2
|
+
declare const VIRTUAL_MODULE_PREFIX = "\0";
|
|
3
|
+
declare const VIRTUAL_MODULE_PREFIX_REGEX: RegExp;
|
|
4
|
+
interface PrefixRegexOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Flags for the RegExp.
|
|
7
|
+
*/
|
|
8
|
+
flags?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The prefix to match. This will be escaped and used as the prefix in the generated RegExp.
|
|
11
|
+
*/
|
|
12
|
+
prefix?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the prefix is optional. If true, the generated RegExp will match both strings that start with the prefix and strings that do not start with the prefix. Default is false.
|
|
15
|
+
*/
|
|
16
|
+
isPrefixOptional?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Constructs a RegExp that matches a value that has the specified prefix. This is useful for plugin hook filters.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { prefixRegex } from '@rolldown/pluginutils';
|
|
24
|
+
* const plugin = {
|
|
25
|
+
* name: 'plugin',
|
|
26
|
+
* resolveId: {
|
|
27
|
+
* filter: { id: prefixRegex('foo') },
|
|
28
|
+
* handler(id) {} // will only be called for IDs starting with `foo`
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param str - the string to match.
|
|
34
|
+
* @param options - options for the RegExp.
|
|
35
|
+
* @return a RegExp that matches the specified string with the specified prefix.
|
|
36
|
+
*/
|
|
37
|
+
declare function prefixRegex(str: string, options?: PrefixRegexOptions): RegExp;
|
|
38
|
+
/**
|
|
39
|
+
* Adds the virtual module prefix to the given ID.
|
|
40
|
+
*
|
|
41
|
+
* @param id - The ID to add the virtual module prefix to.
|
|
42
|
+
* @returns The ID with the virtual module prefix added.
|
|
43
|
+
*/
|
|
44
|
+
declare function addVirtualPrefix(id: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Removes the virtual module prefix from the given ID, if it exists.
|
|
47
|
+
*
|
|
48
|
+
* @param id - The ID to remove the virtual module prefix from.
|
|
49
|
+
* @returns The ID without the virtual module prefix.
|
|
50
|
+
*/
|
|
51
|
+
declare function removeVirtualPrefix(id: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Checks if the given ID is a virtual module by checking if it starts with the virtual module prefix.
|
|
54
|
+
*
|
|
55
|
+
* @param id - The ID to check.
|
|
56
|
+
* @returns True if the ID is a virtual module, false otherwise.
|
|
57
|
+
*/
|
|
58
|
+
declare function isVirtualModule(id: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a regular expression that matches the given ID with the virtual module prefix.
|
|
61
|
+
*
|
|
62
|
+
* @param id - The ID to create a regular expression for.
|
|
63
|
+
* @returns A regular expression that matches the given ID with the virtual module prefix.
|
|
64
|
+
*/
|
|
65
|
+
declare function createVirtualPrefixRegex(id: string): RegExp;
|
|
66
|
+
declare type __ΩPrefixRegexOptions = any[];
|
|
67
|
+
//#endregion
|
|
68
|
+
export { PrefixRegexOptions, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __ΩPrefixRegexOptions, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, prefixRegex, removeVirtualPrefix };
|
|
69
|
+
//# sourceMappingURL=virtual.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual.d.mts","names":[],"sources":["../../src/plugin-utils/virtual.ts"],"mappings":";cAuBa,qBAAA;AAAA,cACA,2BAAA,EAA2B,MAAA;AAAA,UAEvB,kBAAA;;;;EAIf,KAAA;EAN0D;;;EAW1D,MAAA;EATe;;;EAcf,gBAAA;AAAA;;;;;AAsBF;;;;;;;;;;AAwBA;;;;;iBAxBgB,WAAA,CACd,GAAA,UACA,OAAA,GAAS,kBAAA,GACR,MAAA;;;;;AAyCH;;iBApBgB,gBAAA,CAAiB,EAAA;;;AA8BjC;;;;iBApBgB,mBAAA,CAAoB,EAAA;;;;;;;iBAUpB,eAAA,CAAgB,EAAA;;;;;;;iBAUhB,wBAAA,CAAyB,EAAA,WAAa,MAAA;AAAA"}
|