@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,43 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/lib/events.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create event emitter.
|
|
6
|
+
*/
|
|
7
|
+
function createEventEmitter() {
|
|
8
|
+
const _listeners = {};
|
|
9
|
+
function emit(event, ...args) {
|
|
10
|
+
const callbacks = _listeners[event] || [];
|
|
11
|
+
for (let i = 0, length = callbacks.length; i < length; i++) {
|
|
12
|
+
const callback = callbacks[i];
|
|
13
|
+
if (callback) callback(...args);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function emitOnce(event, ...args) {
|
|
17
|
+
emit(event, ...args);
|
|
18
|
+
delete _listeners[event];
|
|
19
|
+
}
|
|
20
|
+
function on(event, cb) {
|
|
21
|
+
(_listeners[event] ||= []).push(cb);
|
|
22
|
+
return () => {
|
|
23
|
+
_listeners[event] = _listeners[event]?.filter((i) => cb !== i);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function once(event, cb) {
|
|
27
|
+
const unsubscribe = on(event, ((...args) => {
|
|
28
|
+
unsubscribe();
|
|
29
|
+
return cb(...args);
|
|
30
|
+
}));
|
|
31
|
+
return unsubscribe;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
_listeners,
|
|
35
|
+
emit,
|
|
36
|
+
emitOnce,
|
|
37
|
+
on,
|
|
38
|
+
once
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.createEventEmitter = createEventEmitter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventEmitter, EventsMap } from "devframe/types";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/events.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create event emitter.
|
|
6
|
+
*/
|
|
7
|
+
declare function createEventEmitter<Events extends EventsMap>(): EventEmitter<Events>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createEventEmitter };
|
|
10
|
+
//# sourceMappingURL=events.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.cts","names":[],"sources":["../../src/lib/events.ts"],"mappings":";;;;;AAuBA;iBAAgB,kBAAA,gBACC,SAAA,CAAA,CAAA,GACZ,YAAA,CAAa,MAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventEmitter, EventsMap } from "devframe/types";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/events.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create event emitter.
|
|
6
|
+
*/
|
|
7
|
+
declare function createEventEmitter<Events extends EventsMap>(): EventEmitter<Events>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createEventEmitter };
|
|
10
|
+
//# sourceMappingURL=events.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.mts","names":[],"sources":["../../src/lib/events.ts"],"mappings":";;;;;AAuBA;iBAAgB,kBAAA,gBACC,SAAA,CAAA,CAAA,GACZ,YAAA,CAAa,MAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/lib/events.ts
|
|
2
|
+
/**
|
|
3
|
+
* Create event emitter.
|
|
4
|
+
*/
|
|
5
|
+
function createEventEmitter() {
|
|
6
|
+
const _listeners = {};
|
|
7
|
+
function emit(event, ...args) {
|
|
8
|
+
const callbacks = _listeners[event] || [];
|
|
9
|
+
for (let i = 0, length = callbacks.length; i < length; i++) {
|
|
10
|
+
const callback = callbacks[i];
|
|
11
|
+
if (callback) callback(...args);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function emitOnce(event, ...args) {
|
|
15
|
+
emit(event, ...args);
|
|
16
|
+
delete _listeners[event];
|
|
17
|
+
}
|
|
18
|
+
function on(event, cb) {
|
|
19
|
+
(_listeners[event] ||= []).push(cb);
|
|
20
|
+
return () => {
|
|
21
|
+
_listeners[event] = _listeners[event]?.filter((i) => cb !== i);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function once(event, cb) {
|
|
25
|
+
const unsubscribe = on(event, ((...args) => {
|
|
26
|
+
unsubscribe();
|
|
27
|
+
return cb(...args);
|
|
28
|
+
}));
|
|
29
|
+
return unsubscribe;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
_listeners,
|
|
33
|
+
emit,
|
|
34
|
+
emitOnce,
|
|
35
|
+
on,
|
|
36
|
+
once
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { createEventEmitter };
|
|
42
|
+
//# sourceMappingURL=events.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.mjs","names":[],"sources":["../../src/lib/events.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 { EventEmitter, EventsMap, EventUnsubscribe } from \"devframe/types\";\n\n/**\n * Create event emitter.\n */\nexport function createEventEmitter<\n Events extends EventsMap\n>(): EventEmitter<Events> {\n const _listeners: Partial<{ [E in keyof Events]: Events[E][] }> = {};\n\n function emit<K extends keyof Events>(\n event: K,\n ...args: Parameters<Events[K]>\n ) {\n const callbacks = _listeners[event] || [];\n for (let i = 0, length = callbacks.length; i < length; i++) {\n const callback = callbacks[i];\n if (callback) {\n // eslint-disable-next-line ts/no-unsafe-call\n callback(...args);\n }\n }\n }\n function emitOnce<K extends keyof Events>(\n event: K,\n ...args: Parameters<Events[K]>\n ) {\n emit(event, ...args);\n delete _listeners[event];\n }\n function on<K extends keyof Events>(\n event: K,\n cb: Events[K]\n ): EventUnsubscribe {\n (_listeners[event] ||= [] as Events[K][]).push(cb);\n return () => {\n _listeners[event] = _listeners[event]?.filter(i => cb !== i);\n };\n }\n function once<K extends keyof Events>(event: K, cb: Events[K]) {\n const unsubscribe = on(event, ((...args: Parameters<Events[K]>) => {\n unsubscribe();\n\n // eslint-disable-next-line ts/no-unsafe-call\n return cb(...args);\n }) as Events[K]);\n\n return unsubscribe;\n }\n\n return {\n _listeners,\n emit,\n emitOnce,\n on,\n once\n };\n}\n"],"mappings":";;;;AAuBA,SAAgB,qBAEU;CACxB,MAAM,aAA4D,EAAE;CAEpE,SAAS,KACP,OACA,GAAG,MACH;EACA,MAAM,YAAY,WAAW,UAAU,EAAE;AACzC,OAAK,IAAI,IAAI,GAAG,SAAS,UAAU,QAAQ,IAAI,QAAQ,KAAK;GAC1D,MAAM,WAAW,UAAU;AAC3B,OAAI,SAEF,UAAS,GAAG,KAAK;;;CAIvB,SAAS,SACP,OACA,GAAG,MACH;AACA,OAAK,OAAO,GAAG,KAAK;AACpB,SAAO,WAAW;;CAEpB,SAAS,GACP,OACA,IACkB;AAClB,GAAC,WAAW,WAAW,EAAE,EAAiB,KAAK,GAAG;AAClD,eAAa;AACX,cAAW,SAAS,WAAW,QAAQ,QAAO,MAAK,OAAO,EAAE;;;CAGhE,SAAS,KAA6B,OAAU,IAAe;EAC7D,MAAM,cAAc,GAAG,SAAS,GAAG,SAAgC;AACjE,gBAAa;AAGb,UAAO,GAAG,GAAG,KAAK;KACJ;AAEhB,SAAO;;AAGT,QAAO;EACL;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_lib_utilities_format = require('./utilities/format.cjs');
|
|
4
|
+
const require_lib_hooks = require('./hooks.cjs');
|
|
5
|
+
const require_lib_typescript_ts_morph = require('./typescript/ts-morph.cjs');
|
|
6
|
+
const require_lib_utilities_file_header = require('./utilities/file-header.cjs');
|
|
7
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
8
|
+
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
9
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
10
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
11
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
12
|
+
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
13
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
14
|
+
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
15
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
16
|
+
let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
17
|
+
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
18
|
+
let _stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
|
|
19
|
+
let ts_morph = require("ts-morph");
|
|
20
|
+
|
|
21
|
+
//#region src/lib/generate-types.ts
|
|
22
|
+
/**
|
|
23
|
+
* Formats the generated TypeScript types source code.
|
|
24
|
+
*
|
|
25
|
+
* @param code - The generated TypeScript code.
|
|
26
|
+
* @returns The formatted TypeScript code.
|
|
27
|
+
*/
|
|
28
|
+
function formatTypes(code = "") {
|
|
29
|
+
return code.replaceAll("#private;", "").replace(/__Ω/g, "");
|
|
30
|
+
}
|
|
31
|
+
async function extractModuleDeclarations(ctx, filePath, name, text) {
|
|
32
|
+
const imports = [];
|
|
33
|
+
const exports = [];
|
|
34
|
+
const comment = text.match(new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${ctx.context.config.framework?.name ?? "powerlines"}:${name}(?s:.)*?\\*\\/\\s+`))?.find((comment) => (0, _stryke_type_checks_is_set_string.isSetString)(comment?.trim()));
|
|
35
|
+
const sourceFile = new ts_morph.Project({ useInMemoryFileSystem: true }).createSourceFile("module.d.ts", text);
|
|
36
|
+
for (const ref of sourceFile.getTypeReferenceDirectives()) if (ref.getFileName() && !ctx.context.builtins.some((builtin) => ref.getFileName().endsWith(builtin))) imports.push({
|
|
37
|
+
name: ref.getFileName(),
|
|
38
|
+
ambient: true
|
|
39
|
+
});
|
|
40
|
+
for (const statement of sourceFile.getStatements()) if (ts_morph.Node.isImportDeclaration(statement)) {
|
|
41
|
+
const moduleSpec = statement.getModuleSpecifierValue();
|
|
42
|
+
if (statement.getNamespaceImport()) imports.push({
|
|
43
|
+
name: moduleSpec,
|
|
44
|
+
specifiers: [{ name: statement.getNamespaceImport().getText() }],
|
|
45
|
+
all: true
|
|
46
|
+
});
|
|
47
|
+
else if (statement.getNamedImports().length > 0 || statement.getDefaultImport()) {
|
|
48
|
+
const specifiers = [];
|
|
49
|
+
if (statement.getDefaultImport()) specifiers.push({
|
|
50
|
+
name: statement.getDefaultImport().getText(),
|
|
51
|
+
default: true,
|
|
52
|
+
type: statement.isTypeOnly()
|
|
53
|
+
});
|
|
54
|
+
statement.getNamedImports().forEach((named) => {
|
|
55
|
+
specifiers.push({
|
|
56
|
+
name: named.getName(),
|
|
57
|
+
alias: named.getAliasNode()?.getText(),
|
|
58
|
+
type: statement.isTypeOnly()
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
imports.push({
|
|
62
|
+
name: moduleSpec,
|
|
63
|
+
specifiers
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
} else if (ts_morph.Node.isExportDeclaration(statement)) {
|
|
67
|
+
const moduleSpec = statement.getModuleSpecifierValue();
|
|
68
|
+
if (moduleSpec) {
|
|
69
|
+
let resolvedSpec = moduleSpec;
|
|
70
|
+
if (!ctx.context.builtins.includes(moduleSpec)) if (ctx.emitted.has(moduleSpec)) resolvedSpec = ctx.emitted.get(moduleSpec);
|
|
71
|
+
else {
|
|
72
|
+
const resolvedModule = await ctx.context.resolve(moduleSpec, filePath);
|
|
73
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(resolvedModule?.id)) resolvedSpec = resolvedModule.id;
|
|
74
|
+
}
|
|
75
|
+
const namedExports = statement.getNamedExports();
|
|
76
|
+
if (namedExports.length > 0) exports.push({
|
|
77
|
+
name: resolvedSpec,
|
|
78
|
+
text: statement.getText(),
|
|
79
|
+
fullText: statement.getFullText(),
|
|
80
|
+
specifiers: namedExports.map((named) => ({
|
|
81
|
+
name: named.getName(),
|
|
82
|
+
alias: named.getAliasNode()?.getText(),
|
|
83
|
+
type: statement.isTypeOnly()
|
|
84
|
+
})),
|
|
85
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n").trim()
|
|
86
|
+
});
|
|
87
|
+
else exports.push({
|
|
88
|
+
name: resolvedSpec,
|
|
89
|
+
text: statement.getText(),
|
|
90
|
+
fullText: statement.getFullText(),
|
|
91
|
+
all: true,
|
|
92
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n").trim()
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
const specifiers = statement.getNamedExports().map((named) => ({
|
|
96
|
+
name: named.getName(),
|
|
97
|
+
alias: named.getAliasNode()?.getText(),
|
|
98
|
+
type: statement.isTypeOnly()
|
|
99
|
+
}));
|
|
100
|
+
if (specifiers.length > 0) exports.push({
|
|
101
|
+
text: statement.getText(),
|
|
102
|
+
fullText: statement.getFullText(),
|
|
103
|
+
specifiers,
|
|
104
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} else if (ts_morph.Node.isExportAssignment(statement)) exports.push({
|
|
108
|
+
text: statement.getText(),
|
|
109
|
+
fullText: statement.getFullText(),
|
|
110
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
|
|
111
|
+
});
|
|
112
|
+
else if (ts_morph.Node.isFunctionDeclaration(statement) && statement.isExported() && statement.getNameNode()) exports.push({
|
|
113
|
+
text: statement.getText(),
|
|
114
|
+
fullText: statement.getFullText(),
|
|
115
|
+
specifiers: [{ name: statement.getNameNode().getText() }],
|
|
116
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
|
|
117
|
+
});
|
|
118
|
+
else if (ts_morph.Node.isVariableStatement(statement) && statement.isExported()) exports.push({
|
|
119
|
+
text: statement.getText(),
|
|
120
|
+
fullText: statement.getFullText(),
|
|
121
|
+
specifiers: statement.getDeclarationList().getDeclarations().filter((decl) => decl.getNameNode() && ts_morph.Node.isIdentifier(decl.getNameNode())).map((decl) => ({ name: decl.getNameNode().getText() })),
|
|
122
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
|
|
123
|
+
});
|
|
124
|
+
else if (ts_morph.Node.isClassDeclaration(statement) && statement.isExported()) {
|
|
125
|
+
const nameNode = statement.getNameNode();
|
|
126
|
+
exports.push({
|
|
127
|
+
text: statement.getText(),
|
|
128
|
+
fullText: statement.getFullText(),
|
|
129
|
+
specifiers: nameNode ? [{ name: nameNode.getText() }] : void 0,
|
|
130
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
|
|
131
|
+
});
|
|
132
|
+
} else if (ts_morph.Node.isInterfaceDeclaration(statement) && statement.isExported()) {
|
|
133
|
+
const nameNode = statement.getNameNode();
|
|
134
|
+
exports.push({
|
|
135
|
+
text: statement.getText(),
|
|
136
|
+
fullText: statement.getFullText(),
|
|
137
|
+
specifiers: nameNode ? [{ name: nameNode.getText() }] : void 0,
|
|
138
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
|
|
139
|
+
});
|
|
140
|
+
} else if (ts_morph.Node.isTypeAliasDeclaration(statement) && statement.isExported()) {
|
|
141
|
+
const nameNode = statement.getNameNode();
|
|
142
|
+
exports.push({
|
|
143
|
+
text: statement.getText(),
|
|
144
|
+
fullText: statement.getFullText(),
|
|
145
|
+
specifiers: nameNode ? [{ name: nameNode.getText() }] : void 0,
|
|
146
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
|
|
147
|
+
});
|
|
148
|
+
} else if (ctx.context.config.output.sourceMap || !statement.getFullText().includes("//# sourceMappingURL=")) exports.push({
|
|
149
|
+
text: statement.getText(),
|
|
150
|
+
fullText: statement.getFullText(),
|
|
151
|
+
comment: statement.getLeadingCommentRanges().filter((c) => (0, _stryke_type_checks_is_set_string.isSetString)(c.getText().trim()) && !c.getText().includes("@module")).map((c) => c.getText().trim()).join("\n")
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
name,
|
|
155
|
+
text,
|
|
156
|
+
sourceFile,
|
|
157
|
+
comment,
|
|
158
|
+
imports,
|
|
159
|
+
exports
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Emits TypeScript declaration types for the provided files using the given TypeScript configuration.
|
|
164
|
+
*
|
|
165
|
+
* @param context - The context containing options and environment paths.
|
|
166
|
+
* @param files - The list of files to generate types for.
|
|
167
|
+
* @returns A promise that resolves to the generated TypeScript declaration types.
|
|
168
|
+
*/
|
|
169
|
+
async function emitBuiltinTypes(context, files) {
|
|
170
|
+
if (files.length === 0) {
|
|
171
|
+
context.debug("No files provided for TypeScript types generation. Typescript compilation for built-in modules will be skipped.");
|
|
172
|
+
return {
|
|
173
|
+
code: "",
|
|
174
|
+
directives: []
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
context.debug(`Running the TypeScript compiler for ${files.length} generated built-in module files.`);
|
|
178
|
+
const program = require_lib_typescript_ts_morph.createProgram(context, {
|
|
179
|
+
skipAddingFilesFromTsConfig: true,
|
|
180
|
+
compilerOptions: {
|
|
181
|
+
declaration: true,
|
|
182
|
+
declarationMap: false,
|
|
183
|
+
emitDeclarationOnly: true,
|
|
184
|
+
sourceMap: false,
|
|
185
|
+
outDir: (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.config.cwd),
|
|
186
|
+
composite: false,
|
|
187
|
+
incremental: false,
|
|
188
|
+
tsBuildInfoFile: void 0
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
program.addSourceFilesAtPaths(files);
|
|
192
|
+
const emitResult = program.emitToMemory({ emitOnlyDtsFiles: true });
|
|
193
|
+
const diagnostics = emitResult.getDiagnostics();
|
|
194
|
+
if (diagnostics && diagnostics.length > 0) if (diagnostics.some((d) => d.getCategory() === ts_morph.DiagnosticCategory.Error)) throw new Error(`The Typescript emit process failed while generating built-in types: \n ${diagnostics.filter((d) => d.getCategory() === ts_morph.DiagnosticCategory.Error).map((d) => `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : ""} ${String(d.getMessageText())} (at ${d.getStart()}:${d.getLength()})`).join("\n")}`);
|
|
195
|
+
else if (diagnostics.some((d) => d.getCategory() === ts_morph.DiagnosticCategory.Warning)) context.warn(`The Typescript emit process completed with warnings while generating built-in types: \n ${diagnostics.filter((d) => d.getCategory() === ts_morph.DiagnosticCategory.Warning).map((d) => `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : ""} ${String(d.getMessageText())} (at ${d.getStart()}:${d.getLength()})`).join("\n")}`);
|
|
196
|
+
else context.debug(`The Typescript emit process completed with diagnostic messages while generating built-in types: \n ${diagnostics.map((d) => `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : ""} ${String(d.getMessageText())} (at ${d.getStart()}:${d.getLength()})`).join("\n")}`);
|
|
197
|
+
const emittedFiles = emitResult.getFiles();
|
|
198
|
+
context.debug(`The TypeScript compiler emitted ${emittedFiles.length} files for built-in types.`);
|
|
199
|
+
if (emittedFiles.length === 0) {
|
|
200
|
+
context.warn("The TypeScript compiler did not emit any files for built-in types. This may indicate an issue with the TypeScript configuration or the provided files.");
|
|
201
|
+
return {
|
|
202
|
+
code: "",
|
|
203
|
+
directives: []
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const ctx = {
|
|
207
|
+
context,
|
|
208
|
+
modules: [],
|
|
209
|
+
emitted: /* @__PURE__ */ new Map()
|
|
210
|
+
};
|
|
211
|
+
await Promise.all(emittedFiles.map(async (emittedFile) => {
|
|
212
|
+
const filePath = (0, _stryke_path_append.appendPath)(emittedFile.filePath, context.config.cwd);
|
|
213
|
+
if (!filePath.endsWith(".map") && (0, _stryke_path_file_path_fns.findFileName)(filePath) !== "tsconfig.tsbuildinfo" && (0, _stryke_path_is_parent_path.isParentPath)(filePath, context.builtinsPath)) {
|
|
214
|
+
const moduleName = (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(filePath, context.builtinsPath), (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.config.cwd)), "", { fullExtension: true });
|
|
215
|
+
if (context.builtins.includes(moduleName)) {
|
|
216
|
+
ctx.emitted.set(filePath, moduleName);
|
|
217
|
+
ctx.modules.push(await extractModuleDeclarations(ctx, filePath, moduleName, emittedFile.text));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}));
|
|
221
|
+
const commonDeclarations = [];
|
|
222
|
+
for (const mod of ctx.modules) for (const importRef of mod.imports.filter((importRef) => context.builtins.some((builtin) => importRef.name.endsWith(`:${builtin}`)))) {
|
|
223
|
+
const moduleRef = ctx.modules.find((moduleRef) => importRef.name.endsWith(`:${moduleRef.name}`));
|
|
224
|
+
if (moduleRef) {
|
|
225
|
+
let declaration;
|
|
226
|
+
for (const decl of moduleRef.exports.filter((decl) => (0, _stryke_type_checks_is_set_object.isSetObject)(decl))) {
|
|
227
|
+
const specifiers = decl.specifiers?.filter((specifier) => importRef.specifiers?.some((s) => (specifier.alias ? specifier.alias : specifier.name) === (s.alias ? s.alias : s.name)));
|
|
228
|
+
if (specifiers && specifiers.length > 0) {
|
|
229
|
+
importRef.specifiers = importRef.specifiers?.filter((s) => !specifiers.some((specifier) => (specifier.alias ? specifier.alias : specifier.name) === (s.alias ? s.alias : s.name)));
|
|
230
|
+
if (importRef.specifiers && importRef.specifiers.length === 0 && !importRef.all && !importRef.ambient) mod.imports = mod.imports.filter((imp) => imp.name !== importRef.name);
|
|
231
|
+
declaration = decl;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (declaration) {
|
|
236
|
+
for (const decl of moduleRef.exports.filter((decl) => (0, _stryke_type_checks_is_set_object.isSetObject)(decl) && !decl.specifiers?.some((s) => declaration?.specifiers?.some((specifier) => (specifier.alias ? specifier.alias : specifier.name) === (s.alias ? s.alias : s.name))))) {
|
|
237
|
+
const exportModuleRef = decl;
|
|
238
|
+
if ((exportModuleRef.specifiers?.some((s) => s.alias || s.name) || exportModuleRef.name) && new RegExp(`(^|\\s|\\n|\\r\\n|\\(|\\)|<|>|{|}|\\[|\\]|\\!|\\?|\\.|,|\\*|&|:)(${exportModuleRef.specifiers?.map((s) => `${s.alias ? `${s.alias}|` : ""}${s.name}`).join("|") || exportModuleRef.name})($|\\s|\\n|\\r\\n|\\(|\\)|<|>|{|}|\\[|\\]|\\!|\\?|\\.|,|\\*|&|:|;)`).test(declaration.text)) commonDeclarations.push(exportModuleRef);
|
|
239
|
+
}
|
|
240
|
+
commonDeclarations.push(declaration);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
let code = "";
|
|
245
|
+
const directives = [];
|
|
246
|
+
for (const commonDeclaration of commonDeclarations) {
|
|
247
|
+
code += formatTypes(`${commonDeclaration.comment?.trim() ? commonDeclaration.comment.trim() : ""}${commonDeclaration.comment?.trim() ? "\n" : ""}${formatTypes(commonDeclaration.text.replace(/\s*export\s*/, "").replace(/\s*declare\s*interface\s*/, "interface ").replace(/\s*declare\s*type\s*/, "type "))}`);
|
|
248
|
+
code += "\n\n";
|
|
249
|
+
}
|
|
250
|
+
for (const mod of ctx.modules) {
|
|
251
|
+
code += mod.comment ? `${mod.comment.trim()}\n` : "";
|
|
252
|
+
code += `declare module "${context.config.framework?.name ?? "powerlines"}:${mod.name}" { \n`;
|
|
253
|
+
for (const importRef of mod.imports) if (importRef.ambient) code += directives.push(importRef.name);
|
|
254
|
+
else if (importRef.all) code += `\timport * as ${(0, _stryke_path_file_path_fns.findFileName)(importRef.name)} from "${importRef.name}";\n`;
|
|
255
|
+
else if (importRef.specifiers) {
|
|
256
|
+
const typeOnly = importRef.specifiers.every((s) => s.type) ? " type" : "";
|
|
257
|
+
const specifiers = importRef.specifiers.map((s) => s.alias ? `${s.name} as ${s.alias}` : s.name).join(", ");
|
|
258
|
+
code += `\timport${typeOnly} { ${specifiers} } from "${importRef.name}";\n`;
|
|
259
|
+
}
|
|
260
|
+
if (mod.imports.length > 0) code += "\n";
|
|
261
|
+
for (const exportRef of mod.exports.filter((e) => (0, _stryke_type_checks_is_string.isString)(e) || !e.specifiers || !commonDeclarations.some((commonDecl) => commonDecl.specifiers && commonDecl.specifiers.some((specifier) => e.specifiers?.some((s) => (s.alias ? s.alias : s.name) === (specifier.alias ? specifier.alias : specifier.name)))))) if ((0, _stryke_type_checks_is_set_string.isSetString)(exportRef)) code += `${exportRef}\n`;
|
|
262
|
+
else if (exportRef.name) {
|
|
263
|
+
if (exportRef.all) code += `${exportRef.comment?.trim() ? exportRef.comment.trim() : ""}${exportRef.comment?.trim() ? "\n" : ""}export * from "${exportRef.name}";\n`;
|
|
264
|
+
else if (exportRef.specifiers) {
|
|
265
|
+
if (exportRef.comment?.trim()) code += `${exportRef.comment.trim()}\n`;
|
|
266
|
+
code += `\texport${exportRef.specifiers.every((s) => s.type) ? " type" : ""} { ${exportRef.specifiers.map((s) => s.alias ? `${s.name} as ${s.alias}` : s.name).join(", ")} } from "${exportRef.name}";\n`;
|
|
267
|
+
}
|
|
268
|
+
} else code += `${exportRef.comment?.trim() ? exportRef.comment.trim() : ""}${exportRef.comment?.trim() ? "\n" : ""}${formatTypes(exportRef.text.replace(/\s*export\s*declare\s*/, "export ").replace(/\s*declare\s*/, " "))}\n`;
|
|
269
|
+
mod.exports.filter((e) => !(0, _stryke_type_checks_is_string.isString)(e) && e.specifiers && commonDeclarations.some((commonDeclaration) => commonDeclaration.specifiers && commonDeclaration.specifiers.some((specifier) => e.specifiers?.some((s) => (s.alias ? s.alias : s.name) === (specifier.alias ? specifier.alias : specifier.name))))).forEach((e, i, arr) => {
|
|
270
|
+
if (i === 0) code += "\nexport { ";
|
|
271
|
+
else code += ", ";
|
|
272
|
+
code += `${e?.specifiers?.filter((s) => commonDeclarations.some((commonDeclaration) => commonDeclaration.specifiers && commonDeclaration.specifiers.some((specifier) => (s.alias ? s.alias : s.name) === (specifier.alias ? specifier.alias : specifier.name)))).map((s) => s.alias ? `${s.name} as ${s.alias}` : s.name).join(", ") || ""}`;
|
|
273
|
+
if (i === arr.length - 1) code += ` };\n`;
|
|
274
|
+
});
|
|
275
|
+
code += "}";
|
|
276
|
+
code += "\n\n";
|
|
277
|
+
}
|
|
278
|
+
code = await require_lib_utilities_format.format(context, context.typesPath, code);
|
|
279
|
+
context.debug(`A TypeScript declaration file (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new Blob((0, _stryke_convert_to_array.toArray)(code)).size)}) emitted for the built-in modules types.`);
|
|
280
|
+
return {
|
|
281
|
+
code,
|
|
282
|
+
directives
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Generate the Powerlines TypeScript declaration file
|
|
287
|
+
*
|
|
288
|
+
* @param context - The execution context for generating the TypeScript declaration file, which provides access to the project configuration, environment, and utility functions for performing the generation. The context is used to manage the state and behavior of the generation process, allowing for hooks to be called at different stages and for environment-specific configurations to be applied.
|
|
289
|
+
* @param env - The environment context to use for generating the TypeScript declaration file
|
|
290
|
+
*/
|
|
291
|
+
async function handleTypes(context, env) {
|
|
292
|
+
env.debug(`Preparing the TypeScript definitions for the Powerlines project.`);
|
|
293
|
+
if (env.fs.existsSync(env.typesPath)) await env.fs.remove(env.typesPath);
|
|
294
|
+
if (!await (0, _stryke_fs_resolve.resolvePackage)("typescript")) throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
|
|
295
|
+
env.debug("Running TypeScript compiler for built-in runtime module files.");
|
|
296
|
+
let { code, directives } = await emitBuiltinTypes(env, (await env.getBuiltins()).reduce((ret, builtin) => {
|
|
297
|
+
const formatted = (0, _stryke_path_replace.replacePath)(builtin.path, env.config.cwd);
|
|
298
|
+
if (!ret.includes(formatted)) ret.push(formatted);
|
|
299
|
+
return ret;
|
|
300
|
+
}, []));
|
|
301
|
+
env.debug(`Generating TypeScript declaration file ${env.typesPath}.`);
|
|
302
|
+
const merge = async (currentResult, previousResult) => {
|
|
303
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(currentResult) && !(0, _stryke_type_checks_is_set_object.isSetObject)(currentResult) && !(0, _stryke_type_checks_is_set_string.isSetString)(previousResult) && !(0, _stryke_type_checks_is_set_object.isSetObject)(previousResult)) return {
|
|
304
|
+
code,
|
|
305
|
+
directives
|
|
306
|
+
};
|
|
307
|
+
const previous = (await require_lib_utilities_format.format(env, env.typesPath, (0, _stryke_type_checks_is_set_string.isSetString)(previousResult) ? previousResult : (0, _stryke_type_checks_is_set_object.isSetObject)(previousResult) ? previousResult.code : "")).trim().replace(code, "").trim();
|
|
308
|
+
const current = (await require_lib_utilities_format.format(env, env.typesPath, (0, _stryke_type_checks_is_set_string.isSetString)(currentResult) ? currentResult : (0, _stryke_type_checks_is_set_object.isSetObject)(currentResult) ? currentResult.code : "")).trim().replace(previous, "").trim().replace(code, "").trim();
|
|
309
|
+
return {
|
|
310
|
+
directives: [...(0, _stryke_type_checks_is_set_object.isSetObject)(currentResult) && currentResult.directives ? currentResult.directives : [], ...(0, _stryke_type_checks_is_set_object.isSetObject)(previousResult) && previousResult.directives ? previousResult.directives : []],
|
|
311
|
+
code: await require_lib_utilities_format.format(env, env.typesPath, `${!previous.includes(require_lib_utilities_file_header.getTypescriptFileHeader(env)) && !current.includes(require_lib_utilities_file_header.getTypescriptFileHeader(env)) ? `${code}\n` : ""}${previous}\n${current}`.trim())
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
const asNextParam = (previousResult) => (0, _stryke_type_checks_is_object.isObject)(previousResult) ? previousResult.code : previousResult;
|
|
315
|
+
let result = await require_lib_hooks.callHook(context, "types", {
|
|
316
|
+
environment: env,
|
|
317
|
+
sequential: true,
|
|
318
|
+
order: "pre",
|
|
319
|
+
result: "merge",
|
|
320
|
+
merge,
|
|
321
|
+
asNextParam
|
|
322
|
+
}, code);
|
|
323
|
+
if (result) {
|
|
324
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) {
|
|
325
|
+
code = result.code;
|
|
326
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) directives = (0, _stryke_helpers_get_unique.getUnique)([...directives, ...result.directives]).filter(Boolean);
|
|
327
|
+
} else if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) code = result;
|
|
328
|
+
}
|
|
329
|
+
result = await require_lib_hooks.callHook(context, "types", {
|
|
330
|
+
environment: env,
|
|
331
|
+
sequential: true,
|
|
332
|
+
order: "normal",
|
|
333
|
+
result: "merge",
|
|
334
|
+
merge,
|
|
335
|
+
asNextParam
|
|
336
|
+
}, code);
|
|
337
|
+
if (result) {
|
|
338
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) {
|
|
339
|
+
code = result.code;
|
|
340
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) directives = (0, _stryke_helpers_get_unique.getUnique)([...directives, ...result.directives]).filter(Boolean);
|
|
341
|
+
} else if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) code = result;
|
|
342
|
+
}
|
|
343
|
+
result = await require_lib_hooks.callHook(context, "types", {
|
|
344
|
+
environment: env,
|
|
345
|
+
sequential: true,
|
|
346
|
+
order: "post",
|
|
347
|
+
result: "merge",
|
|
348
|
+
merge,
|
|
349
|
+
asNextParam
|
|
350
|
+
}, code);
|
|
351
|
+
if (result) {
|
|
352
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) {
|
|
353
|
+
code = result.code;
|
|
354
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) directives = (0, _stryke_helpers_get_unique.getUnique)([...directives, ...result.directives]).filter(Boolean);
|
|
355
|
+
} else if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) code = result;
|
|
356
|
+
}
|
|
357
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(code?.trim()) || directives.length > 0) await env.fs.write(env.typesPath, `${directives.length > 0 ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
358
|
+
|
|
359
|
+
` : ""}${require_lib_utilities_file_header.getTypescriptFileHeader(env, {
|
|
360
|
+
directive: null,
|
|
361
|
+
prettierIgnore: false
|
|
362
|
+
})}
|
|
363
|
+
|
|
364
|
+
${formatTypes(code)}
|
|
365
|
+
`);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
//#endregion
|
|
369
|
+
exports.emitBuiltinTypes = emitBuiltinTypes;
|
|
370
|
+
exports.formatTypes = formatTypes;
|
|
371
|
+
exports.handleTypes = handleTypes;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Context, EnvironmentContext, ExecutionContext } from "../types/context.cjs";
|
|
2
|
+
import { ResolvedConfig } from "../types/config.cjs";
|
|
3
|
+
import { SourceFile } from "ts-morph";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/generate-types.d.ts
|
|
6
|
+
interface ModuleExportSpecifier {
|
|
7
|
+
name: string;
|
|
8
|
+
alias?: string;
|
|
9
|
+
default?: boolean;
|
|
10
|
+
type?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ModuleReference {
|
|
13
|
+
name?: string;
|
|
14
|
+
specifiers?: ModuleExportSpecifier[];
|
|
15
|
+
all?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface ImportModuleReference extends ModuleReference {
|
|
18
|
+
name: string;
|
|
19
|
+
ambient?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ExportModuleReference extends ModuleReference {
|
|
22
|
+
text: string;
|
|
23
|
+
fullText: string;
|
|
24
|
+
comment?: string;
|
|
25
|
+
}
|
|
26
|
+
interface ModuleDeclaration {
|
|
27
|
+
name: string;
|
|
28
|
+
text: string;
|
|
29
|
+
sourceFile: SourceFile;
|
|
30
|
+
comment?: string;
|
|
31
|
+
exports: (ExportModuleReference | string)[];
|
|
32
|
+
imports: ImportModuleReference[];
|
|
33
|
+
}
|
|
34
|
+
interface TypegenContext {
|
|
35
|
+
context: Context;
|
|
36
|
+
emitted: Map<string, string>;
|
|
37
|
+
modules: ModuleDeclaration[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Formats the generated TypeScript types source code.
|
|
41
|
+
*
|
|
42
|
+
* @param code - The generated TypeScript code.
|
|
43
|
+
* @returns The formatted TypeScript code.
|
|
44
|
+
*/
|
|
45
|
+
declare function formatTypes(code?: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Emits TypeScript declaration types for the provided files using the given TypeScript configuration.
|
|
48
|
+
*
|
|
49
|
+
* @param context - The context containing options and environment paths.
|
|
50
|
+
* @param files - The list of files to generate types for.
|
|
51
|
+
* @returns A promise that resolves to the generated TypeScript declaration types.
|
|
52
|
+
*/
|
|
53
|
+
declare function emitBuiltinTypes<TContext extends Context>(context: TContext, files: string[]): Promise<{
|
|
54
|
+
code: string;
|
|
55
|
+
directives: string[];
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Generate the Powerlines TypeScript declaration file
|
|
59
|
+
*
|
|
60
|
+
* @param context - The execution context for generating the TypeScript declaration file, which provides access to the project configuration, environment, and utility functions for performing the generation. The context is used to manage the state and behavior of the generation process, allowing for hooks to be called at different stages and for environment-specific configurations to be applied.
|
|
61
|
+
* @param env - The environment context to use for generating the TypeScript declaration file
|
|
62
|
+
*/
|
|
63
|
+
declare function handleTypes<TResolvedConfig extends ResolvedConfig, TSystemContext = unknown>(context: ExecutionContext<TResolvedConfig, TSystemContext>, env: EnvironmentContext<TResolvedConfig, TSystemContext>): Promise<void>;
|
|
64
|
+
declare type __ΩTypegenContext = any[];
|
|
65
|
+
//#endregion
|
|
66
|
+
export { TypegenContext, __ΩTypegenContext, emitBuiltinTypes, formatTypes, handleTypes };
|
|
67
|
+
//# sourceMappingURL=generate-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-types.d.cts","names":[],"sources":["../../src/lib/generate-types.ts"],"mappings":";;;;;UA2CU,qBAAA;EACR,IAAA;EACA,KAAA;EACA,OAAA;EACA,IAAA;AAAA;AAAA,UAGQ,eAAA;EACR,IAAA;EACA,UAAA,GAAa,qBAAA;EACb,GAAA;AAAA;AAAA,UAGQ,qBAAA,SAA8B,eAAA;EACtC,IAAA;EACA,OAAA;AAAA;AAAA,UAGQ,qBAAA,SAA8B,eAAA;EACtC,IAAA;EACA,QAAA;EACA,OAAA;AAAA;AAAA,UAGQ,iBAAA;EACR,IAAA;EACA,IAAA;EACA,UAAA,EAAY,UAAA;EACZ,OAAA;EACA,OAAA,GAAU,qBAAA;EACV,OAAA,EAAS,qBAAA;AAAA;AAAA,UAGM,cAAA;EACf,OAAA,EAAS,OAAA;EACT,OAAA,EAAS,GAAA;EACT,OAAA,EAAS,iBAAA;AAAA;;;;;;;iBASK,WAAA,CAAY,IAAA;;AAxBnB;;;;;;iBAwWa,gBAAA,kBAAkC,OAAA,CAAA,CACtD,OAAA,EAAS,QAAA,EACT,KAAA,aACC,OAAA;EAAU,IAAA;EAAc,UAAA;AAAA;;;;;;;iBAsWL,WAAA,yBACI,cAAA,2BAAA,CAGxB,OAAA,EAAS,gBAAA,CAAiB,eAAA,EAAiB,cAAA,GAC3C,GAAA,EAAK,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IAAe,OAAA;AAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Context, EnvironmentContext, ExecutionContext } from "../types/context.mjs";
|
|
2
|
+
import { ResolvedConfig } from "../types/config.mjs";
|
|
3
|
+
import { SourceFile } from "ts-morph";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/generate-types.d.ts
|
|
6
|
+
interface ModuleExportSpecifier {
|
|
7
|
+
name: string;
|
|
8
|
+
alias?: string;
|
|
9
|
+
default?: boolean;
|
|
10
|
+
type?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ModuleReference {
|
|
13
|
+
name?: string;
|
|
14
|
+
specifiers?: ModuleExportSpecifier[];
|
|
15
|
+
all?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface ImportModuleReference extends ModuleReference {
|
|
18
|
+
name: string;
|
|
19
|
+
ambient?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ExportModuleReference extends ModuleReference {
|
|
22
|
+
text: string;
|
|
23
|
+
fullText: string;
|
|
24
|
+
comment?: string;
|
|
25
|
+
}
|
|
26
|
+
interface ModuleDeclaration {
|
|
27
|
+
name: string;
|
|
28
|
+
text: string;
|
|
29
|
+
sourceFile: SourceFile;
|
|
30
|
+
comment?: string;
|
|
31
|
+
exports: (ExportModuleReference | string)[];
|
|
32
|
+
imports: ImportModuleReference[];
|
|
33
|
+
}
|
|
34
|
+
interface TypegenContext {
|
|
35
|
+
context: Context;
|
|
36
|
+
emitted: Map<string, string>;
|
|
37
|
+
modules: ModuleDeclaration[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Formats the generated TypeScript types source code.
|
|
41
|
+
*
|
|
42
|
+
* @param code - The generated TypeScript code.
|
|
43
|
+
* @returns The formatted TypeScript code.
|
|
44
|
+
*/
|
|
45
|
+
declare function formatTypes(code?: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Emits TypeScript declaration types for the provided files using the given TypeScript configuration.
|
|
48
|
+
*
|
|
49
|
+
* @param context - The context containing options and environment paths.
|
|
50
|
+
* @param files - The list of files to generate types for.
|
|
51
|
+
* @returns A promise that resolves to the generated TypeScript declaration types.
|
|
52
|
+
*/
|
|
53
|
+
declare function emitBuiltinTypes<TContext extends Context>(context: TContext, files: string[]): Promise<{
|
|
54
|
+
code: string;
|
|
55
|
+
directives: string[];
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Generate the Powerlines TypeScript declaration file
|
|
59
|
+
*
|
|
60
|
+
* @param context - The execution context for generating the TypeScript declaration file, which provides access to the project configuration, environment, and utility functions for performing the generation. The context is used to manage the state and behavior of the generation process, allowing for hooks to be called at different stages and for environment-specific configurations to be applied.
|
|
61
|
+
* @param env - The environment context to use for generating the TypeScript declaration file
|
|
62
|
+
*/
|
|
63
|
+
declare function handleTypes<TResolvedConfig extends ResolvedConfig, TSystemContext = unknown>(context: ExecutionContext<TResolvedConfig, TSystemContext>, env: EnvironmentContext<TResolvedConfig, TSystemContext>): Promise<void>;
|
|
64
|
+
declare type __ΩTypegenContext = any[];
|
|
65
|
+
//#endregion
|
|
66
|
+
export { TypegenContext, __ΩTypegenContext, emitBuiltinTypes, formatTypes, handleTypes };
|
|
67
|
+
//# sourceMappingURL=generate-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-types.d.mts","names":[],"sources":["../../src/lib/generate-types.ts"],"mappings":";;;;;UA2CU,qBAAA;EACR,IAAA;EACA,KAAA;EACA,OAAA;EACA,IAAA;AAAA;AAAA,UAGQ,eAAA;EACR,IAAA;EACA,UAAA,GAAa,qBAAA;EACb,GAAA;AAAA;AAAA,UAGQ,qBAAA,SAA8B,eAAA;EACtC,IAAA;EACA,OAAA;AAAA;AAAA,UAGQ,qBAAA,SAA8B,eAAA;EACtC,IAAA;EACA,QAAA;EACA,OAAA;AAAA;AAAA,UAGQ,iBAAA;EACR,IAAA;EACA,IAAA;EACA,UAAA,EAAY,UAAA;EACZ,OAAA;EACA,OAAA,GAAU,qBAAA;EACV,OAAA,EAAS,qBAAA;AAAA;AAAA,UAGM,cAAA;EACf,OAAA,EAAS,OAAA;EACT,OAAA,EAAS,GAAA;EACT,OAAA,EAAS,iBAAA;AAAA;;;;;;;iBASK,WAAA,CAAY,IAAA;;AAxBnB;;;;;;iBAwWa,gBAAA,kBAAkC,OAAA,CAAA,CACtD,OAAA,EAAS,QAAA,EACT,KAAA,aACC,OAAA;EAAU,IAAA;EAAc,UAAA;AAAA;;;;;;;iBAsWL,WAAA,yBACI,cAAA,2BAAA,CAGxB,OAAA,EAAS,gBAAA,CAAiB,eAAA,EAAiB,cAAA,GAC3C,GAAA,EAAK,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IAAe,OAAA;AAAA"}
|