@powerlines/core 0.9.1 → 0.9.3
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.map +1 -1
- 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 +21 -20
- package/dist/lib/unplugin/module-resolution.d.cts +8 -0
- package/dist/lib/unplugin/module-resolution.d.cts.map +1 -1
- package/dist/lib/unplugin/module-resolution.d.mts +8 -0
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -1
- package/dist/lib/unplugin/module-resolution.mjs +20 -20
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +57 -63
- package/dist/lib/unplugin/plugin.d.cts +11 -5
- package/dist/lib/unplugin/plugin.d.cts.map +1 -1
- package/dist/lib/unplugin/plugin.d.mts +11 -5
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs +57 -63
- 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.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 +228 -117
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +231 -120
- 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 -23
- package/dist/types/unplugin.d.cts.map +1 -1
- package/dist/types/unplugin.d.mts +10 -23
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UnresolvedContext } from "../types/context.mjs";
|
|
2
|
+
import { PackageJson } from "@stryke/types/package-json";
|
|
2
3
|
|
|
3
4
|
//#region src/plugin-utils/context-helpers.d.ts
|
|
4
5
|
/**
|
|
@@ -8,13 +9,20 @@ import { UnresolvedContext } from "../types/context.mjs";
|
|
|
8
9
|
* @returns The organization name or undefined if not found.
|
|
9
10
|
*/
|
|
10
11
|
declare function getOrganizationName(context: UnresolvedContext): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Get the organization name from the `package.json` file
|
|
14
|
+
*
|
|
15
|
+
* @param packageJson - The `package.json` object to extract the organization name from.
|
|
16
|
+
* @returns The organization name or undefined if not found.
|
|
17
|
+
*/
|
|
18
|
+
declare function getPackageJsonOrganization(packageJson: PackageJson): string | undefined;
|
|
11
19
|
/**
|
|
12
20
|
* Get the organization name from the context
|
|
13
21
|
*
|
|
14
22
|
* @param context - The Powerlines plugin context.
|
|
15
23
|
* @returns The organization name or undefined if not found.
|
|
16
24
|
*/
|
|
17
|
-
declare function getWorkspaceName(context: UnresolvedContext): string | undefined
|
|
25
|
+
declare function getWorkspaceName(context: UnresolvedContext): Promise<string | undefined>;
|
|
18
26
|
//#endregion
|
|
19
|
-
export { getOrganizationName, getWorkspaceName };
|
|
27
|
+
export { getOrganizationName, getPackageJsonOrganization, getWorkspaceName };
|
|
20
28
|
//# sourceMappingURL=context-helpers.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/context-helpers.ts"],"mappings":";;;;;;AA8BA;;;;iBAAgB,mBAAA,CACd,OAAA,EAAS,iBAAA;AAeX;;;;;AA8DA;AA9DA,iBAAgB,0BAAA,CACd,WAAA,EAAa,WAAA;;;;;;;iBA6DO,gBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tryGetWorkspaceConfig } from "@storm-software/config-tools/get-config";
|
|
1
2
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
3
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
3
4
|
|
|
@@ -9,23 +10,31 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
|
9
10
|
* @returns The organization name or undefined if not found.
|
|
10
11
|
*/
|
|
11
12
|
function getOrganizationName(context) {
|
|
13
|
+
if (isSetString(context.config.organization)) return context.config.organization;
|
|
14
|
+
return getPackageJsonOrganization(context.packageJson);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the organization name from the `package.json` file
|
|
18
|
+
*
|
|
19
|
+
* @param packageJson - The `package.json` object to extract the organization name from.
|
|
20
|
+
* @returns The organization name or undefined if not found.
|
|
21
|
+
*/
|
|
22
|
+
function getPackageJsonOrganization(packageJson) {
|
|
12
23
|
let result;
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (isSetObject(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0].name;
|
|
17
|
-
if (!result && isSetString(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0];
|
|
24
|
+
if (Array.isArray(packageJson.maintainers) && packageJson.maintainers.length > 0) {
|
|
25
|
+
if (isSetObject(packageJson.maintainers[0])) result = packageJson.maintainers[0].name;
|
|
26
|
+
if (!result && isSetString(packageJson.maintainers[0])) result = packageJson.maintainers[0];
|
|
18
27
|
}
|
|
19
|
-
if (!result && Array.isArray(
|
|
20
|
-
if (isSetObject(
|
|
21
|
-
if (!result && isSetString(
|
|
28
|
+
if (!result && Array.isArray(packageJson.author) && packageJson.author.length > 0) {
|
|
29
|
+
if (isSetObject(packageJson.author[0])) result = packageJson.author[0].name;
|
|
30
|
+
if (!result && isSetString(packageJson.author[0])) result = packageJson.author[0];
|
|
22
31
|
}
|
|
23
|
-
if (!result && Array.isArray(
|
|
24
|
-
if (isSetObject(
|
|
25
|
-
if (!result && isSetString(
|
|
32
|
+
if (!result && Array.isArray(packageJson.contributors) && packageJson.contributors.length > 0) {
|
|
33
|
+
if (isSetObject(packageJson.contributors[0])) result = packageJson.contributors[0].name;
|
|
34
|
+
if (!result && isSetString(packageJson.contributors[0])) result = packageJson.contributors[0];
|
|
26
35
|
}
|
|
27
|
-
if (!result && isSetString(
|
|
28
|
-
if (!result && isSetString(
|
|
36
|
+
if (!result && isSetString(packageJson.namespace)) result = packageJson.namespace?.replace(/^@/, "");
|
|
37
|
+
if (!result && isSetString(packageJson.name)) result = packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
29
38
|
return result;
|
|
30
39
|
}
|
|
31
40
|
/**
|
|
@@ -34,15 +43,18 @@ function getOrganizationName(context) {
|
|
|
34
43
|
* @param context - The Powerlines plugin context.
|
|
35
44
|
* @returns The organization name or undefined if not found.
|
|
36
45
|
*/
|
|
37
|
-
function getWorkspaceName(context) {
|
|
46
|
+
async function getWorkspaceName(context) {
|
|
38
47
|
let result;
|
|
39
|
-
|
|
40
|
-
if (
|
|
48
|
+
const workspaceConfig = await tryGetWorkspaceConfig(true);
|
|
49
|
+
if (workspaceConfig) {
|
|
50
|
+
if (isSetString(workspaceConfig.name)) result = workspaceConfig.name;
|
|
51
|
+
if (!result && isSetString(workspaceConfig.namespace)) result = workspaceConfig.namespace.replace(/^@/, "");
|
|
52
|
+
}
|
|
41
53
|
if (!result && isSetString(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
|
|
42
54
|
if (!result && isSetString(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
|
|
43
55
|
return result;
|
|
44
56
|
}
|
|
45
57
|
|
|
46
58
|
//#endregion
|
|
47
|
-
export { getOrganizationName, getWorkspaceName };
|
|
59
|
+
export { getOrganizationName, getPackageJsonOrganization, getWorkspaceName };
|
|
48
60
|
//# sourceMappingURL=context-helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/plugin-utils/context-helpers.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport function getOrganizationName(\n context: UnresolvedContext\n): string | undefined {\n
|
|
1
|
+
{"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/plugin-utils/context-helpers.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 { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport function getOrganizationName(\n context: UnresolvedContext\n): string | undefined {\n if (isSetString(context.config.organization)) {\n return context.config.organization;\n }\n\n return getPackageJsonOrganization(context.packageJson);\n}\n\n/**\n * Get the organization name from the `package.json` file\n *\n * @param packageJson - The `package.json` object to extract the organization name from.\n * @returns The organization name or undefined if not found.\n */\nexport function getPackageJsonOrganization(\n packageJson: PackageJson\n): string | undefined {\n let result: string | undefined;\n if (\n Array.isArray(packageJson.maintainers) &&\n packageJson.maintainers.length > 0\n ) {\n if (isSetObject(packageJson.maintainers[0])) {\n result = (packageJson.maintainers[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.maintainers[0])) {\n result = packageJson.maintainers[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(packageJson.author) &&\n packageJson.author.length > 0\n ) {\n if (isSetObject(packageJson.author[0])) {\n result = (packageJson.author[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.author[0])) {\n result = packageJson.author[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(packageJson.contributors) &&\n packageJson.contributors.length > 0\n ) {\n if (isSetObject(packageJson.contributors[0])) {\n result = (packageJson.contributors[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.contributors[0])) {\n result = packageJson.contributors[0];\n }\n }\n\n if (!result && isSetString(packageJson.namespace)) {\n result = packageJson.namespace?.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(packageJson.name)) {\n result = packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport async function getWorkspaceName(\n context: UnresolvedContext\n): Promise<string | undefined> {\n let result: string | undefined;\n\n const workspaceConfig = await tryGetWorkspaceConfig(true);\n if (workspaceConfig) {\n if (isSetString(workspaceConfig.name)) {\n result = workspaceConfig.name;\n }\n\n if (!result && isSetString(workspaceConfig.namespace)) {\n result = workspaceConfig.namespace.replace(/^@/, \"\");\n }\n }\n\n if (!result && isSetString(context.packageJson.namespace)) {\n result = context.packageJson.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.name)) {\n result = context.packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgB,oBACd,SACoB;AACpB,KAAI,YAAY,QAAQ,OAAO,aAAa,CAC1C,QAAO,QAAQ,OAAO;AAGxB,QAAO,2BAA2B,QAAQ,YAAY;;;;;;;;AASxD,SAAgB,2BACd,aACoB;CACpB,IAAI;AACJ,KACE,MAAM,QAAQ,YAAY,YAAY,IACtC,YAAY,YAAY,SAAS,GACjC;AACA,MAAI,YAAY,YAAY,YAAY,GAAG,CACzC,UAAU,YAAY,YAAY,GAAwB;AAG5D,MAAI,CAAC,UAAU,YAAY,YAAY,YAAY,GAAG,CACpD,UAAS,YAAY,YAAY;;AAIrC,KACE,CAAC,UACD,MAAM,QAAQ,YAAY,OAAO,IACjC,YAAY,OAAO,SAAS,GAC5B;AACA,MAAI,YAAY,YAAY,OAAO,GAAG,CACpC,UAAU,YAAY,OAAO,GAAwB;AAGvD,MAAI,CAAC,UAAU,YAAY,YAAY,OAAO,GAAG,CAC/C,UAAS,YAAY,OAAO;;AAIhC,KACE,CAAC,UACD,MAAM,QAAQ,YAAY,aAAa,IACvC,YAAY,aAAa,SAAS,GAClC;AACA,MAAI,YAAY,YAAY,aAAa,GAAG,CAC1C,UAAU,YAAY,aAAa,GAAwB;AAG7D,MAAI,CAAC,UAAU,YAAY,YAAY,aAAa,GAAG,CACrD,UAAS,YAAY,aAAa;;AAItC,KAAI,CAAC,UAAU,YAAY,YAAY,UAAU,CAC/C,UAAS,YAAY,WAAW,QAAQ,MAAM,GAAG;AAGnD,KAAI,CAAC,UAAU,YAAY,YAAY,KAAK,CAC1C,UAAS,YAAY,KAAK,QAAQ,MAAM,GAAG,CAAC,QAAQ,SAAS,GAAG;AAGlE,QAAO;;;;;;;;AAST,eAAsB,iBACpB,SAC6B;CAC7B,IAAI;CAEJ,MAAM,kBAAkB,MAAM,sBAAsB,KAAK;AACzD,KAAI,iBAAiB;AACnB,MAAI,YAAY,gBAAgB,KAAK,CACnC,UAAS,gBAAgB;AAG3B,MAAI,CAAC,UAAU,YAAY,gBAAgB,UAAU,CACnD,UAAS,gBAAgB,UAAU,QAAQ,MAAM,GAAG;;AAIxD,KAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,UAAU,CACvD,UAAS,QAAQ,YAAY,UAAU,QAAQ,MAAM,GAAG;AAG1D,KAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,KAAK,CAClD,UAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,GAAG,CAAC,QAAQ,SAAS,GAAG;AAG1E,QAAO"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
4
|
+
|
|
5
|
+
//#region src/plugin-utils/docs-helper.ts
|
|
6
|
+
/**
|
|
7
|
+
* Gets the output path for the generated environment documentation.
|
|
8
|
+
*
|
|
9
|
+
* @param root - The root directory of the project.
|
|
10
|
+
* @returns The output path for the generated environment documentation.
|
|
11
|
+
*/
|
|
12
|
+
function getDocsOutputPath(root) {
|
|
13
|
+
return (0, _stryke_path_join.joinPaths)(root, "docs", "reference");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.getDocsOutputPath = getDocsOutputPath;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/plugin-utils/docs-helper.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Gets the output path for the generated environment documentation.
|
|
4
|
+
*
|
|
5
|
+
* @param root - The root directory of the project.
|
|
6
|
+
* @returns The output path for the generated environment documentation.
|
|
7
|
+
*/
|
|
8
|
+
declare function getDocsOutputPath(root: string): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getDocsOutputPath };
|
|
11
|
+
//# sourceMappingURL=docs-helper.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-helper.d.cts","names":[],"sources":["../../src/plugin-utils/docs-helper.ts"],"mappings":";;AA0BA;;;;;iBAAgB,iBAAA,CAAkB,IAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/plugin-utils/docs-helper.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Gets the output path for the generated environment documentation.
|
|
4
|
+
*
|
|
5
|
+
* @param root - The root directory of the project.
|
|
6
|
+
* @returns The output path for the generated environment documentation.
|
|
7
|
+
*/
|
|
8
|
+
declare function getDocsOutputPath(root: string): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getDocsOutputPath };
|
|
11
|
+
//# sourceMappingURL=docs-helper.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-helper.d.mts","names":[],"sources":["../../src/plugin-utils/docs-helper.ts"],"mappings":";;AA0BA;;;;;iBAAgB,iBAAA,CAAkB,IAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { joinPaths } from "@stryke/path/join";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin-utils/docs-helper.ts
|
|
4
|
+
/**
|
|
5
|
+
* Gets the output path for the generated environment documentation.
|
|
6
|
+
*
|
|
7
|
+
* @param root - The root directory of the project.
|
|
8
|
+
* @returns The output path for the generated environment documentation.
|
|
9
|
+
*/
|
|
10
|
+
function getDocsOutputPath(root) {
|
|
11
|
+
return joinPaths(root, "docs", "reference");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getDocsOutputPath };
|
|
16
|
+
//# sourceMappingURL=docs-helper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/plugin-utils/docs-helper.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\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param root - The root directory of the project.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(root: string): string {\n return joinPaths(root, \"docs\", \"reference\");\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,kBAAkB,MAAsB;AACtD,QAAO,UAAU,MAAM,QAAQ,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend.mjs","names":[],"sources":["../../src/plugin-utils/extend.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 { isFunction } from \"@stryke/type-checks/is-function\";\nimport {\n PartialPlugin,\n PartialPluginFactory,\n PluginFactory\n} from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { merge } from \"./merge\";\n\n/**\n * Adds additional helper functionality to a plugin via a plugin builder function.\n *\n * @param plugin - The base plugin object or factory function to extend.\n * @param extension - The plugin extension object or factory function. This function receives the plugin options and returns a plugin object.\n * @returns A function accepting the plugin options and returning the extended plugin.\n */\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown,\n TExtensionOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TPluginOptions & TExtensionOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPlugin<TContext>\n): PluginFactory<TContext, TPluginOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TExtensionOptions = unknown\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TExtensionOptions>;\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPlugin<TContext>\n): Plugin<TContext>[];\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[] | PluginFactory<TContext, any>,\n extension: PartialPlugin<TContext> | PartialPluginFactory<TContext, any>\n): PluginFactory<TContext, any> | Plugin<TContext>[] {\n if (isFunction(plugin)) {\n if (isFunction(extension)) {\n return async (options: any) => {\n const pluginResult = toArray(await Promise.resolve(plugin(options)));\n const extensionResult = toArray(\n await Promise.resolve(extension(options))\n );\n\n return pluginResult\n .map(p => extensionResult.map(e => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return async (options: any) => {\n const result = toArray(await Promise.resolve(plugin(options)));\n\n return result.map(p => merge(p, extension) as Plugin<TContext>);\n };\n } else if (isFunction(extension)) {\n return async (options: any) => {\n const result = toArray(await Promise.resolve(extension(options)));\n\n return result\n .map(e => toArray(plugin).map(p => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return toArray(plugin).map(p => merge(p, extension) as Plugin<TContext>);\n}\n"],"mappings":";;;;;AA8DA,SAAgB,OACd,QACA,WACmD;AACnD,KAAI,WAAW,OAAO,EAAE;AACtB,MAAI,WAAW,UAAU,CACvB,QAAO,OAAO,YAAiB;GAC7B,MAAM,eAAe,QAAQ,MAAM,QAAQ,QAAQ,OAAO,QAAQ,CAAC,CAAC;GACpE,MAAM,kBAAkB,QACtB,MAAM,QAAQ,QAAQ,UAAU,QAAQ,CAAC,CAC1C;AAED,UAAO,aACJ,KAAI,MAAK,gBAAgB,KAAI,MAAK,MAAM,GAAG,EAAE,CAAqB,CAAC,CACnE,MAAM;;AAIb,SAAO,OAAO,YAAiB;AAG7B,UAFe,QAAQ,MAAM,QAAQ,QAAQ,OAAO,QAAQ,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"extend.mjs","names":[],"sources":["../../src/plugin-utils/extend.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 { isFunction } from \"@stryke/type-checks/is-function\";\nimport {\n PartialPlugin,\n PartialPluginFactory,\n PluginFactory\n} from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { merge } from \"./merge\";\n\n/**\n * Adds additional helper functionality to a plugin via a plugin builder function.\n *\n * @param plugin - The base plugin object or factory function to extend.\n * @param extension - The plugin extension object or factory function. This function receives the plugin options and returns a plugin object.\n * @returns A function accepting the plugin options and returning the extended plugin.\n */\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown,\n TExtensionOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TPluginOptions & TExtensionOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPlugin<TContext>\n): PluginFactory<TContext, TPluginOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TExtensionOptions = unknown\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TExtensionOptions>;\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPlugin<TContext>\n): Plugin<TContext>[];\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[] | PluginFactory<TContext, any>,\n extension: PartialPlugin<TContext> | PartialPluginFactory<TContext, any>\n): PluginFactory<TContext, any> | Plugin<TContext>[] {\n if (isFunction(plugin)) {\n if (isFunction(extension)) {\n return async (options: any) => {\n const pluginResult = toArray(await Promise.resolve(plugin(options)));\n const extensionResult = toArray(\n await Promise.resolve(extension(options))\n );\n\n return pluginResult\n .map(p => extensionResult.map(e => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return async (options: any) => {\n const result = toArray(await Promise.resolve(plugin(options)));\n\n return result.map(p => merge(p, extension) as Plugin<TContext>);\n };\n } else if (isFunction(extension)) {\n return async (options: any) => {\n const result = toArray(await Promise.resolve(extension(options)));\n\n return result\n .map(e => toArray(plugin).map(p => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return toArray(plugin).map(p => merge(p, extension) as Plugin<TContext>);\n}\n"],"mappings":";;;;;AA8DA,SAAgB,OACd,QACA,WACmD;AACnD,KAAI,WAAW,OAAO,EAAE;AACtB,MAAI,WAAW,UAAU,CACvB,QAAO,OAAO,YAAiB;GAC7B,MAAM,eAAe,QAAQ,MAAM,QAAQ,QAAQ,OAAO,QAAQ,CAAC,CAAC;GACpE,MAAM,kBAAkB,QACtB,MAAM,QAAQ,QAAQ,UAAU,QAAQ,CAAC,CAC1C;AAED,UAAO,aACJ,KAAI,MAAK,gBAAgB,KAAI,MAAK,MAAM,GAAG,EAAE,CAAqB,CAAC,CACnE,MAAM;;AAIb,SAAO,OAAO,YAAiB;AAG7B,UAFe,QAAQ,MAAM,QAAQ,QAAQ,OAAO,QAAQ,CAAC,CAEhD,CAAC,KAAI,MAAK,MAAM,GAAG,UAAU,CAAqB;;YAExD,WAAW,UAAU,CAC9B,QAAO,OAAO,YAAiB;AAG7B,SAFe,QAAQ,MAAM,QAAQ,QAAQ,UAAU,QAAQ,CAAC,CAEnD,CACV,KAAI,MAAK,QAAQ,OAAO,CAAC,KAAI,MAAK,MAAM,GAAG,EAAE,CAAqB,CAAC,CACnE,MAAM;;AAIb,QAAO,QAAQ,OAAO,CAAC,KAAI,MAAK,MAAM,GAAG,UAAU,CAAqB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_plugin_utils_virtual = require('./virtual.cjs');
|
|
4
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
6
|
+
let _stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
|
|
7
|
+
let _stryke_path_is_type = require("@stryke/path/is-type");
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
let picomatch = require("picomatch");
|
|
10
|
+
picomatch = require_runtime.__toESM(picomatch, 1);
|
|
11
|
+
|
|
12
|
+
//#region src/plugin-utils/filter.ts
|
|
13
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
14
|
+
function normalize(path) {
|
|
15
|
+
return require_plugin_utils_virtual.removeVirtualPrefix(path).replace(BACKSLASH_REGEX, "/");
|
|
16
|
+
}
|
|
17
|
+
function getMatcherString(glob, cwd) {
|
|
18
|
+
if (glob.startsWith("**") || (0, _stryke_path_is_type.isAbsolutePath)(glob)) return normalize(glob);
|
|
19
|
+
return normalize((0, node_path.resolve)(cwd, glob));
|
|
20
|
+
}
|
|
21
|
+
function patternToIdFilter(pattern) {
|
|
22
|
+
if (pattern instanceof RegExp) return (id) => {
|
|
23
|
+
const normalizedId = normalize(id);
|
|
24
|
+
const result = pattern.test(normalizedId);
|
|
25
|
+
pattern.lastIndex = 0;
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
const matcher = (0, picomatch.default)(getMatcherString(pattern, process.cwd()), { dot: true });
|
|
29
|
+
return (id) => {
|
|
30
|
+
return matcher(normalize(id));
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function patternToCodeFilter(pattern) {
|
|
34
|
+
if (pattern instanceof RegExp) return (code) => {
|
|
35
|
+
const result = pattern.test(code);
|
|
36
|
+
pattern.lastIndex = 0;
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
return (code) => code.includes(pattern);
|
|
40
|
+
}
|
|
41
|
+
function createFilter(exclude, include) {
|
|
42
|
+
if (!exclude && !include) return;
|
|
43
|
+
return (input) => {
|
|
44
|
+
if (exclude?.some((filter) => filter(input))) return false;
|
|
45
|
+
if (include?.some((filter) => filter(input))) return true;
|
|
46
|
+
return !(include && include.length > 0);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function normalizeSingleFilter(filter) {
|
|
50
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(filter)) return require_plugin_utils_virtual.removeVirtualPrefix(filter);
|
|
51
|
+
return filter;
|
|
52
|
+
}
|
|
53
|
+
function normalizeFilter(filter) {
|
|
54
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(filter) || (0, _stryke_type_checks_is_regexp.isRegExp)(filter)) return { include: [normalizeSingleFilter(filter)] };
|
|
55
|
+
if (Array.isArray(filter)) return { include: filter.map(normalizeSingleFilter) };
|
|
56
|
+
return {
|
|
57
|
+
exclude: filter.exclude ? (0, _stryke_convert_to_array.toArray)(filter.exclude).map(normalizeSingleFilter) : void 0,
|
|
58
|
+
include: filter.include ? (0, _stryke_convert_to_array.toArray)(filter.include).map(normalizeSingleFilter) : void 0
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createIdFilter(filter) {
|
|
62
|
+
if (!filter) return;
|
|
63
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
64
|
+
const excludeFilter = exclude?.map(patternToIdFilter);
|
|
65
|
+
const includeFilter = include?.map(patternToIdFilter);
|
|
66
|
+
return createFilter(excludeFilter, includeFilter);
|
|
67
|
+
}
|
|
68
|
+
function createCodeFilter(filter) {
|
|
69
|
+
if (!filter) return;
|
|
70
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
71
|
+
const excludeFilter = exclude?.map(patternToCodeFilter);
|
|
72
|
+
const includeFilter = include?.map(patternToCodeFilter);
|
|
73
|
+
return createFilter(excludeFilter, includeFilter);
|
|
74
|
+
}
|
|
75
|
+
function createFilterForId(filter) {
|
|
76
|
+
const filterFunction = createIdFilter(filter);
|
|
77
|
+
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
78
|
+
}
|
|
79
|
+
function createFilterForTransform(idFilter, codeFilter) {
|
|
80
|
+
if (!idFilter && !codeFilter) return;
|
|
81
|
+
const idFilterFunction = createIdFilter(idFilter);
|
|
82
|
+
const codeFilterFunction = createCodeFilter(codeFilter);
|
|
83
|
+
return (id, code) => {
|
|
84
|
+
let fallback = true;
|
|
85
|
+
if (idFilterFunction) fallback &&= idFilterFunction(id);
|
|
86
|
+
if (!fallback) return false;
|
|
87
|
+
if (codeFilterFunction) fallback &&= codeFilterFunction(code);
|
|
88
|
+
return fallback;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
exports.createCodeFilter = createCodeFilter;
|
|
94
|
+
exports.createFilter = createFilter;
|
|
95
|
+
exports.createFilterForId = createFilterForId;
|
|
96
|
+
exports.createFilterForTransform = createFilterForTransform;
|
|
97
|
+
exports.createIdFilter = createIdFilter;
|
|
98
|
+
exports.normalizeFilter = normalizeFilter;
|
|
99
|
+
exports.normalizeSingleFilter = normalizeSingleFilter;
|
|
100
|
+
exports.patternToCodeFilter = patternToCodeFilter;
|
|
101
|
+
exports.patternToIdFilter = patternToIdFilter;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NormalizedStringFilter, PluginFilter, TransformHookFilter } from "../types/hooks.cjs";
|
|
2
|
+
import { StringFilter, StringOrRegExp } from "unplugin";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/filter.d.ts
|
|
5
|
+
declare function patternToIdFilter(pattern: StringOrRegExp): PluginFilter;
|
|
6
|
+
declare function patternToCodeFilter(pattern: StringOrRegExp): PluginFilter;
|
|
7
|
+
declare function createFilter(exclude: PluginFilter[] | undefined, include: PluginFilter[] | undefined): PluginFilter | undefined;
|
|
8
|
+
declare function normalizeSingleFilter(filter: string | RegExp): string | RegExp;
|
|
9
|
+
declare function normalizeFilter(filter: StringFilter): NormalizedStringFilter;
|
|
10
|
+
declare function createIdFilter(filter: StringFilter | undefined): PluginFilter | undefined;
|
|
11
|
+
declare function createCodeFilter(filter: StringFilter | undefined): PluginFilter | undefined;
|
|
12
|
+
declare function createFilterForId(filter: StringFilter | undefined): PluginFilter | undefined;
|
|
13
|
+
declare function createFilterForTransform(idFilter: StringFilter | undefined, codeFilter: StringFilter | undefined): TransformHookFilter | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter };
|
|
16
|
+
//# sourceMappingURL=filter.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.cts","names":[],"sources":["../../src/plugin-utils/filter.ts"],"mappings":";;;;iBA+CgB,iBAAA,CAAkB,OAAA,EAAS,cAAA,GAAiB,YAAA;AAAA,iBAoB5C,mBAAA,CAAoB,OAAA,EAAS,cAAA,GAAiB,YAAA;AAAA,iBAW9C,YAAA,CACd,OAAA,EAAS,YAAA,gBACT,OAAA,EAAS,YAAA,iBACR,YAAA;AAAA,iBAgBa,qBAAA,CACd,MAAA,WAAiB,MAAA,YACP,MAAA;AAAA,iBAQI,eAAA,CAAgB,MAAA,EAAQ,YAAA,GAAe,sBAAA;AAAA,iBAuBvC,cAAA,CACd,MAAA,EAAQ,YAAA,eACP,YAAA;AAAA,iBASa,gBAAA,CACd,MAAA,EAAQ,YAAA,eACP,YAAA;AAAA,iBASa,iBAAA,CACd,MAAA,EAAQ,YAAA,eACP,YAAA;AAAA,iBAMa,wBAAA,CACd,QAAA,EAAU,YAAA,cACV,UAAA,EAAY,YAAA,eACX,mBAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NormalizedStringFilter, PluginFilter, TransformHookFilter } from "../types/hooks.mjs";
|
|
2
|
+
import { StringFilter, StringOrRegExp } from "unplugin";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin-utils/filter.d.ts
|
|
5
|
+
declare function patternToIdFilter(pattern: StringOrRegExp): PluginFilter;
|
|
6
|
+
declare function patternToCodeFilter(pattern: StringOrRegExp): PluginFilter;
|
|
7
|
+
declare function createFilter(exclude: PluginFilter[] | undefined, include: PluginFilter[] | undefined): PluginFilter | undefined;
|
|
8
|
+
declare function normalizeSingleFilter(filter: string | RegExp): string | RegExp;
|
|
9
|
+
declare function normalizeFilter(filter: StringFilter): NormalizedStringFilter;
|
|
10
|
+
declare function createIdFilter(filter: StringFilter | undefined): PluginFilter | undefined;
|
|
11
|
+
declare function createCodeFilter(filter: StringFilter | undefined): PluginFilter | undefined;
|
|
12
|
+
declare function createFilterForId(filter: StringFilter | undefined): PluginFilter | undefined;
|
|
13
|
+
declare function createFilterForTransform(idFilter: StringFilter | undefined, codeFilter: StringFilter | undefined): TransformHookFilter | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter };
|
|
16
|
+
//# sourceMappingURL=filter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.mts","names":[],"sources":["../../src/plugin-utils/filter.ts"],"mappings":";;;;iBA+CgB,iBAAA,CAAkB,OAAA,EAAS,cAAA,GAAiB,YAAA;AAAA,iBAoB5C,mBAAA,CAAoB,OAAA,EAAS,cAAA,GAAiB,YAAA;AAAA,iBAW9C,YAAA,CACd,OAAA,EAAS,YAAA,gBACT,OAAA,EAAS,YAAA,iBACR,YAAA;AAAA,iBAgBa,qBAAA,CACd,MAAA,WAAiB,MAAA,YACP,MAAA;AAAA,iBAQI,eAAA,CAAgB,MAAA,EAAQ,YAAA,GAAe,sBAAA;AAAA,iBAuBvC,cAAA,CACd,MAAA,EAAQ,YAAA,eACP,YAAA;AAAA,iBASa,gBAAA,CACd,MAAA,EAAQ,YAAA,eACP,YAAA;AAAA,iBASa,iBAAA,CACd,MAAA,EAAQ,YAAA,eACP,YAAA;AAAA,iBAMa,wBAAA,CACd,QAAA,EAAU,YAAA,cACV,UAAA,EAAY,YAAA,eACX,mBAAA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { removeVirtualPrefix } from "./virtual.mjs";
|
|
2
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
3
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
4
|
+
import { isRegExp } from "@stryke/type-checks/is-regexp";
|
|
5
|
+
import { isAbsolutePath } from "@stryke/path/is-type";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
import picomatch from "picomatch";
|
|
8
|
+
|
|
9
|
+
//#region src/plugin-utils/filter.ts
|
|
10
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
11
|
+
function normalize(path) {
|
|
12
|
+
return removeVirtualPrefix(path).replace(BACKSLASH_REGEX, "/");
|
|
13
|
+
}
|
|
14
|
+
function getMatcherString(glob, cwd) {
|
|
15
|
+
if (glob.startsWith("**") || isAbsolutePath(glob)) return normalize(glob);
|
|
16
|
+
return normalize(resolve(cwd, glob));
|
|
17
|
+
}
|
|
18
|
+
function patternToIdFilter(pattern) {
|
|
19
|
+
if (pattern instanceof RegExp) return (id) => {
|
|
20
|
+
const normalizedId = normalize(id);
|
|
21
|
+
const result = pattern.test(normalizedId);
|
|
22
|
+
pattern.lastIndex = 0;
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
const matcher = picomatch(getMatcherString(pattern, process.cwd()), { dot: true });
|
|
26
|
+
return (id) => {
|
|
27
|
+
return matcher(normalize(id));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function patternToCodeFilter(pattern) {
|
|
31
|
+
if (pattern instanceof RegExp) return (code) => {
|
|
32
|
+
const result = pattern.test(code);
|
|
33
|
+
pattern.lastIndex = 0;
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
return (code) => code.includes(pattern);
|
|
37
|
+
}
|
|
38
|
+
function createFilter(exclude, include) {
|
|
39
|
+
if (!exclude && !include) return;
|
|
40
|
+
return (input) => {
|
|
41
|
+
if (exclude?.some((filter) => filter(input))) return false;
|
|
42
|
+
if (include?.some((filter) => filter(input))) return true;
|
|
43
|
+
return !(include && include.length > 0);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function normalizeSingleFilter(filter) {
|
|
47
|
+
if (isSetString(filter)) return removeVirtualPrefix(filter);
|
|
48
|
+
return filter;
|
|
49
|
+
}
|
|
50
|
+
function normalizeFilter(filter) {
|
|
51
|
+
if (isSetString(filter) || isRegExp(filter)) return { include: [normalizeSingleFilter(filter)] };
|
|
52
|
+
if (Array.isArray(filter)) return { include: filter.map(normalizeSingleFilter) };
|
|
53
|
+
return {
|
|
54
|
+
exclude: filter.exclude ? toArray(filter.exclude).map(normalizeSingleFilter) : void 0,
|
|
55
|
+
include: filter.include ? toArray(filter.include).map(normalizeSingleFilter) : void 0
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function createIdFilter(filter) {
|
|
59
|
+
if (!filter) return;
|
|
60
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
61
|
+
const excludeFilter = exclude?.map(patternToIdFilter);
|
|
62
|
+
const includeFilter = include?.map(patternToIdFilter);
|
|
63
|
+
return createFilter(excludeFilter, includeFilter);
|
|
64
|
+
}
|
|
65
|
+
function createCodeFilter(filter) {
|
|
66
|
+
if (!filter) return;
|
|
67
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
68
|
+
const excludeFilter = exclude?.map(patternToCodeFilter);
|
|
69
|
+
const includeFilter = include?.map(patternToCodeFilter);
|
|
70
|
+
return createFilter(excludeFilter, includeFilter);
|
|
71
|
+
}
|
|
72
|
+
function createFilterForId(filter) {
|
|
73
|
+
const filterFunction = createIdFilter(filter);
|
|
74
|
+
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
75
|
+
}
|
|
76
|
+
function createFilterForTransform(idFilter, codeFilter) {
|
|
77
|
+
if (!idFilter && !codeFilter) return;
|
|
78
|
+
const idFilterFunction = createIdFilter(idFilter);
|
|
79
|
+
const codeFilterFunction = createCodeFilter(codeFilter);
|
|
80
|
+
return (id, code) => {
|
|
81
|
+
let fallback = true;
|
|
82
|
+
if (idFilterFunction) fallback &&= idFilterFunction(id);
|
|
83
|
+
if (!fallback) return false;
|
|
84
|
+
if (codeFilterFunction) fallback &&= codeFilterFunction(code);
|
|
85
|
+
return fallback;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
export { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter };
|
|
91
|
+
//# sourceMappingURL=filter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.mjs","names":[],"sources":["../../src/plugin-utils/filter.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 { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { resolve } from \"node:path\";\nimport picomatch from \"picomatch\";\nimport type { StringFilter, StringOrRegExp } from \"unplugin\";\nimport {\n NormalizedStringFilter,\n PluginFilter,\n TransformHookFilter\n} from \"../types/hooks\";\nimport { removeVirtualPrefix } from \"./virtual\";\n\nconst BACKSLASH_REGEX = /\\\\/g;\nfunction normalize(path: string): string {\n return removeVirtualPrefix(path).replace(BACKSLASH_REGEX, \"/\");\n}\n\nfunction getMatcherString(glob: string, cwd: string) {\n if (glob.startsWith(\"**\") || isAbsolutePath(glob)) {\n return normalize(glob);\n }\n\n const resolved = resolve(cwd, glob);\n\n return normalize(resolved);\n}\n\nexport function patternToIdFilter(pattern: StringOrRegExp): PluginFilter {\n if (pattern instanceof RegExp) {\n return (id: string) => {\n const normalizedId = normalize(id);\n const result = pattern.test(normalizedId);\n pattern.lastIndex = 0;\n return result;\n };\n }\n const cwd = process.cwd();\n const glob = getMatcherString(pattern, cwd);\n const matcher = picomatch(glob, { dot: true });\n\n return (id: string) => {\n const normalizedId = normalize(id);\n\n return matcher(normalizedId);\n };\n}\n\nexport function patternToCodeFilter(pattern: StringOrRegExp): PluginFilter {\n if (pattern instanceof RegExp) {\n return (code: string) => {\n const result = pattern.test(code);\n pattern.lastIndex = 0;\n return result;\n };\n }\n return (code: string) => code.includes(pattern);\n}\n\nexport function createFilter(\n exclude: PluginFilter[] | undefined,\n include: PluginFilter[] | undefined\n): PluginFilter | undefined {\n if (!exclude && !include) {\n return;\n }\n\n return input => {\n if (exclude?.some(filter => filter(input))) {\n return false;\n }\n if (include?.some(filter => filter(input))) {\n return true;\n }\n return !(include && include.length > 0);\n };\n}\n\nexport function normalizeSingleFilter(\n filter: string | RegExp\n): string | RegExp {\n if (isSetString(filter)) {\n return removeVirtualPrefix(filter);\n }\n\n return filter;\n}\n\nexport function normalizeFilter(filter: StringFilter): NormalizedStringFilter {\n if (isSetString(filter) || isRegExp(filter)) {\n return {\n include: [normalizeSingleFilter(filter)]\n };\n }\n\n if (Array.isArray(filter)) {\n return {\n include: filter.map(normalizeSingleFilter)\n };\n }\n\n return {\n exclude: filter.exclude\n ? toArray(filter.exclude).map(normalizeSingleFilter)\n : undefined,\n include: filter.include\n ? toArray(filter.include).map(normalizeSingleFilter)\n : undefined\n };\n}\n\nexport function createIdFilter(\n filter: StringFilter | undefined\n): PluginFilter | undefined {\n if (!filter) return;\n const { exclude, include } = normalizeFilter(filter);\n const excludeFilter = exclude?.map(patternToIdFilter);\n const includeFilter = include?.map(patternToIdFilter);\n\n return createFilter(excludeFilter, includeFilter);\n}\n\nexport function createCodeFilter(\n filter: StringFilter | undefined\n): PluginFilter | undefined {\n if (!filter) return;\n const { exclude, include } = normalizeFilter(filter);\n const excludeFilter = exclude?.map(patternToCodeFilter);\n const includeFilter = include?.map(patternToCodeFilter);\n\n return createFilter(excludeFilter, includeFilter);\n}\n\nexport function createFilterForId(\n filter: StringFilter | undefined\n): PluginFilter | undefined {\n const filterFunction = createIdFilter(filter);\n\n return filterFunction ? id => !!filterFunction(id) : undefined;\n}\n\nexport function createFilterForTransform(\n idFilter: StringFilter | undefined,\n codeFilter: StringFilter | undefined\n): TransformHookFilter | undefined {\n if (!idFilter && !codeFilter) return;\n const idFilterFunction = createIdFilter(idFilter);\n const codeFilterFunction = createCodeFilter(codeFilter);\n\n return (id, code) => {\n let fallback = true;\n if (idFilterFunction) {\n fallback &&= idFilterFunction(id);\n }\n if (!fallback) {\n return false;\n }\n\n if (codeFilterFunction) {\n fallback &&= codeFilterFunction(code);\n }\n return fallback;\n };\n}\n"],"mappings":";;;;;;;;;AAgCA,MAAM,kBAAkB;AACxB,SAAS,UAAU,MAAsB;AACvC,QAAO,oBAAoB,KAAK,CAAC,QAAQ,iBAAiB,IAAI;;AAGhE,SAAS,iBAAiB,MAAc,KAAa;AACnD,KAAI,KAAK,WAAW,KAAK,IAAI,eAAe,KAAK,CAC/C,QAAO,UAAU,KAAK;AAKxB,QAAO,UAFU,QAAQ,KAAK,KAEL,CAAC;;AAG5B,SAAgB,kBAAkB,SAAuC;AACvE,KAAI,mBAAmB,OACrB,SAAQ,OAAe;EACrB,MAAM,eAAe,UAAU,GAAG;EAClC,MAAM,SAAS,QAAQ,KAAK,aAAa;AACzC,UAAQ,YAAY;AACpB,SAAO;;CAKX,MAAM,UAAU,UADH,iBAAiB,SADlB,QAAQ,KACsB,CACZ,EAAE,EAAE,KAAK,MAAM,CAAC;AAE9C,SAAQ,OAAe;AAGrB,SAAO,QAFc,UAAU,GAEJ,CAAC;;;AAIhC,SAAgB,oBAAoB,SAAuC;AACzE,KAAI,mBAAmB,OACrB,SAAQ,SAAiB;EACvB,MAAM,SAAS,QAAQ,KAAK,KAAK;AACjC,UAAQ,YAAY;AACpB,SAAO;;AAGX,SAAQ,SAAiB,KAAK,SAAS,QAAQ;;AAGjD,SAAgB,aACd,SACA,SAC0B;AAC1B,KAAI,CAAC,WAAW,CAAC,QACf;AAGF,SAAO,UAAS;AACd,MAAI,SAAS,MAAK,WAAU,OAAO,MAAM,CAAC,CACxC,QAAO;AAET,MAAI,SAAS,MAAK,WAAU,OAAO,MAAM,CAAC,CACxC,QAAO;AAET,SAAO,EAAE,WAAW,QAAQ,SAAS;;;AAIzC,SAAgB,sBACd,QACiB;AACjB,KAAI,YAAY,OAAO,CACrB,QAAO,oBAAoB,OAAO;AAGpC,QAAO;;AAGT,SAAgB,gBAAgB,QAA8C;AAC5E,KAAI,YAAY,OAAO,IAAI,SAAS,OAAO,CACzC,QAAO,EACL,SAAS,CAAC,sBAAsB,OAAO,CAAC,EACzC;AAGH,KAAI,MAAM,QAAQ,OAAO,CACvB,QAAO,EACL,SAAS,OAAO,IAAI,sBAAsB,EAC3C;AAGH,QAAO;EACL,SAAS,OAAO,UACZ,QAAQ,OAAO,QAAQ,CAAC,IAAI,sBAAsB,GAClD;EACJ,SAAS,OAAO,UACZ,QAAQ,OAAO,QAAQ,CAAC,IAAI,sBAAsB,GAClD;EACL;;AAGH,SAAgB,eACd,QAC0B;AAC1B,KAAI,CAAC,OAAQ;CACb,MAAM,EAAE,SAAS,YAAY,gBAAgB,OAAO;CACpD,MAAM,gBAAgB,SAAS,IAAI,kBAAkB;CACrD,MAAM,gBAAgB,SAAS,IAAI,kBAAkB;AAErD,QAAO,aAAa,eAAe,cAAc;;AAGnD,SAAgB,iBACd,QAC0B;AAC1B,KAAI,CAAC,OAAQ;CACb,MAAM,EAAE,SAAS,YAAY,gBAAgB,OAAO;CACpD,MAAM,gBAAgB,SAAS,IAAI,oBAAoB;CACvD,MAAM,gBAAgB,SAAS,IAAI,oBAAoB;AAEvD,QAAO,aAAa,eAAe,cAAc;;AAGnD,SAAgB,kBACd,QAC0B;CAC1B,MAAM,iBAAiB,eAAe,OAAO;AAE7C,QAAO,kBAAiB,OAAM,CAAC,CAAC,eAAe,GAAG,GAAG;;AAGvD,SAAgB,yBACd,UACA,YACiC;AACjC,KAAI,CAAC,YAAY,CAAC,WAAY;CAC9B,MAAM,mBAAmB,eAAe,SAAS;CACjD,MAAM,qBAAqB,iBAAiB,WAAW;AAEvD,SAAQ,IAAI,SAAS;EACnB,IAAI,WAAW;AACf,MAAI,iBACF,cAAa,iBAAiB,GAAG;AAEnC,MAAI,CAAC,SACH,QAAO;AAGT,MAAI,mBACF,cAAa,mBAAmB,KAAK;AAEvC,SAAO"}
|
|
@@ -11,7 +11,7 @@ let _stryke_path_join = require("@stryke/path/join");
|
|
|
11
11
|
* @param context - The powerlines context.
|
|
12
12
|
*/
|
|
13
13
|
async function formatPackageJson(context) {
|
|
14
|
-
const packageJsonPath = (0, _stryke_path_join.joinPaths)(context.
|
|
14
|
+
const packageJsonPath = (0, _stryke_path_join.joinPaths)(context.config.cwd, context.config.root, "package.json");
|
|
15
15
|
const packageJsonFile = await context.fs.read(packageJsonPath);
|
|
16
16
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(packageJsonFile)) await context.fs.write(packageJsonPath, await require_lib_utilities_format.format(context, packageJsonPath, packageJsonFile));
|
|
17
17
|
}
|
|
@@ -9,7 +9,7 @@ import { joinPaths } from "@stryke/path/join";
|
|
|
9
9
|
* @param context - The powerlines context.
|
|
10
10
|
*/
|
|
11
11
|
async function formatPackageJson(context) {
|
|
12
|
-
const packageJsonPath = joinPaths(context.
|
|
12
|
+
const packageJsonPath = joinPaths(context.config.cwd, context.config.root, "package.json");
|
|
13
13
|
const packageJsonFile = await context.fs.read(packageJsonPath);
|
|
14
14
|
if (isSetString(packageJsonFile)) await context.fs.write(packageJsonPath, await format(context, packageJsonPath, packageJsonFile));
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-package-json.mjs","names":[],"sources":["../../src/plugin-utils/format-package-json.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { format } from \"../lib/utilities/format\";\nimport { Context } from \"../types/context\";\n\n/**\n * Formats the `package.json` file in the project root.\n *\n * @param context - The powerlines context.\n */\nexport async function formatPackageJson(context: Context) {\n const packageJsonPath = joinPaths(\n context.
|
|
1
|
+
{"version":3,"file":"format-package-json.mjs","names":[],"sources":["../../src/plugin-utils/format-package-json.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { format } from \"../lib/utilities/format\";\nimport { Context } from \"../types/context\";\n\n/**\n * Formats the `package.json` file in the project root.\n *\n * @param context - The powerlines context.\n */\nexport async function formatPackageJson(context: Context) {\n const packageJsonPath = joinPaths(\n context.config.cwd,\n context.config.root,\n \"package.json\"\n );\n\n const packageJsonFile = await context.fs.read(packageJsonPath);\n if (isSetString(packageJsonFile)) {\n await context.fs.write(\n packageJsonPath,\n await format(context, packageJsonPath, packageJsonFile)\n );\n }\n}\n"],"mappings":";;;;;;;;;;AA4BA,eAAsB,kBAAkB,SAAkB;CACxD,MAAM,kBAAkB,UACtB,QAAQ,OAAO,KACf,QAAQ,OAAO,MACf,eACD;CAED,MAAM,kBAAkB,MAAM,QAAQ,GAAG,KAAK,gBAAgB;AAC9D,KAAI,YAAY,gBAAgB,CAC9B,OAAM,QAAQ,GAAG,MACf,iBACA,MAAM,OAAO,SAAS,iBAAiB,gBAAgB,CACxD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
4
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
6
|
+
let _stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
|
|
7
|
+
let _stryke_type_checks_is_set_array = require("@stryke/type-checks/is-set-array");
|
|
8
|
+
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
9
|
+
|
|
10
|
+
//#region src/plugin-utils/format.ts
|
|
11
|
+
/**
|
|
12
|
+
* Formats a configuration object into a human-readable string, omitting certain properties and simplifying others for better readability.
|
|
13
|
+
*
|
|
14
|
+
* @param config - The configuration object to format.
|
|
15
|
+
* @returns A formatted string representation of the configuration.
|
|
16
|
+
*/
|
|
17
|
+
function formatConfig(config) {
|
|
18
|
+
return JSON.stringify(Object.fromEntries(Object.entries({
|
|
19
|
+
...(0, _stryke_helpers_omit.omit)(config, [
|
|
20
|
+
"deps",
|
|
21
|
+
"resolve",
|
|
22
|
+
"plugins",
|
|
23
|
+
"initialConfig",
|
|
24
|
+
"userConfig",
|
|
25
|
+
"inlineConfig",
|
|
26
|
+
"pluginConfig",
|
|
27
|
+
"environmentConfig"
|
|
28
|
+
]),
|
|
29
|
+
deps: (0, _stryke_type_checks_is_set_object.isSetObject)(config.deps) ? {
|
|
30
|
+
alwaysBundle: (0, _stryke_type_checks_is_set_array.isSetArray)(config.deps?.alwaysBundle) ? (config.deps?.alwaysBundle ?? []).filter(Boolean).map((alwaysBundle) => (0, _stryke_type_checks_is_set_string.isSetString)(alwaysBundle) ? alwaysBundle : (0, _stryke_type_checks_is_regexp.isRegExp)(alwaysBundle) ? alwaysBundle.source : "<unknown-bundle>") : void 0,
|
|
31
|
+
onlyBundle: (0, _stryke_type_checks_is_set_array.isSetArray)(config.deps?.onlyBundle) ? (config.deps?.onlyBundle ?? []).filter(Boolean).map((onlyBundle) => (0, _stryke_type_checks_is_set_string.isSetString)(onlyBundle) ? onlyBundle : (0, _stryke_type_checks_is_regexp.isRegExp)(onlyBundle) ? onlyBundle.source : "<unknown-bundle>") : void 0,
|
|
32
|
+
neverBundle: (0, _stryke_type_checks_is_set_array.isSetArray)(config.deps?.neverBundle) ? (config.deps?.neverBundle ?? []).filter(Boolean).map((neverBundle) => (0, _stryke_type_checks_is_set_string.isSetString)(neverBundle) ? neverBundle : (0, _stryke_type_checks_is_regexp.isRegExp)(neverBundle) ? neverBundle.source : "<unknown-bundle>") : void 0
|
|
33
|
+
} : void 0,
|
|
34
|
+
resolve: (0, _stryke_type_checks_is_set_object.isSetObject)(config.resolve) ? {
|
|
35
|
+
...config.resolve,
|
|
36
|
+
external: (0, _stryke_type_checks_is_set_array.isSetArray)(config.resolve?.external) ? (config.resolve?.external ?? []).filter(Boolean).map((external) => (0, _stryke_type_checks_is_set_string.isSetString)(external) ? external : (0, _stryke_type_checks_is_regexp.isRegExp)(external) ? external.source : "<unknown-bundle>") : void 0,
|
|
37
|
+
noExternal: (0, _stryke_type_checks_is_set_array.isSetArray)(config.resolve?.noExternal) ? (config.resolve?.noExternal ?? []).filter(Boolean).map((noExternal) => (0, _stryke_type_checks_is_set_string.isSetString)(noExternal) ? noExternal : (0, _stryke_type_checks_is_regexp.isRegExp)(noExternal) ? noExternal.source : "<unknown-bundle>") : void 0
|
|
38
|
+
} : void 0,
|
|
39
|
+
plugins: (0, _stryke_type_checks_is_set_array.isSetArray)(config.plugins) ? (0, _stryke_convert_to_array.toArray)(config.plugins)?.flatMap((plugin) => (0, _stryke_convert_to_array.toArray)(plugin))?.map((plugin) => String((0, _stryke_type_checks_is_set_string.isSetString)(plugin) ? plugin : (0, _stryke_type_checks_is_set_object.isSetObject)(plugin) && (0, _stryke_type_checks_is_set_string.isSetString)(plugin.name) ? plugin.name : Array.isArray(plugin) && (0, _stryke_type_checks_is_set_string.isSetString)(plugin[0]) ? plugin[0] : "<function-plugin>")) : void 0
|
|
40
|
+
}).sort(([key1], [key2]) => key1.localeCompare(key2))), null, 4).replace(/"([^"]+)":/g, "$1:").replace(/,\s*$/g, "");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.formatConfig = formatConfig;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/plugin-utils/format.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Formats a configuration object into a human-readable string, omitting certain properties and simplifying others for better readability.
|
|
4
|
+
*
|
|
5
|
+
* @param config - The configuration object to format.
|
|
6
|
+
* @returns A formatted string representation of the configuration.
|
|
7
|
+
*/
|
|
8
|
+
declare function formatConfig(config: Record<string, any>): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { formatConfig };
|
|
11
|
+
//# sourceMappingURL=format.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.cts","names":[],"sources":["../../src/plugin-utils/format.ts"],"mappings":";;AAgCA;;;;;iBAAgB,YAAA,CAAa,MAAA,EAAQ,MAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/plugin-utils/format.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Formats a configuration object into a human-readable string, omitting certain properties and simplifying others for better readability.
|
|
4
|
+
*
|
|
5
|
+
* @param config - The configuration object to format.
|
|
6
|
+
* @returns A formatted string representation of the configuration.
|
|
7
|
+
*/
|
|
8
|
+
declare function formatConfig(config: Record<string, any>): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { formatConfig };
|
|
11
|
+
//# sourceMappingURL=format.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.mts","names":[],"sources":["../../src/plugin-utils/format.ts"],"mappings":";;AAgCA;;;;;iBAAgB,YAAA,CAAa,MAAA,EAAQ,MAAA"}
|