@powerlines/core 0.15.0 → 0.15.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 +6 -5
- package/dist/constants/api.d.cts +3 -3
- package/dist/constants/api.d.cts.map +1 -1
- package/dist/constants/api.d.mts +3 -3
- package/dist/constants/api.d.mts.map +1 -1
- package/dist/constants/api.mjs +4 -4
- package/dist/constants/api.mjs.map +1 -1
- package/dist/constants/commands.cjs +3 -2
- package/dist/constants/commands.d.cts +1 -1
- package/dist/constants/commands.d.mts +1 -1
- package/dist/constants/commands.mjs +2 -2
- 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 -30
- package/dist/constants/index.d.cts +5 -3
- package/dist/constants/index.d.mts +5 -3
- package/dist/constants/index.mjs +5 -3
- 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 -9
- package/dist/index.d.cts +20 -9
- package/dist/index.d.mts +20 -9
- package/dist/index.mjs +17 -5
- package/dist/lib/config.cjs +160 -15
- package/dist/lib/config.d.cts +92 -6
- package/dist/lib/config.d.cts.map +1 -1
- package/dist/lib/config.d.mts +92 -6
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs +154 -16
- 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 +5 -5
- 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 +5 -5
- 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 -9
- 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 +18 -18
- 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 -18
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +55 -62
- package/dist/lib/unplugin/plugin.d.cts +11 -12
- package/dist/lib/unplugin/plugin.d.cts.map +1 -1
- package/dist/lib/unplugin/plugin.d.mts +11 -12
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs +55 -62
- 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 +1 -1
- package/dist/lib/utilities/format.mjs +1 -1
- package/dist/lib/utilities/index.cjs +2 -2
- package/dist/lib/utilities/index.mjs +2 -2
- 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 +1 -1
- package/dist/plugin-base.mjs +1 -1
- 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/context-helpers.cjs +22 -12
- package/dist/plugin-utils/context-helpers.d.cts +9 -1
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +9 -1
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +22 -13
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/filter.cjs +13 -5
- package/dist/plugin-utils/filter.d.cts +2 -1
- package/dist/plugin-utils/filter.d.cts.map +1 -1
- package/dist/plugin-utils/filter.d.mts +2 -1
- package/dist/plugin-utils/filter.d.mts.map +1 -1
- package/dist/plugin-utils/filter.mjs +13 -6
- package/dist/plugin-utils/filter.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/helpers.cjs +6 -6
- package/dist/plugin-utils/helpers.d.cts +15 -15
- package/dist/plugin-utils/helpers.d.cts.map +1 -1
- package/dist/plugin-utils/helpers.d.mts +15 -15
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs +1 -1
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +34 -4
- package/dist/plugin-utils/index.d.cts +7 -4
- package/dist/plugin-utils/index.d.mts +7 -4
- package/dist/plugin-utils/index.mjs +9 -6
- 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 +588 -1
- package/dist/plugin-utils/logging.d.cts +93 -1
- package/dist/plugin-utils/logging.d.cts.map +1 -1
- package/dist/plugin-utils/logging.d.mts +93 -1
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +572 -1
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/plugin-utils/merge.cjs +1 -1
- package/dist/plugin-utils/merge.mjs +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 +6 -2
- package/dist/plugin-utils/paths.mjs +6 -2
- 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 -152
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +18 -152
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/config.d.cts +194 -135
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +195 -136
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +140 -130
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +143 -133
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/fs.d.mts +1 -1
- package/dist/types/index.d.cts +5 -6
- package/dist/types/index.d.mts +5 -6
- 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 +6 -9
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +6 -9
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/tsconfig.d.mts +1 -1
- package/dist/types/unplugin.d.cts +6 -27
- package/dist/types/unplugin.d.cts.map +1 -1
- package/dist/types/unplugin.d.mts +6 -27
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +259 -457
- package/schemas/fs.capnp +42 -0
- package/dist/constants/virtual-modules.cjs +0 -8
- package/dist/constants/virtual-modules.d.cts +0 -6
- package/dist/constants/virtual-modules.d.cts.map +0 -1
- package/dist/constants/virtual-modules.d.mts +0 -6
- package/dist/constants/virtual-modules.d.mts.map +0 -1
- package/dist/constants/virtual-modules.mjs +0 -7
- package/dist/constants/virtual-modules.mjs.map +0 -1
- package/dist/lib/logger.cjs +0 -99
- package/dist/lib/logger.d.cts +0 -53
- package/dist/lib/logger.d.cts.map +0 -1
- package/dist/lib/logger.d.mts +0 -53
- package/dist/lib/logger.d.mts.map +0 -1
- package/dist/lib/logger.mjs +0 -93
- 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 -16
- package/dist/types/commands.d.cts.map +0 -1
- package/dist/types/commands.d.mts +0 -16
- package/dist/types/commands.d.mts.map +0 -1
- package/dist/types/utils.d.cts +0 -9
- package/dist/types/utils.d.cts.map +0 -1
- package/dist/types/utils.d.mts +0 -9
- package/dist/types/utils.d.mts.map +0 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { existsSync } from "@stryke/fs/exists";
|
|
2
|
+
import { readJsonFile, readJsonFileSync } from "@stryke/fs/json";
|
|
3
|
+
import { appendPath } from "@stryke/path/append";
|
|
4
|
+
import { findFileName, findFilePath, relativePath } from "@stryke/path/file-path-fns";
|
|
5
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
6
|
+
import defu from "defu";
|
|
7
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
import { isPackageExists } from "@stryke/fs/package-fns";
|
|
10
|
+
import { getObjectDiff } from "@donedeal0/superdiff";
|
|
11
|
+
import { StormJSON } from "@stryke/json/storm-json";
|
|
12
|
+
import ts from "typescript";
|
|
13
|
+
|
|
14
|
+
//#region src/lib/typescript/tsconfig.ts
|
|
15
|
+
function getTsconfigDtsPath(context) {
|
|
16
|
+
return joinPaths(relativePath(joinPaths(context.config.cwd, context.config.root), findFilePath(context.typesPath)), findFileName(context.typesPath));
|
|
17
|
+
}
|
|
18
|
+
async function resolveTsconfigChanges(context) {
|
|
19
|
+
const tsconfig = getParsedTypeScriptConfig(context.config.cwd, context.config.root, context.config.tsconfig, context.config.tsconfigRaw);
|
|
20
|
+
const tsconfigJson = await readJsonFile(getTsconfigFilePath(context.config.cwd, context.config.root, context.config.tsconfig));
|
|
21
|
+
tsconfigJson.compilerOptions ??= {};
|
|
22
|
+
if (context.config.output.dts !== false) {
|
|
23
|
+
const dtsRelativePath = getTsconfigDtsPath(context);
|
|
24
|
+
if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath]))) {
|
|
25
|
+
tsconfigJson.include ??= [];
|
|
26
|
+
tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!tsconfig.options.lib?.some((lib) => [
|
|
30
|
+
"lib.esnext.d.ts",
|
|
31
|
+
"lib.es2021.d.ts",
|
|
32
|
+
"lib.es2022.d.ts",
|
|
33
|
+
"lib.es2023.d.ts"
|
|
34
|
+
].includes(lib.toLowerCase()))) {
|
|
35
|
+
tsconfigJson.compilerOptions.lib ??= [];
|
|
36
|
+
tsconfigJson.compilerOptions.lib.push("esnext");
|
|
37
|
+
}
|
|
38
|
+
if (tsconfig.options.esModuleInterop !== true) tsconfigJson.compilerOptions.esModuleInterop = true;
|
|
39
|
+
if (tsconfig.options.isolatedModules !== true) tsconfigJson.compilerOptions.isolatedModules = true;
|
|
40
|
+
if (context.config.platform === "node") {
|
|
41
|
+
if (!tsconfig.options.types?.some((type) => type.toLowerCase() === "node" || type.toLowerCase() === "@types/node")) {
|
|
42
|
+
tsconfigJson.compilerOptions.types ??= [];
|
|
43
|
+
tsconfigJson.compilerOptions.types.push("node");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return tsconfigJson;
|
|
47
|
+
}
|
|
48
|
+
async function initializeTsconfig(context) {
|
|
49
|
+
context.debug("Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.");
|
|
50
|
+
if (!isPackageExists("typescript")) throw new Error("The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"");
|
|
51
|
+
const tsconfigFilePath = getTsconfigFilePath(context.config.cwd, context.config.root, context.config.tsconfig);
|
|
52
|
+
context.tsconfig.originalTsconfigJson = await readJsonFile(tsconfigFilePath);
|
|
53
|
+
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
54
|
+
context.debug("Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
55
|
+
await context.fs.write(tsconfigFilePath, StormJSON.stringify(context.tsconfig.tsconfigJson));
|
|
56
|
+
context.tsconfig = getParsedTypeScriptConfig(context.config.cwd, context.config.root, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
|
|
57
|
+
}
|
|
58
|
+
async function resolveTsconfig(context) {
|
|
59
|
+
const updateTsconfigJson = await readJsonFile(context.tsconfig.tsconfigFilePath);
|
|
60
|
+
if (updateTsconfigJson?.compilerOptions?.types && Array.isArray(updateTsconfigJson.compilerOptions.types) && !updateTsconfigJson.compilerOptions.types.length) delete updateTsconfigJson.compilerOptions.types;
|
|
61
|
+
const result = getObjectDiff(context.tsconfig.originalTsconfigJson, updateTsconfigJson, {
|
|
62
|
+
ignoreArrayOrder: true,
|
|
63
|
+
showOnly: {
|
|
64
|
+
statuses: [
|
|
65
|
+
"added",
|
|
66
|
+
"deleted",
|
|
67
|
+
"updated"
|
|
68
|
+
],
|
|
69
|
+
granularity: "deep"
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const changes = [];
|
|
73
|
+
const getChanges = (difference, property) => {
|
|
74
|
+
if (difference.status === "added" || difference.status === "deleted" || difference.status === "updated") if (difference.diff) for (const diff of difference.diff) getChanges(diff, property ? `${property}.${difference.property}` : difference.property);
|
|
75
|
+
else changes.push({
|
|
76
|
+
field: property ? `${property}.${difference.property}` : difference.property,
|
|
77
|
+
status: difference.status,
|
|
78
|
+
previous: difference.status === "added" ? "---" : StormJSON.stringify(difference.previousValue),
|
|
79
|
+
current: difference.status === "deleted" ? "---" : StormJSON.stringify(difference.currentValue)
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
for (const diff of result.diff) getChanges(diff);
|
|
83
|
+
if (changes.length > 0) context.warn(`Updating the following configuration values in "${context.tsconfig.tsconfigFilePath}" file:
|
|
84
|
+
|
|
85
|
+
${changes.map((change, i) => `${chalk.bold.whiteBright(`${i + 1}. ${titleCase(change.status)} the ${change.field} field: `)}
|
|
86
|
+
${chalk.red(` - Previous: ${change.previous} `)}
|
|
87
|
+
${chalk.green(` - Updated: ${change.current} `)}
|
|
88
|
+
`).join("\n")}
|
|
89
|
+
`);
|
|
90
|
+
await context.fs.write(context.tsconfig.tsconfigFilePath, StormJSON.stringify(updateTsconfigJson));
|
|
91
|
+
context.tsconfig = getParsedTypeScriptConfig(context.config.cwd, context.config.root, context.config.tsconfig);
|
|
92
|
+
if (!context.tsconfig) throw new Error("Failed to parse the TypeScript configuration file.");
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get the path to the tsconfig.json file.
|
|
96
|
+
*
|
|
97
|
+
* @param cwd - The root directory of the workspace.
|
|
98
|
+
* @param root - The root directory of the project.
|
|
99
|
+
* @param tsconfig - The path to the tsconfig.json file.
|
|
100
|
+
* @returns The absolute path to the tsconfig.json file.
|
|
101
|
+
* @throws If the tsconfig.json file does not exist.
|
|
102
|
+
*/
|
|
103
|
+
function getTsconfigFilePath(cwd, root, tsconfig) {
|
|
104
|
+
let tsconfigFilePath;
|
|
105
|
+
if (tsconfig) tsconfigFilePath = tryTsconfigFilePath(cwd, root, tsconfig);
|
|
106
|
+
else {
|
|
107
|
+
tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.app.json");
|
|
108
|
+
if (!tsconfigFilePath) {
|
|
109
|
+
tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.lib.json");
|
|
110
|
+
if (!tsconfigFilePath) tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.json");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (!tsconfigFilePath) throw new Error(`Cannot find the \`tsconfig.json\` configuration file for the project at ${root}.`);
|
|
114
|
+
return tsconfigFilePath;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get the path to the tsconfig.json file.
|
|
118
|
+
*
|
|
119
|
+
* @param cwd - The root directory of the workspace.
|
|
120
|
+
* @param root - The root directory of the project.
|
|
121
|
+
* @param tsconfig - The path to the tsconfig.json file.
|
|
122
|
+
* @returns The absolute path to the tsconfig.json file.
|
|
123
|
+
* @throws If the tsconfig.json file does not exist.
|
|
124
|
+
*/
|
|
125
|
+
function tryTsconfigFilePath(cwd, root, tsconfig) {
|
|
126
|
+
let tsconfigFilePath = tsconfig;
|
|
127
|
+
if (!existsSync(tsconfigFilePath)) {
|
|
128
|
+
tsconfigFilePath = appendPath(tsconfig, root);
|
|
129
|
+
if (!existsSync(tsconfigFilePath)) {
|
|
130
|
+
tsconfigFilePath = appendPath(tsconfig, appendPath(root, cwd));
|
|
131
|
+
if (!existsSync(tsconfigFilePath)) return;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return tsconfigFilePath;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Check if the TypeScript configuration type matches any of the provided types.
|
|
138
|
+
*
|
|
139
|
+
* @param tsconfigType - The type from the TypeScript configuration.
|
|
140
|
+
* @param types - An array of type names to check against.
|
|
141
|
+
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
142
|
+
*/
|
|
143
|
+
function findMatch(tsconfigType, types, extensions = [
|
|
144
|
+
".ts",
|
|
145
|
+
".tsx",
|
|
146
|
+
".d.ts"
|
|
147
|
+
]) {
|
|
148
|
+
return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Check if the TypeScript configuration type matches any of the provided types.
|
|
152
|
+
*
|
|
153
|
+
* @param tsconfigType - The type from the TypeScript configuration.
|
|
154
|
+
* @param types - An array of type names to check against.
|
|
155
|
+
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
156
|
+
*/
|
|
157
|
+
function findIncludeMatch(tsconfigType, types) {
|
|
158
|
+
return findMatch(tsconfigType, types, [
|
|
159
|
+
".ts",
|
|
160
|
+
".tsx",
|
|
161
|
+
".d.ts",
|
|
162
|
+
".js",
|
|
163
|
+
".jsx",
|
|
164
|
+
".mjs",
|
|
165
|
+
".cjs",
|
|
166
|
+
".mts",
|
|
167
|
+
".cts",
|
|
168
|
+
"/*.ts",
|
|
169
|
+
"/*.tsx",
|
|
170
|
+
"/*.d.ts",
|
|
171
|
+
"/*.js",
|
|
172
|
+
"/*.jsx",
|
|
173
|
+
"/*.mjs",
|
|
174
|
+
"/*.cjs",
|
|
175
|
+
"/*.mts",
|
|
176
|
+
"/*.cts",
|
|
177
|
+
"/**/*.ts",
|
|
178
|
+
"/**/*.tsx",
|
|
179
|
+
"/**/*.d.ts",
|
|
180
|
+
"/**/*.js",
|
|
181
|
+
"/**/*.jsx",
|
|
182
|
+
"/**/*.mjs",
|
|
183
|
+
"/**/*.cjs",
|
|
184
|
+
"/**/*.mts",
|
|
185
|
+
"/**/*.cts"
|
|
186
|
+
]);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Check if the TypeScript configuration type matches any of the provided types.
|
|
190
|
+
*
|
|
191
|
+
* @param tsconfigType - The type from the TypeScript configuration.
|
|
192
|
+
* @param types - An array of type names to check against.
|
|
193
|
+
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
194
|
+
*/
|
|
195
|
+
function isMatchFound(tsconfigType, types) {
|
|
196
|
+
return findMatch(tsconfigType, types) !== void 0;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Check if the TypeScript configuration type matches any of the provided types.
|
|
200
|
+
*
|
|
201
|
+
* @param tsconfigType - The type from the TypeScript configuration.
|
|
202
|
+
* @param types - An array of type names to check against.
|
|
203
|
+
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
204
|
+
*/
|
|
205
|
+
function isIncludeMatchFound(tsconfigType, types) {
|
|
206
|
+
return findIncludeMatch(tsconfigType, types) !== void 0;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Get the parsed TypeScript configuration.
|
|
210
|
+
*
|
|
211
|
+
* @param workspaceRoot - The root directory of the workspace.
|
|
212
|
+
* @param projectRoot - The root directory of the project.
|
|
213
|
+
* @param tsconfig - The path to the tsconfig.json file.
|
|
214
|
+
* @param tsconfigRaw - The raw tsconfig.json content.
|
|
215
|
+
* @param originalTsconfigJson - The original tsconfig.json content.
|
|
216
|
+
* @param host - The TypeScript parse config host.
|
|
217
|
+
* @returns The resolved TypeScript configuration.
|
|
218
|
+
*/
|
|
219
|
+
function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = ts.sys) {
|
|
220
|
+
const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
|
|
221
|
+
const tsconfigJson = readJsonFileSync(tsconfigFilePath);
|
|
222
|
+
if (!tsconfigJson) throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
|
|
223
|
+
const parsedCommandLine = ts.parseJsonConfigFileContent(defu(tsconfigRaw ?? {}, tsconfigJson), host, appendPath(projectRoot, workspaceRoot));
|
|
224
|
+
if (parsedCommandLine.errors.length > 0) {
|
|
225
|
+
const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
|
|
226
|
+
${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
|
|
227
|
+
`;
|
|
228
|
+
throw new Error(errorMessage);
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
...parsedCommandLine,
|
|
232
|
+
originalTsconfigJson: originalTsconfigJson ?? tsconfigJson,
|
|
233
|
+
tsconfigJson,
|
|
234
|
+
tsconfigFilePath
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigDtsPath, getTsconfigFilePath, initializeTsconfig, isIncludeMatchFound, isMatchFound, resolveTsconfig, tryTsconfigFilePath };
|
|
240
|
+
//# sourceMappingURL=tsconfig.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.mjs","names":[],"sources":["../../../src/lib/typescript/tsconfig.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Diff, ObjectData } from \"@donedeal0/superdiff\";\nimport { getObjectDiff } from \"@donedeal0/superdiff\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFile, readJsonFileSync } from \"@stryke/fs/json\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { appendPath } from \"@stryke/path/append\";\nimport {\n findFileName,\n findFilePath,\n relativePath\n} from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { FilterPattern } from \"@stryke/types/file\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport chalk from \"chalk\";\nimport defu from \"defu\";\nimport ts from \"typescript\";\nimport { ResolvedConfig } from \"../../types/config\";\nimport { EnvironmentContext } from \"../../types/context\";\nimport type { ParsedTypeScriptConfig, TSConfig } from \"../../types/tsconfig\";\n\nexport function getTsconfigDtsPath<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>(context: EnvironmentContext<TResolvedConfig, TSystemContext>): string {\n const dtsRelativePath = joinPaths(\n relativePath(\n joinPaths(context.config.cwd, context.config.root),\n findFilePath(context.typesPath)\n ),\n findFileName(context.typesPath)\n );\n\n return dtsRelativePath;\n}\n\nasync function resolveTsconfigChanges<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>(\n context: EnvironmentContext<TResolvedConfig, TSystemContext>\n): Promise<TsConfigJson> {\n const tsconfig = getParsedTypeScriptConfig(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw\n );\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig\n );\n\n const tsconfigJson = await readJsonFile<TsConfigJson>(tsconfigFilePath);\n tsconfigJson.compilerOptions ??= {};\n\n if (context.config.output.dts !== false) {\n const dtsRelativePath = getTsconfigDtsPath(context);\n\n if (\n !tsconfigJson.include?.some(filePattern =>\n isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath])\n )\n ) {\n tsconfigJson.include ??= [];\n tsconfigJson.include.push(\n dtsRelativePath.startsWith(\"./\")\n ? dtsRelativePath.slice(2)\n : dtsRelativePath\n );\n }\n }\n\n if (\n !tsconfig.options.lib?.some(lib =>\n [\n \"lib.esnext.d.ts\",\n \"lib.es2021.d.ts\",\n \"lib.es2022.d.ts\",\n \"lib.es2023.d.ts\"\n ].includes(lib.toLowerCase())\n )\n ) {\n tsconfigJson.compilerOptions.lib ??= [];\n tsconfigJson.compilerOptions.lib.push(\"esnext\");\n }\n\n // if (tsconfig.options.module !== ts.ModuleKind.ESNext) {\n // tsconfigJson.compilerOptions.module = \"ESNext\";\n // }\n\n // if (\n // !tsconfig.options.target ||\n // ![\n // ts.ScriptTarget.ESNext,\n // ts.ScriptTarget.ES2024,\n // ts.ScriptTarget.ES2023,\n // ts.ScriptTarget.ES2022,\n // ts.ScriptTarget.ES2021\n // ].includes(tsconfig.options.target)\n // ) {\n // tsconfigJson.compilerOptions.target = \"ESNext\";\n // }\n\n // if (tsconfig.options.moduleResolution !== ts.ModuleResolutionKind.Bundler) {\n // tsconfigJson.compilerOptions.moduleResolution = \"Bundler\";\n // }\n\n // if (tsconfig.options.moduleDetection !== ts.ModuleDetectionKind.Force) {\n // tsconfigJson.compilerOptions.moduleDetection = \"force\";\n // }\n\n // if (tsconfig.options.allowSyntheticDefaultImports !== true) {\n // tsconfigJson.compilerOptions.allowSyntheticDefaultImports = true;\n // }\n\n // if (tsconfig.options.noImplicitOverride !== true) {\n // tsconfigJson.compilerOptions.noImplicitOverride = true;\n // }\n\n // if (tsconfig.options.noUncheckedIndexedAccess !== true) {\n // tsconfigJson.compilerOptions.noUncheckedIndexedAccess = true;\n // }\n\n // if (tsconfig.options.skipLibCheck !== true) {\n // tsconfigJson.compilerOptions.skipLibCheck = true;\n // }\n\n // if (tsconfig.options.resolveJsonModule !== true) {\n // tsconfigJson.compilerOptions.resolveJsonModule = true;\n // }\n\n // if (tsconfig.options.verbatimModuleSyntax !== false) {\n // tsconfigJson.compilerOptions.verbatimModuleSyntax = false;\n // }\n\n // if (tsconfig.options.allowJs !== true) {\n // tsconfigJson.compilerOptions.allowJs = true;\n // }\n\n // if (tsconfig.options.declaration !== true) {\n // tsconfigJson.compilerOptions.declaration = true;\n // }\n\n if (tsconfig.options.esModuleInterop !== true) {\n tsconfigJson.compilerOptions.esModuleInterop = true;\n }\n\n if (tsconfig.options.isolatedModules !== true) {\n tsconfigJson.compilerOptions.isolatedModules = true;\n }\n\n if (context.config.platform === \"node\") {\n if (\n !tsconfig.options.types?.some(\n type =>\n type.toLowerCase() === \"node\" || type.toLowerCase() === \"@types/node\"\n )\n ) {\n tsconfigJson.compilerOptions.types ??= [];\n tsconfigJson.compilerOptions.types.push(\"node\");\n }\n }\n\n return tsconfigJson;\n}\n\nexport async function initializeTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown,\n TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> =\n EnvironmentContext<TResolvedConfig, TSystemContext>\n>(context: TContext): Promise<void> {\n context.debug(\n \"Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.\"\n );\n\n if (!isPackageExists(\"typescript\")) {\n throw new Error(\n 'The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"'\n );\n }\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig\n );\n\n context.tsconfig.originalTsconfigJson =\n await readJsonFile<TsConfigJson>(tsconfigFilePath);\n\n context.tsconfig.tsconfigJson = await resolveTsconfigChanges<\n TResolvedConfig,\n TSystemContext\n >(context);\n\n context.debug(\n \"Writing updated TypeScript configuration (tsconfig.json) file to disk.\"\n );\n\n await context.fs.write(\n tsconfigFilePath,\n StormJSON.stringify(context.tsconfig.tsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw,\n context.tsconfig.originalTsconfigJson\n );\n}\n\nexport async function resolveTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown,\n TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> =\n EnvironmentContext<TResolvedConfig, TSystemContext>\n>(context: TContext): Promise<void> {\n const updateTsconfigJson = await readJsonFile<TsConfigJson>(\n context.tsconfig.tsconfigFilePath\n );\n if (\n updateTsconfigJson?.compilerOptions?.types &&\n Array.isArray(updateTsconfigJson.compilerOptions.types) &&\n !updateTsconfigJson.compilerOptions.types.length\n ) {\n // If the types array is empty, we can safely remove it\n delete updateTsconfigJson.compilerOptions.types;\n }\n\n const result = getObjectDiff(\n context.tsconfig.originalTsconfigJson as NonNullable<ObjectData>,\n updateTsconfigJson as ObjectData,\n {\n ignoreArrayOrder: true,\n showOnly: {\n statuses: [\"added\", \"deleted\", \"updated\"],\n granularity: \"deep\"\n }\n }\n );\n\n const changes = [] as {\n field: string;\n status: \"added\" | \"deleted\" | \"updated\";\n previous: string;\n current: string;\n }[];\n const getChanges = (difference: Diff, property?: string) => {\n if (\n difference.status === \"added\" ||\n difference.status === \"deleted\" ||\n difference.status === \"updated\"\n ) {\n if (difference.diff) {\n for (const diff of difference.diff) {\n getChanges(\n diff,\n property\n ? `${property}.${difference.property}`\n : difference.property\n );\n }\n } else {\n changes.push({\n field: property\n ? `${property}.${difference.property}`\n : difference.property,\n status: difference.status,\n previous:\n difference.status === \"added\"\n ? \"---\"\n : StormJSON.stringify(difference.previousValue),\n current:\n difference.status === \"deleted\"\n ? \"---\"\n : StormJSON.stringify(difference.currentValue)\n });\n }\n }\n };\n\n for (const diff of result.diff) {\n getChanges(diff);\n }\n\n if (changes.length > 0) {\n context.warn(\n `Updating the following configuration values in \"${context.tsconfig.tsconfigFilePath}\" file:\n\n ${changes\n .map(\n (change, i) => `${chalk.bold.whiteBright(\n `${i + 1}. ${titleCase(change.status)} the ${change.field} field: `\n )}\n ${chalk.red(` - Previous: ${change.previous} `)}\n ${chalk.green(` - Updated: ${change.current} `)}\n `\n )\n .join(\"\\n\")}\n `\n );\n }\n\n await context.fs.write(\n context.tsconfig.tsconfigFilePath,\n StormJSON.stringify(updateTsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig\n );\n if (!context.tsconfig) {\n throw new Error(\"Failed to parse the TypeScript configuration file.\");\n }\n}\n\n/**\n * Get the path to the tsconfig.json file.\n *\n * @param cwd - The root directory of the workspace.\n * @param root - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @returns The absolute path to the tsconfig.json file.\n * @throws If the tsconfig.json file does not exist.\n */\nexport function getTsconfigFilePath(\n cwd: string,\n root: string,\n tsconfig?: string\n): string {\n let tsconfigFilePath: string | undefined;\n if (tsconfig) {\n tsconfigFilePath = tryTsconfigFilePath(cwd, root, tsconfig);\n } else {\n tsconfigFilePath = tryTsconfigFilePath(cwd, root, \"tsconfig.app.json\");\n if (!tsconfigFilePath) {\n tsconfigFilePath = tryTsconfigFilePath(cwd, root, \"tsconfig.lib.json\");\n if (!tsconfigFilePath) {\n tsconfigFilePath = tryTsconfigFilePath(cwd, root, \"tsconfig.json\");\n }\n }\n }\n\n if (!tsconfigFilePath) {\n throw new Error(\n `Cannot find the \\`tsconfig.json\\` configuration file for the project at ${\n root\n }.`\n );\n }\n\n return tsconfigFilePath;\n}\n\n/**\n * Get the path to the tsconfig.json file.\n *\n * @param cwd - The root directory of the workspace.\n * @param root - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @returns The absolute path to the tsconfig.json file.\n * @throws If the tsconfig.json file does not exist.\n */\nexport function tryTsconfigFilePath(\n cwd: string,\n root: string,\n tsconfig: string\n): string | undefined {\n let tsconfigFilePath = tsconfig;\n if (!existsSync(tsconfigFilePath)) {\n tsconfigFilePath = appendPath(tsconfig, root);\n if (!existsSync(tsconfigFilePath)) {\n tsconfigFilePath = appendPath(tsconfig, appendPath(root, cwd));\n if (!existsSync(tsconfigFilePath)) {\n return undefined;\n }\n }\n }\n\n return tsconfigFilePath;\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function findMatch(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[],\n extensions: string[] = [\".ts\", \".tsx\", \".d.ts\"]\n): string | RegExp | null | undefined {\n return types.find(\n type =>\n tsconfigType?.toString().toLowerCase() ===\n type?.toString().toLowerCase() ||\n tsconfigType?.toString().toLowerCase() ===\n `./${type?.toString().toLowerCase()}` ||\n `./${tsconfigType?.toString().toLowerCase()}` ===\n type?.toString().toLowerCase() ||\n extensions.some(\n ext =>\n `${tsconfigType?.toString().toLowerCase()}${ext}` ===\n type?.toString().toLowerCase() ||\n `${tsconfigType?.toString().toLowerCase()}${ext}` ===\n `./${type?.toString().toLowerCase()}` ||\n `${type?.toString().toLowerCase()}${ext}` ===\n `./${tsconfigType?.toString().toLowerCase()}` ||\n tsconfigType?.toString().toLowerCase() ===\n `${type?.toString().toLowerCase()}${ext}` ||\n tsconfigType?.toString().toLowerCase() ===\n `./${type?.toString().toLowerCase()}${ext}` ||\n type?.toString().toLowerCase() ===\n `./${tsconfigType?.toString().toLowerCase()}${ext}`\n )\n );\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function findIncludeMatch(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[]\n): string | RegExp | null | undefined {\n return findMatch(tsconfigType, types, [\n \".ts\",\n \".tsx\",\n \".d.ts\",\n \".js\",\n \".jsx\",\n \".mjs\",\n \".cjs\",\n \".mts\",\n \".cts\",\n \"/*.ts\",\n \"/*.tsx\",\n \"/*.d.ts\",\n \"/*.js\",\n \"/*.jsx\",\n \"/*.mjs\",\n \"/*.cjs\",\n \"/*.mts\",\n \"/*.cts\",\n \"/**/*.ts\",\n \"/**/*.tsx\",\n \"/**/*.d.ts\",\n \"/**/*.js\",\n \"/**/*.jsx\",\n \"/**/*.mjs\",\n \"/**/*.cjs\",\n \"/**/*.mts\",\n \"/**/*.cts\"\n ]);\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function isMatchFound(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[]\n): boolean {\n return findMatch(tsconfigType, types) !== undefined;\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function isIncludeMatchFound(\n tsconfigType: FilterPattern,\n types: FilterPattern[]\n): boolean {\n return (\n findIncludeMatch(\n tsconfigType as string | RegExp | null,\n types as (string | RegExp | null)[]\n ) !== undefined\n );\n}\n\n/**\n * Get the parsed TypeScript configuration.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param projectRoot - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @param tsconfigRaw - The raw tsconfig.json content.\n * @param originalTsconfigJson - The original tsconfig.json content.\n * @param host - The TypeScript parse config host.\n * @returns The resolved TypeScript configuration.\n */\nexport function getParsedTypeScriptConfig(\n workspaceRoot: string,\n projectRoot: string,\n tsconfig?: string,\n tsconfigRaw: TSConfig = {},\n originalTsconfigJson?: TSConfig,\n host: ts.ParseConfigHost = ts.sys\n): ParsedTypeScriptConfig {\n const tsconfigFilePath = getTsconfigFilePath(\n workspaceRoot,\n projectRoot,\n tsconfig\n );\n const tsconfigJson = readJsonFileSync<TSConfig>(tsconfigFilePath);\n if (!tsconfigJson) {\n throw new Error(\n `Cannot find the \\`tsconfig.json\\` configuration file at ${joinPaths(\n projectRoot,\n tsconfig ?? \"tsconfig.json\"\n )}`\n );\n }\n\n const parsedCommandLine = ts.parseJsonConfigFileContent(\n defu(tsconfigRaw ?? {}, tsconfigJson),\n host,\n appendPath(projectRoot, workspaceRoot)\n );\n if (parsedCommandLine.errors.length > 0) {\n const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:\n${parsedCommandLine.errors\n .map(\n error =>\n `- ${\n (error.category !== undefined && error.code\n ? `[${error.category}-${error.code}]: `\n : \"\") + error.messageText.toString()\n }`\n )\n .join(\"\\n\")}\n `;\n\n throw new Error(errorMessage);\n }\n\n return {\n ...parsedCommandLine,\n originalTsconfigJson: (originalTsconfigJson ??\n tsconfigJson) as TsConfigJson,\n tsconfigJson,\n tsconfigFilePath\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAyCA,SAAgB,mBAGd,SAAsE;AAStE,QARwB,UACtB,aACE,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,KAAK,EAClD,aAAa,QAAQ,UAAU,CAChC,EACD,aAAa,QAAQ,UAAU,CAGX;;AAGxB,eAAe,uBAIb,SACuB;CACvB,MAAM,WAAW,0BACf,QAAQ,OAAO,KACf,QAAQ,OAAO,MACf,QAAQ,OAAO,UACf,QAAQ,OAAO,YAChB;CAQD,MAAM,eAAe,MAAM,aANF,oBACvB,QAAQ,OAAO,KACf,QAAQ,OAAO,MACf,QAAQ,OAAO,SAGqD,CAAC;AACvE,cAAa,oBAAoB,EAAE;AAEnC,KAAI,QAAQ,OAAO,OAAO,QAAQ,OAAO;EACvC,MAAM,kBAAkB,mBAAmB,QAAQ;AAEnD,MACE,CAAC,aAAa,SAAS,MAAK,gBAC1B,o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GAE3C,CACA,KAAK,KAAK,CAAC;;AAGV,QAAM,IAAI,MAAM,aAAa;;AAG/B,QAAO;EACL,GAAG;EACH,sBAAuB,wBACrB;EACF;EACA;EACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const
|
|
3
|
+
const require_constants_plugin = require('../../constants/plugin.cjs');
|
|
4
4
|
let defu = require("defu");
|
|
5
5
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ function combineContexts(contextA, contextB) {
|
|
|
22
22
|
* @returns True if the value is a UnpluginBuilderVariant, false otherwise.
|
|
23
23
|
*/
|
|
24
24
|
function isUnpluginBuilderVariant(str) {
|
|
25
|
-
return (0, _stryke_type_checks_is_set_string.isSetString)(str) &&
|
|
25
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(str) && require_constants_plugin.UNPLUGIN_BUILDER_VARIANTS.includes(str);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const
|
|
3
|
+
const require_plugin_utils_virtual = require('../../plugin-utils/virtual.cjs');
|
|
4
|
+
require('../../plugin-utils/index.cjs');
|
|
4
5
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
5
6
|
let defu = require("defu");
|
|
6
7
|
defu = require_runtime.__toESM(defu, 1);
|
|
@@ -21,12 +22,11 @@ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-stri
|
|
|
21
22
|
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
22
23
|
*/
|
|
23
24
|
function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
24
|
-
const ctx = context;
|
|
25
25
|
return {
|
|
26
26
|
async resolveId(id, importer, opts = { isEntry: false }) {
|
|
27
|
-
const normalizedId =
|
|
28
|
-
const normalizedImporter = importer ?
|
|
29
|
-
let result = await
|
|
27
|
+
const normalizedId = require_plugin_utils_virtual.removeVirtualPrefix(id);
|
|
28
|
+
const normalizedImporter = importer ? require_plugin_utils_virtual.removeVirtualPrefix(importer) : void 0;
|
|
29
|
+
let result = await context.callHook("resolveId", {
|
|
30
30
|
sequential: true,
|
|
31
31
|
result: "first",
|
|
32
32
|
order: "pre"
|
|
@@ -34,9 +34,9 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
34
34
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
35
35
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
36
36
|
...result,
|
|
37
|
-
id: result.virtual && options.prefix !== false ?
|
|
37
|
+
id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
|
|
38
38
|
};
|
|
39
|
-
result = await
|
|
39
|
+
result = await context.callHook("resolveId", {
|
|
40
40
|
sequential: true,
|
|
41
41
|
result: "first",
|
|
42
42
|
order: "normal"
|
|
@@ -44,17 +44,17 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
44
44
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
45
45
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
46
46
|
...result,
|
|
47
|
-
id: result.virtual && options.prefix !== false ?
|
|
47
|
+
id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
|
|
48
48
|
};
|
|
49
|
-
result = await
|
|
49
|
+
result = await context.resolve(normalizedId, normalizedImporter, (0, defu.default)(options.overrides ?? {}, {
|
|
50
50
|
isFile: true,
|
|
51
51
|
...opts
|
|
52
52
|
}));
|
|
53
53
|
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
54
54
|
...result,
|
|
55
|
-
id: result.virtual && options.prefix !== false ?
|
|
55
|
+
id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
|
|
56
56
|
};
|
|
57
|
-
result = await
|
|
57
|
+
result = await context.callHook("resolveId", {
|
|
58
58
|
sequential: true,
|
|
59
59
|
result: "first",
|
|
60
60
|
order: "post"
|
|
@@ -62,29 +62,29 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
62
62
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
63
63
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
64
64
|
...result,
|
|
65
|
-
id: result.virtual && options.prefix !== false ?
|
|
65
|
+
id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
|
|
66
66
|
};
|
|
67
67
|
return null;
|
|
68
68
|
},
|
|
69
69
|
load: {
|
|
70
|
-
filter: options.prefix !== false ? { id:
|
|
70
|
+
filter: options.prefix !== false ? { id: require_plugin_utils_virtual.VIRTUAL_MODULE_PREFIX_REGEX } : void 0,
|
|
71
71
|
async handler(id) {
|
|
72
|
-
const normalizedId =
|
|
73
|
-
let result = await
|
|
72
|
+
const normalizedId = require_plugin_utils_virtual.removeVirtualPrefix(id);
|
|
73
|
+
let result = await context.callHook("load", {
|
|
74
74
|
sequential: true,
|
|
75
75
|
result: "first",
|
|
76
76
|
order: "pre"
|
|
77
77
|
}, normalizedId);
|
|
78
78
|
if (result) return result;
|
|
79
|
-
result = await
|
|
79
|
+
result = await context.callHook("load", {
|
|
80
80
|
sequential: true,
|
|
81
81
|
result: "first",
|
|
82
82
|
order: "normal"
|
|
83
83
|
}, normalizedId);
|
|
84
84
|
if (result) return result;
|
|
85
|
-
result = await
|
|
85
|
+
result = await context.load(normalizedId);
|
|
86
86
|
if (result) return result;
|
|
87
|
-
return
|
|
87
|
+
return context.callHook("load", {
|
|
88
88
|
sequential: true,
|
|
89
89
|
result: "first",
|
|
90
90
|
order: "post"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolveOptions } from "../../types/fs.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { UnresolvedContext } from "../../types/context.cjs";
|
|
3
3
|
import { UnpluginOptions } from "unplugin";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/unplugin/module-resolution.d.ts
|
|
@@ -35,7 +35,7 @@ interface CreateUnpluginModuleResolutionFunctionsOptions {
|
|
|
35
35
|
* @param options - Options for creating the module resolution functions.
|
|
36
36
|
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
37
37
|
*/
|
|
38
|
-
declare function createUnpluginModuleResolutionFunctions<TContext extends
|
|
38
|
+
declare function createUnpluginModuleResolutionFunctions<TContext extends UnresolvedContext>(context: TContext, options?: CreateUnpluginModuleResolutionFunctionsOptions): Pick<UnpluginOptions, "resolveId" | "load">;
|
|
39
39
|
declare type __ΩCreateUnpluginModuleResolutionFunctionsOptions = any[];
|
|
40
40
|
//#endregion
|
|
41
41
|
export { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAmCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAgBN,uCAAA,kBACG,
|
|
1
|
+
{"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAmCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAgBN,uCAAA,kBACG,iBAAA,CAAA,CAEjB,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolveOptions } from "../../types/fs.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { UnresolvedContext } from "../../types/context.mjs";
|
|
3
3
|
import { UnpluginOptions } from "unplugin";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/unplugin/module-resolution.d.ts
|
|
@@ -35,7 +35,7 @@ interface CreateUnpluginModuleResolutionFunctionsOptions {
|
|
|
35
35
|
* @param options - Options for creating the module resolution functions.
|
|
36
36
|
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
37
37
|
*/
|
|
38
|
-
declare function createUnpluginModuleResolutionFunctions<TContext extends
|
|
38
|
+
declare function createUnpluginModuleResolutionFunctions<TContext extends UnresolvedContext>(context: TContext, options?: CreateUnpluginModuleResolutionFunctionsOptions): Pick<UnpluginOptions, "resolveId" | "load">;
|
|
39
39
|
declare type __ΩCreateUnpluginModuleResolutionFunctionsOptions = any[];
|
|
40
40
|
//#endregion
|
|
41
41
|
export { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAmCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAgBN,uCAAA,kBACG,
|
|
1
|
+
{"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAmCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAgBN,uCAAA,kBACG,iBAAA,CAAA,CAEjB,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA;AAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, removeVirtualPrefix } from "../../plugin-utils/virtual.mjs";
|
|
2
|
+
import "../../plugin-utils/index.mjs";
|
|
2
3
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
3
4
|
import defu from "defu";
|
|
4
5
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
@@ -18,12 +19,11 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
|
18
19
|
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
19
20
|
*/
|
|
20
21
|
function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
21
|
-
const ctx = context;
|
|
22
22
|
return {
|
|
23
23
|
async resolveId(id, importer, opts = { isEntry: false }) {
|
|
24
|
-
const normalizedId = id
|
|
25
|
-
const normalizedImporter = importer ? importer
|
|
26
|
-
let result = await
|
|
24
|
+
const normalizedId = removeVirtualPrefix(id);
|
|
25
|
+
const normalizedImporter = importer ? removeVirtualPrefix(importer) : void 0;
|
|
26
|
+
let result = await context.callHook("resolveId", {
|
|
27
27
|
sequential: true,
|
|
28
28
|
result: "first",
|
|
29
29
|
order: "pre"
|
|
@@ -31,9 +31,9 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
31
31
|
if (isSetString(result)) return result;
|
|
32
32
|
else if (isSetObject(result)) return {
|
|
33
33
|
...result,
|
|
34
|
-
id: result.virtual && options.prefix !== false ?
|
|
34
|
+
id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
|
|
35
35
|
};
|
|
36
|
-
result = await
|
|
36
|
+
result = await context.callHook("resolveId", {
|
|
37
37
|
sequential: true,
|
|
38
38
|
result: "first",
|
|
39
39
|
order: "normal"
|
|
@@ -41,17 +41,17 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
41
41
|
if (isSetString(result)) return result;
|
|
42
42
|
else if (isSetObject(result)) return {
|
|
43
43
|
...result,
|
|
44
|
-
id: result.virtual && options.prefix !== false ?
|
|
44
|
+
id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
|
|
45
45
|
};
|
|
46
|
-
result = await
|
|
46
|
+
result = await context.resolve(normalizedId, normalizedImporter, defu(options.overrides ?? {}, {
|
|
47
47
|
isFile: true,
|
|
48
48
|
...opts
|
|
49
49
|
}));
|
|
50
50
|
if (isSetObject(result)) return {
|
|
51
51
|
...result,
|
|
52
|
-
id: result.virtual && options.prefix !== false ?
|
|
52
|
+
id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
|
|
53
53
|
};
|
|
54
|
-
result = await
|
|
54
|
+
result = await context.callHook("resolveId", {
|
|
55
55
|
sequential: true,
|
|
56
56
|
result: "first",
|
|
57
57
|
order: "post"
|
|
@@ -59,29 +59,29 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
59
59
|
if (isSetString(result)) return result;
|
|
60
60
|
else if (isSetObject(result)) return {
|
|
61
61
|
...result,
|
|
62
|
-
id: result.virtual && options.prefix !== false ?
|
|
62
|
+
id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
|
|
63
63
|
};
|
|
64
64
|
return null;
|
|
65
65
|
},
|
|
66
66
|
load: {
|
|
67
|
-
filter: options.prefix !== false ? { id:
|
|
67
|
+
filter: options.prefix !== false ? { id: VIRTUAL_MODULE_PREFIX_REGEX } : void 0,
|
|
68
68
|
async handler(id) {
|
|
69
|
-
const normalizedId = id
|
|
70
|
-
let result = await
|
|
69
|
+
const normalizedId = removeVirtualPrefix(id);
|
|
70
|
+
let result = await context.callHook("load", {
|
|
71
71
|
sequential: true,
|
|
72
72
|
result: "first",
|
|
73
73
|
order: "pre"
|
|
74
74
|
}, normalizedId);
|
|
75
75
|
if (result) return result;
|
|
76
|
-
result = await
|
|
76
|
+
result = await context.callHook("load", {
|
|
77
77
|
sequential: true,
|
|
78
78
|
result: "first",
|
|
79
79
|
order: "normal"
|
|
80
80
|
}, normalizedId);
|
|
81
81
|
if (result) return result;
|
|
82
|
-
result = await
|
|
82
|
+
result = await context.load(normalizedId);
|
|
83
83
|
if (result) return result;
|
|
84
|
-
return
|
|
84
|
+
return context.callHook("load", {
|
|
85
85
|
sequential: true,
|
|
86
86
|
result: "first",
|
|
87
87
|
order: "post"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.mjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.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 defu from \"defu\";\nimport { LoadResult } from \"rollup\";\nimport type {\n UnpluginBuildContext,\n UnpluginContext,\n UnpluginOptions\n} from \"unplugin\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"module-resolution.mjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.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 defu from \"defu\";\nimport { LoadResult } from \"rollup\";\nimport type {\n UnpluginBuildContext,\n UnpluginContext,\n UnpluginOptions\n} from \"unplugin\";\nimport {\n addVirtualPrefix,\n removeVirtualPrefix,\n VIRTUAL_MODULE_PREFIX_REGEX\n} from \"../../plugin-utils\";\nimport { ResolveResult, UnresolvedContext } from \"../../types/context\";\nimport { ResolveOptions } from \"../../types/fs\";\n\nexport interface CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * An indicator of whether to prefix virtual module IDs with a specific string. This is useful for ensuring that virtual modules are only processed by the plugin and not by other plugins or the bundler itself.\n *\n * @remarks\n * - If set to `true`, virtual module IDs will be prefixed with the string `__powerlines-virtual:`.\n * - If set to `false`, no prefix will be added to virtual module IDs.\n *\n * @defaultValue true\n */\n prefix?: boolean;\n\n /**\n * Optional overrides for the module resolution configuration.\n *\n * @remarks\n * This allows you to customize the behavior of the module resolution hooks by providing specific configuration options.\n */\n overrides?: Partial<ResolveOptions>;\n}\n\n/**\n * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.\n *\n * @remarks\n * This includes the `resolveId` and `load` hooks.\n *\n * @see https://rollupjs.org/plugin-development/#resolveid\n * @see https://rollupjs.org/plugin-development/#load\n *\n * @param context - The plugin context.\n * @param options - Options for creating the module resolution functions.\n * @returns The module resolution hooks (`resolveId` and `load`).\n */\nexport function createUnpluginModuleResolutionFunctions<\n TContext extends UnresolvedContext\n>(\n context: TContext,\n options: CreateUnpluginModuleResolutionFunctionsOptions = {}\n): Pick<UnpluginOptions, \"resolveId\" | \"load\"> {\n return {\n async resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ResolveResult | null | undefined> {\n const normalizedId = removeVirtualPrefix(id);\n const normalizedImporter = importer\n ? removeVirtualPrefix(importer)\n : undefined;\n\n let result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.resolve(\n normalizedId,\n normalizedImporter,\n defu(options.overrides ?? {}, {\n isFile: true,\n ...opts\n })\n );\n if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && options.prefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n return null;\n },\n load: {\n filter:\n options.prefix !== false\n ? {\n id: VIRTUAL_MODULE_PREFIX_REGEX\n }\n : undefined,\n async handler(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const normalizedId = removeVirtualPrefix(id);\n\n let result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.load(normalizedId);\n if (result) {\n return result;\n }\n\n return context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId\n );\n }\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqEA,SAAgB,wCAGd,SACA,UAA0D,EAAE,EACf;AAC7C,QAAO;EACL,MAAM,UAEJ,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EAC8B;GACpD,MAAM,eAAe,oBAAoB,GAAG;GAC5C,MAAM,qBAAqB,WACvB,oBAAoB,SAAS,GAC7B;GAEJ,IAAI,SAAS,MAAM,QAAQ,SACzB,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,cACA,oBACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO;YACE,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,GAAG,GAC3B,OAAO;IACd;AAGH,YAAS,MAAM,QAAQ,SACrB,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,cACA,oBACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO;YACE,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,GAAG,GAC3B,OAAO;IACd;AAGH,YAAS,MAAM,QAAQ,QACrB,cACA,oBACA,KAAK,QAAQ,aAAa,EAAE,EAAE;IAC5B,QAAQ;IACR,GAAG;IACJ,CAAC,CACH;AACD,OAAI,YAAY,OAAO,CACrB,QAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,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