@powerlines/core 0.48.22 → 0.48.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +8 -0
- package/dist/constants/api.cjs +8 -0
- package/dist/constants/api.d.mts +2 -0
- package/dist/constants/api.d.mts.map +1 -1
- package/dist/constants/api.mjs +8 -0
- package/dist/constants/api.mjs.map +1 -1
- package/dist/constants/commands.cjs +8 -0
- package/dist/constants/commands.d.mts +2 -0
- package/dist/constants/commands.d.mts.map +1 -1
- package/dist/constants/commands.mjs +8 -0
- package/dist/constants/commands.mjs.map +1 -1
- package/dist/constants/devtools.cjs +8 -0
- package/dist/constants/devtools.d.mts +2 -0
- package/dist/constants/devtools.d.mts.map +1 -1
- package/dist/constants/devtools.mjs +8 -0
- package/dist/constants/devtools.mjs.map +1 -1
- package/dist/constants/environments.cjs +8 -0
- package/dist/constants/environments.d.mts +2 -0
- package/dist/constants/environments.d.mts.map +1 -1
- package/dist/constants/environments.mjs +8 -0
- package/dist/constants/environments.mjs.map +1 -1
- package/dist/constants/extensions.cjs +8 -0
- package/dist/constants/extensions.d.mts +2 -0
- package/dist/constants/extensions.d.mts.map +1 -1
- package/dist/constants/extensions.mjs +8 -0
- package/dist/constants/extensions.mjs.map +1 -1
- package/dist/constants/fs.cjs +8 -0
- package/dist/constants/fs.d.mts +2 -0
- package/dist/constants/fs.d.mts.map +1 -1
- package/dist/constants/fs.mjs +8 -0
- package/dist/constants/fs.mjs.map +1 -1
- package/dist/constants/hooks.cjs +8 -0
- package/dist/constants/hooks.d.mts +2 -0
- package/dist/constants/hooks.d.mts.map +1 -1
- package/dist/constants/hooks.mjs +8 -0
- package/dist/constants/hooks.mjs.map +1 -1
- package/dist/constants/index.cjs +8 -0
- package/dist/constants/index.d.mts +2 -0
- package/dist/constants/index.mjs +8 -0
- package/dist/constants/log-level.cjs +8 -0
- package/dist/constants/log-level.d.mts +2 -0
- package/dist/constants/log-level.d.mts.map +1 -1
- package/dist/constants/log-level.mjs +8 -0
- package/dist/constants/log-level.mjs.map +1 -1
- package/dist/constants/meta.cjs +8 -0
- package/dist/constants/meta.d.mts +2 -0
- package/dist/constants/meta.d.mts.map +1 -1
- package/dist/constants/meta.mjs +8 -0
- package/dist/constants/meta.mjs.map +1 -1
- package/dist/constants/plugin.cjs +8 -0
- package/dist/constants/plugin.d.mts +2 -0
- package/dist/constants/plugin.d.mts.map +1 -1
- package/dist/constants/plugin.mjs +8 -0
- package/dist/constants/plugin.mjs.map +1 -1
- package/dist/context/base-context.cjs +8 -0
- package/dist/context/base-context.d.mts +2 -0
- package/dist/context/base-context.d.mts.map +1 -1
- package/dist/context/base-context.mjs +8 -0
- package/dist/context/base-context.mjs.map +1 -1
- package/dist/context/context.cjs +8 -0
- package/dist/context/context.d.mts +2 -0
- package/dist/context/context.d.mts.map +1 -1
- package/dist/context/context.mjs +8 -0
- package/dist/context/context.mjs.map +1 -1
- package/dist/context/environment-context.cjs +8 -0
- package/dist/context/environment-context.d.mts +2 -0
- package/dist/context/environment-context.d.mts.map +1 -1
- package/dist/context/environment-context.mjs +8 -0
- package/dist/context/environment-context.mjs.map +1 -1
- package/dist/context/execution-context.cjs +8 -0
- package/dist/context/execution-context.d.mts +2 -0
- package/dist/context/execution-context.d.mts.map +1 -1
- package/dist/context/execution-context.mjs +8 -0
- package/dist/context/execution-context.mjs.map +1 -1
- package/dist/context/index.cjs +8 -0
- package/dist/context/index.d.mts +2 -0
- package/dist/context/index.mjs +8 -0
- package/dist/context/plugin-context.cjs +8 -0
- package/dist/context/plugin-context.d.mts +2 -0
- package/dist/context/plugin-context.d.mts.map +1 -1
- package/dist/context/plugin-context.mjs +8 -0
- package/dist/context/plugin-context.mjs.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +8 -0
- package/dist/lib/config.cjs +8 -0
- package/dist/lib/config.d.mts +2 -0
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs +8 -0
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/context-helpers.cjs +8 -0
- package/dist/lib/context-helpers.d.mts +2 -0
- package/dist/lib/context-helpers.d.mts.map +1 -1
- package/dist/lib/context-helpers.mjs +8 -0
- package/dist/lib/context-helpers.mjs.map +1 -1
- package/dist/lib/entry.cjs +8 -0
- package/dist/lib/entry.d.mts +2 -0
- package/dist/lib/entry.d.mts.map +1 -1
- package/dist/lib/entry.mjs +8 -0
- package/dist/lib/entry.mjs.map +1 -1
- package/dist/lib/environment.cjs +8 -0
- package/dist/lib/environment.d.mts +2 -0
- package/dist/lib/environment.d.mts.map +1 -1
- package/dist/lib/environment.mjs +8 -0
- package/dist/lib/environment.mjs.map +1 -1
- package/dist/lib/events.cjs +8 -0
- package/dist/lib/events.d.mts +2 -0
- package/dist/lib/events.d.mts.map +1 -1
- package/dist/lib/events.mjs +8 -0
- package/dist/lib/events.mjs.map +1 -1
- package/dist/lib/generate-types.cjs +8 -0
- package/dist/lib/generate-types.d.mts +2 -0
- package/dist/lib/generate-types.d.mts.map +1 -1
- package/dist/lib/generate-types.mjs +8 -0
- package/dist/lib/generate-types.mjs.map +1 -1
- package/dist/lib/hooks.cjs +8 -0
- package/dist/lib/hooks.d.mts +2 -0
- package/dist/lib/hooks.d.mts.map +1 -1
- package/dist/lib/hooks.mjs +8 -0
- package/dist/lib/hooks.mjs.map +1 -1
- package/dist/lib/index.cjs +8 -0
- package/dist/lib/index.d.mts +2 -0
- package/dist/lib/index.mjs +8 -0
- package/dist/lib/install-dependencies.cjs +8 -0
- package/dist/lib/install-dependencies.d.mts +2 -0
- package/dist/lib/install-dependencies.d.mts.map +1 -1
- package/dist/lib/install-dependencies.mjs +8 -0
- package/dist/lib/install-dependencies.mjs.map +1 -1
- package/dist/lib/meta.cjs +8 -0
- package/dist/lib/meta.d.mts +2 -0
- package/dist/lib/meta.d.mts.map +1 -1
- package/dist/lib/meta.mjs +8 -0
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/plugins.cjs +8 -0
- package/dist/lib/plugins.d.mts +2 -0
- package/dist/lib/plugins.d.mts.map +1 -1
- package/dist/lib/plugins.mjs +8 -0
- package/dist/lib/plugins.mjs.map +1 -1
- package/dist/lib/resolver.cjs +8 -0
- package/dist/lib/resolver.d.mts +2 -0
- package/dist/lib/resolver.d.mts.map +1 -1
- package/dist/lib/resolver.mjs +8 -0
- package/dist/lib/resolver.mjs.map +1 -1
- package/dist/lib/schemas.cjs +8 -0
- package/dist/lib/schemas.d.mts +2 -0
- package/dist/lib/schemas.mjs +8 -0
- package/dist/lib/streaming-channel.cjs +8 -0
- package/dist/lib/streaming-channel.d.mts +2 -0
- package/dist/lib/streaming-channel.d.mts.map +1 -1
- package/dist/lib/streaming-channel.mjs +8 -0
- package/dist/lib/streaming-channel.mjs.map +1 -1
- package/dist/lib/typescript/index.cjs +8 -0
- package/dist/lib/typescript/index.d.mts +2 -0
- package/dist/lib/typescript/index.mjs +8 -0
- package/dist/lib/typescript/ts-morph.cjs +8 -0
- package/dist/lib/typescript/ts-morph.d.mts +2 -0
- package/dist/lib/typescript/ts-morph.d.mts.map +1 -1
- package/dist/lib/typescript/ts-morph.mjs +8 -0
- package/dist/lib/typescript/ts-morph.mjs.map +1 -1
- package/dist/lib/typescript/tsconfig.cjs +8 -0
- package/dist/lib/typescript/tsconfig.d.mts +2 -0
- package/dist/lib/typescript/tsconfig.d.mts.map +1 -1
- package/dist/lib/typescript/tsconfig.mjs +8 -0
- package/dist/lib/typescript/tsconfig.mjs.map +1 -1
- package/dist/lib/unplugin/helpers.cjs +8 -0
- package/dist/lib/unplugin/helpers.d.mts +2 -0
- package/dist/lib/unplugin/helpers.d.mts.map +1 -1
- package/dist/lib/unplugin/helpers.mjs +8 -0
- package/dist/lib/unplugin/helpers.mjs.map +1 -1
- package/dist/lib/unplugin/index.cjs +8 -0
- package/dist/lib/unplugin/index.d.mts +2 -0
- package/dist/lib/unplugin/index.mjs +8 -0
- package/dist/lib/unplugin/module-resolution.cjs +8 -0
- package/dist/lib/unplugin/module-resolution.d.mts +2 -0
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -1
- package/dist/lib/unplugin/module-resolution.mjs +8 -0
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +8 -0
- package/dist/lib/unplugin/plugin.d.mts +2 -0
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs +8 -0
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/file-header.cjs +8 -0
- package/dist/lib/utilities/file-header.d.mts +2 -0
- package/dist/lib/utilities/file-header.d.mts.map +1 -1
- package/dist/lib/utilities/file-header.mjs +8 -0
- package/dist/lib/utilities/file-header.mjs.map +1 -1
- package/dist/lib/utilities/format.cjs +8 -0
- package/dist/lib/utilities/format.d.mts +2 -0
- package/dist/lib/utilities/format.d.mts.map +1 -1
- package/dist/lib/utilities/format.mjs +8 -0
- package/dist/lib/utilities/format.mjs.map +1 -1
- package/dist/lib/utilities/index.cjs +8 -0
- package/dist/lib/utilities/index.d.mts +2 -0
- package/dist/lib/utilities/index.mjs +8 -0
- package/dist/lib/utilities/source-file.cjs +8 -0
- package/dist/lib/utilities/source-file.d.mts +2 -0
- package/dist/lib/utilities/source-file.d.mts.map +1 -1
- package/dist/lib/utilities/source-file.mjs +8 -0
- package/dist/lib/utilities/source-file.mjs.map +1 -1
- package/dist/lib/utilities/source-map.cjs +8 -0
- package/dist/lib/utilities/source-map.d.mts +2 -0
- package/dist/lib/utilities/source-map.d.mts.map +1 -1
- package/dist/lib/utilities/source-map.mjs +8 -0
- package/dist/lib/utilities/source-map.mjs.map +1 -1
- package/dist/lib/utilities/write-file.cjs +8 -0
- package/dist/lib/utilities/write-file.d.mts +2 -0
- package/dist/lib/utilities/write-file.d.mts.map +1 -1
- package/dist/lib/utilities/write-file.mjs +8 -0
- package/dist/lib/utilities/write-file.mjs.map +1 -1
- package/dist/lib/vfs.cjs +8 -0
- package/dist/lib/vfs.d.mts +2 -0
- package/dist/lib/vfs.d.mts.map +1 -1
- package/dist/lib/vfs.mjs +8 -0
- package/dist/lib/vfs.mjs.map +1 -1
- package/dist/plugin-base.cjs +8 -0
- package/dist/plugin-base.d.mts +2 -0
- package/dist/plugin-base.d.mts.map +1 -1
- package/dist/plugin-base.mjs +8 -0
- package/dist/plugin-base.mjs.map +1 -1
- package/dist/plugin-utils/build-helpers.cjs +8 -0
- package/dist/plugin-utils/build-helpers.d.mts +2 -0
- package/dist/plugin-utils/build-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/build-helpers.mjs +8 -0
- package/dist/plugin-utils/build-helpers.mjs.map +1 -1
- package/dist/plugin-utils/combine-plugins.cjs +8 -0
- package/dist/plugin-utils/combine-plugins.d.mts +2 -0
- package/dist/plugin-utils/combine-plugins.d.mts.map +1 -1
- package/dist/plugin-utils/combine-plugins.mjs +8 -0
- package/dist/plugin-utils/combine-plugins.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +8 -0
- package/dist/plugin-utils/context-helpers.d.mts +2 -0
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +8 -0
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/docs-helper.cjs +8 -0
- package/dist/plugin-utils/docs-helper.d.mts +2 -0
- package/dist/plugin-utils/docs-helper.d.mts.map +1 -1
- package/dist/plugin-utils/docs-helper.mjs +8 -0
- package/dist/plugin-utils/docs-helper.mjs.map +1 -1
- package/dist/plugin-utils/enable-plugin.cjs +8 -0
- package/dist/plugin-utils/enable-plugin.d.mts +2 -0
- package/dist/plugin-utils/enable-plugin.d.mts.map +1 -1
- package/dist/plugin-utils/enable-plugin.mjs +8 -0
- package/dist/plugin-utils/enable-plugin.mjs.map +1 -1
- package/dist/plugin-utils/extend.cjs +8 -0
- package/dist/plugin-utils/extend.d.mts +2 -0
- package/dist/plugin-utils/extend.d.mts.map +1 -1
- package/dist/plugin-utils/extend.mjs +8 -0
- package/dist/plugin-utils/extend.mjs.map +1 -1
- package/dist/plugin-utils/filter.cjs +8 -0
- package/dist/plugin-utils/filter.d.mts +2 -0
- package/dist/plugin-utils/filter.d.mts.map +1 -1
- package/dist/plugin-utils/filter.mjs +8 -0
- package/dist/plugin-utils/filter.mjs.map +1 -1
- package/dist/plugin-utils/format-package-json.cjs +8 -0
- package/dist/plugin-utils/format-package-json.d.mts +2 -0
- package/dist/plugin-utils/format-package-json.d.mts.map +1 -1
- package/dist/plugin-utils/format-package-json.mjs +8 -0
- package/dist/plugin-utils/format-package-json.mjs.map +1 -1
- package/dist/plugin-utils/format.cjs +8 -0
- package/dist/plugin-utils/format.d.mts +2 -0
- package/dist/plugin-utils/format.d.mts.map +1 -1
- package/dist/plugin-utils/format.mjs +8 -0
- package/dist/plugin-utils/format.mjs.map +1 -1
- package/dist/plugin-utils/get-config-path.cjs +8 -0
- package/dist/plugin-utils/get-config-path.d.mts +2 -0
- package/dist/plugin-utils/get-config-path.d.mts.map +1 -1
- package/dist/plugin-utils/get-config-path.mjs +8 -0
- package/dist/plugin-utils/get-config-path.mjs.map +1 -1
- package/dist/plugin-utils/helpers.cjs +8 -0
- package/dist/plugin-utils/helpers.d.mts +2 -0
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs +8 -0
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +8 -0
- package/dist/plugin-utils/index.d.mts +2 -0
- package/dist/plugin-utils/index.mjs +8 -0
- package/dist/plugin-utils/install.cjs +8 -0
- package/dist/plugin-utils/install.d.mts +2 -0
- package/dist/plugin-utils/install.d.mts.map +1 -1
- package/dist/plugin-utils/install.mjs +8 -0
- package/dist/plugin-utils/install.mjs.map +1 -1
- package/dist/plugin-utils/logging.cjs +8 -0
- package/dist/plugin-utils/logging.d.mts +2 -0
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +8 -0
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/plugin-utils/merge.cjs +8 -0
- package/dist/plugin-utils/merge.d.mts +2 -0
- package/dist/plugin-utils/merge.d.mts.map +1 -1
- package/dist/plugin-utils/merge.mjs +8 -0
- package/dist/plugin-utils/merge.mjs.map +1 -1
- package/dist/plugin-utils/modules.cjs +8 -0
- package/dist/plugin-utils/modules.d.mts +2 -0
- package/dist/plugin-utils/modules.d.mts.map +1 -1
- package/dist/plugin-utils/modules.mjs +8 -0
- package/dist/plugin-utils/modules.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +8 -0
- package/dist/plugin-utils/paths.d.mts +2 -0
- package/dist/plugin-utils/paths.d.mts.map +1 -1
- package/dist/plugin-utils/paths.mjs +8 -0
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/plugin-utils/virtual.cjs +8 -0
- package/dist/plugin-utils/virtual.d.mts +2 -0
- package/dist/plugin-utils/virtual.d.mts.map +1 -1
- package/dist/plugin-utils/virtual.mjs +8 -0
- package/dist/plugin-utils/virtual.mjs.map +1 -1
- package/dist/schemas/fs.cjs +8 -0
- package/dist/schemas/fs.d.mts +2 -0
- package/dist/schemas/fs.d.mts.map +1 -1
- package/dist/schemas/fs.mjs +8 -0
- package/dist/schemas/fs.mjs.map +1 -1
- package/dist/storage/base.cjs +8 -0
- package/dist/storage/base.d.mts +2 -0
- package/dist/storage/base.d.mts.map +1 -1
- package/dist/storage/base.mjs +8 -0
- package/dist/storage/base.mjs.map +1 -1
- package/dist/storage/file-system.cjs +8 -0
- package/dist/storage/file-system.d.mts +2 -0
- package/dist/storage/file-system.d.mts.map +1 -1
- package/dist/storage/file-system.mjs +8 -0
- package/dist/storage/file-system.mjs.map +1 -1
- package/dist/storage/helpers.cjs +8 -0
- package/dist/storage/helpers.d.mts +2 -0
- package/dist/storage/helpers.d.mts.map +1 -1
- package/dist/storage/helpers.mjs +8 -0
- package/dist/storage/helpers.mjs.map +1 -1
- package/dist/storage/index.cjs +8 -0
- package/dist/storage/index.d.mts +2 -0
- package/dist/storage/index.mjs +8 -0
- package/dist/storage/virtual.cjs +8 -0
- package/dist/storage/virtual.d.mts +2 -0
- package/dist/storage/virtual.d.mts.map +1 -1
- package/dist/storage/virtual.mjs +8 -0
- package/dist/storage/virtual.mjs.map +1 -1
- package/dist/types/api.d.cts +3 -3
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +5 -3
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/config.d.mts +2 -0
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.mts +2 -0
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/fs.d.mts +2 -0
- package/dist/types/fs.d.mts.map +1 -1
- package/dist/types/hooks.d.mts +2 -0
- package/dist/types/hooks.d.mts.map +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.mts +3 -1
- package/dist/types/logging.d.mts +2 -0
- package/dist/types/logging.d.mts.map +1 -1
- package/dist/types/plugin.d.mts +2 -0
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/tsconfig.d.mts +2 -0
- package/dist/types/tsconfig.d.mts.map +1 -1
- package/dist/types/unplugin.d.mts +2 -0
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +7 -7
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { UnpluginBuilderVariant } from "../../types/unplugin.mjs";
|
|
2
4
|
import { UnresolvedContext } from "../../types/context.mjs";
|
|
3
5
|
import { UnpluginBuildContext } from "unplugin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"mappings":";;;;;;;;;;;;;;iBAgCgB,eAAA,mBACI,iBAAA,GAAoB,oBAAA,oBACpB,iBAAA,GAAoB,oBAAA,CAAA,CACtC,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,SAAA,GAAY,SAAA,GAAY,SAAA;;;AAHzD;;;;iBAagB,wBAAA,CACd,GAAA,YACC,GAAA,IAAO,sBAAsB"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { UNPLUGIN_BUILDER_VARIANTS } from "../../constants/plugin.mjs";
|
|
2
10
|
import { defu as defu$1 } from "defu";
|
|
3
11
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":["defu"],"sources":["../../../src/lib/unplugin/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { UnpluginBuildContext } from \"unplugin\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"../../constants/plugin\";\nimport type { UnresolvedContext } from \"../../types/context\";\nimport type { UnpluginBuilderVariant } from \"../../types/unplugin\";\n\n/**\n * Merges a base plugin context with an unplugin context, combining their properties.\n *\n * @param contextA - The base plugin context to merge into.\n * @param contextB - The unplugin context to merge from.\n * @returns The merged context.\n */\nexport function combineContexts<\n TContextA extends UnresolvedContext | UnpluginBuildContext,\n TContextB extends UnresolvedContext | UnpluginBuildContext\n>(contextA: TContextA, contextB: TContextB): TContextA & TContextB {\n return defu(contextA, contextB) as TContextA & TContextB;\n}\n\n/**\n * Checks if a value is a valid UnpluginBuilderVariant.\n *\n * @param str - The value to check.\n * @returns True if the value is a UnpluginBuilderVariant, false otherwise.\n */\nexport function isUnpluginBuilderVariant(\n str: unknown\n): str is UnpluginBuilderVariant {\n return (\n isSetString(str) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(str as UnpluginBuilderVariant)\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":["defu"],"sources":["../../../src/lib/unplugin/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { UnpluginBuildContext } from \"unplugin\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"../../constants/plugin\";\nimport type { UnresolvedContext } from \"../../types/context\";\nimport type { UnpluginBuilderVariant } from \"../../types/unplugin\";\n\n/**\n * Merges a base plugin context with an unplugin context, combining their properties.\n *\n * @param contextA - The base plugin context to merge into.\n * @param contextB - The unplugin context to merge from.\n * @returns The merged context.\n */\nexport function combineContexts<\n TContextA extends UnresolvedContext | UnpluginBuildContext,\n TContextB extends UnresolvedContext | UnpluginBuildContext\n>(contextA: TContextA, contextB: TContextB): TContextA & TContextB {\n return defu(contextA, contextB) as TContextA & TContextB;\n}\n\n/**\n * Checks if a value is a valid UnpluginBuilderVariant.\n *\n * @param str - The value to check.\n * @returns True if the value is a UnpluginBuilderVariant, false otherwise.\n */\nexport function isUnpluginBuilderVariant(\n str: unknown\n): str is UnpluginBuilderVariant {\n return (\n isSetString(str) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(str as UnpluginBuilderVariant)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,gBAGd,UAAqB,UAA4C;CACjE,OAAOA,OAAK,UAAU,QAAQ;AAChC;;;;;;;AAQA,SAAgB,yBACd,KAC+B;CAC/B,OACE,YAAY,GAAG,KACf,0BAA0B,SAAS,GAA6B;AAEpE"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_lib_unplugin_helpers = require('./helpers.cjs');
|
|
3
11
|
const require_lib_unplugin_module_resolution = require('./module-resolution.cjs');
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { combineContexts, isUnpluginBuilderVariant } from "./helpers.mjs";
|
|
2
4
|
import { CreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
|
|
3
5
|
import { CreateUnpluginOptions, CreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./plugin.mjs";
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { combineContexts, isUnpluginBuilderVariant } from "./helpers.mjs";
|
|
2
10
|
import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
|
|
3
11
|
import { createUnplugin, createUnpluginResolver } from "./plugin.mjs";
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
const require_plugin_utils_virtual = require('../../plugin-utils/virtual.cjs');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;;;UAmCiB,8CAAA;;;;;;;;;;EAUf,MAAA;EAV6D;;;;;;EAkB7D,SAAA,GAAY,OAAO,CAAC,cAAA;AAAA;AAAc;AAgBpC;;;;;;;;;;;;AAhBoC,iBAgBpB,uCAAA,kBACG,iBAAA,CAAA,CAEjB,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, removeVirtualPrefix } from "../../plugin-utils/virtual.mjs";
|
|
2
10
|
import "../../plugin-utils/index.mjs";
|
|
3
11
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
@@ -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 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":"
|
|
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,CAAC,GACd;CAC7C,OAAO;EACL,MAAM,UAEJ,IACA,UACA,OAEI,EAAE,SAAS,MAAM,GAC+B;GACpD,MAAM,eAAe,oBAAoB,EAAE;GAC3C,MAAM,qBAAqB,WACvB,oBAAoB,QAAQ,IAC5B;GAEJ,IAAI,SAAS,MAAM,QAAQ,SACzB,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;GACT,GACA,cACA,oBACA,IACF;GACA,IAAI,YAAY,MAAM,GACpB,OAAO;QACF,IAAI,YAAY,MAAM,GAC3B,OAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,EAAE,IAC1B,OAAO;GACf;GAGF,SAAS,MAAM,QAAQ,SACrB,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;GACT,GACA,cACA,oBACA,IACF;GACA,IAAI,YAAY,MAAM,GACpB,OAAO;QACF,IAAI,YAAY,MAAM,GAC3B,OAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,EAAE,IAC1B,OAAO;GACf;GAGF,SAAS,MAAM,QAAQ,QACrB,cACA,oBACA,KAAK,QAAQ,aAAa,CAAC,GAAG;IAC5B,QAAQ;IACR,GAAG;GACL,CAAC,CACH;GACA,IAAI,YAAY,MAAM,GACpB,OAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,EAAE,IAC1B,OAAO;GACf;GAGF,SAAS,MAAM,QAAQ,SACrB,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;GACT,GACA,cACA,oBACA,IACF;GACA,IAAI,YAAY,MAAM,GACpB,OAAO;QACF,IAAI,YAAY,MAAM,GAC3B,OAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,EAAE,IAC1B,OAAO;GACf;GAGF,OAAO;EACT;EACA,MAAM;GACJ,QACE,QAAQ,WAAW,QACf,EACE,IAAI,4BACN,IACA;GACN,MAAM,QAEJ,IACwC;IACxC,MAAM,eAAe,oBAAoB,EAAE;IAE3C,IAAI,SAAS,MAAM,QAAQ,SACzB,QACA;KACE,YAAY;KACZ,QAAQ;KACR,OAAO;IACT,GACA,YACF;IACA,IAAI,QACF,OAAO;IAGT,SAAS,MAAM,QAAQ,SACrB,QACA;KACE,YAAY;KACZ,QAAQ;KACR,OAAO;IACT,GACA,YACF;IACA,IAAI,QACF,OAAO;IAGT,SAAS,MAAM,QAAQ,KAAK,YAAY;IACxC,IAAI,QACF,OAAO;IAGT,OAAO,QAAQ,SACb,QACA;KACE,YAAY;KACZ,QAAQ;KACR,OAAO;IACT,GACA,YACF;GACF;EACF;CACF;AACF"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_plugin_utils_virtual = require('../../plugin-utils/virtual.cjs');
|
|
3
11
|
require('../../plugin-utils/index.cjs');
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { UnpluginOptions } from "../../types/unplugin.mjs";
|
|
2
4
|
import { PluginContext, UnresolvedContext } from "../../types/context.mjs";
|
|
3
5
|
import { CreateUnpluginModuleResolutionFunctionsOptions } from "./module-resolution.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"mappings":";;;;;;;UAoCiB,6BAAA,SAAsC,8CAA8C;;;;;;;;;EASnG,IAAA;EATe;;;;;EAgBf,kBAAA;AAAA;;AAAkB;AASpB;;;;iBAAgB,sBAAA,kBAAwC,iBAAA,CAAA,CACtD,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,6BAAA,SACF,eAAA,CAAgB,QAAA;AAAA,UA8BR,qBAAA,SAA8B,6BAA6B;;;;;;;iBAQ5D,cAAA,kBAAgC,aAAA,GAAgB,aAAA,CAAA,CAC9D,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,qBAAA,SACF,eAAA,CAAgB,QAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { removeVirtualPrefix } from "../../plugin-utils/virtual.mjs";
|
|
2
10
|
import "../../plugin-utils/index.mjs";
|
|
3
11
|
import { combineContexts } from "./helpers.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/lib/unplugin/plugin.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 { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { removeVirtualPrefix } from \"../../plugin-utils\";\nimport type { PluginContext, UnresolvedContext } from \"../../types/context\";\nimport type { UnpluginOptions } from \"../../types/unplugin\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport {\n createUnpluginModuleResolutionFunctions,\n CreateUnpluginModuleResolutionFunctionsOptions\n} from \"./module-resolution\";\n\nexport interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A name to use for the unplugin instance. This is used for logging and to generate the plugin name. It does not affect the functionality of the plugin.\n *\n * @remarks\n * If not provided, the plugin will be named \"powerlines\". If provided, the plugin will be named `${name} - Powerlines` (e.g., \"MyPlugin - Powerlines\").\n *\n * @defaultValue \"powerlines\"\n */\n name?: string;\n\n /**\n * Whether to silence logging for the plugin hooks. This can be useful for plugins that run frequently or have hooks that are called often, to reduce noise in the logs. When set to `true`, the plugin will not log any messages for its hooks. When set to `false` (the default), the plugin will log messages for its hooks as normal.\n *\n * @defaultValue false\n */\n silenceHookLogging?: boolean;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<TContext extends UnresolvedContext>(\n context: TContext,\n options: CreateUnpluginResolverOptions = {}\n): () => UnpluginOptions<TContext> {\n setParseImpl(context.parse);\n\n const name = options.name || \"powerlines\";\n\n const logger = context.extendLogger(\n !options.silenceHookLogging && name !== \"powerlines\" ? { source: name } : {}\n );\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n return () => ({\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n context,\n resolveId,\n load\n });\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n}\n\nexport interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n options: CreateUnpluginOptions = {}\n): () => UnpluginOptions<TContext> {\n setParseImpl(context.parse.bind(context));\n\n const name = options.name || \"powerlines\";\n\n const logger = context.extendLogger(\n !options.silenceHookLogging && name !== \"powerlines\" ? { source: name } : {}\n );\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n async function buildStart(this: UnpluginBuildContext) {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin starting...\");\n }\n\n await context.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of context.environment.selectHooks(\"transform\")) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(context, this), [\n getString(transformed),\n removeVirtualPrefix(id)\n ] as [code: string, id: string]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin finishing...\");\n }\n\n return context.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Finalizing Powerlines project output...\");\n }\n\n return context.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return () => ({\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n context,\n resolveId,\n load,\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n });\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/lib/unplugin/plugin.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 { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { removeVirtualPrefix } from \"../../plugin-utils\";\nimport type { PluginContext, UnresolvedContext } from \"../../types/context\";\nimport type { UnpluginOptions } from \"../../types/unplugin\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport {\n createUnpluginModuleResolutionFunctions,\n CreateUnpluginModuleResolutionFunctionsOptions\n} from \"./module-resolution\";\n\nexport interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A name to use for the unplugin instance. This is used for logging and to generate the plugin name. It does not affect the functionality of the plugin.\n *\n * @remarks\n * If not provided, the plugin will be named \"powerlines\". If provided, the plugin will be named `${name} - Powerlines` (e.g., \"MyPlugin - Powerlines\").\n *\n * @defaultValue \"powerlines\"\n */\n name?: string;\n\n /**\n * Whether to silence logging for the plugin hooks. This can be useful for plugins that run frequently or have hooks that are called often, to reduce noise in the logs. When set to `true`, the plugin will not log any messages for its hooks. When set to `false` (the default), the plugin will log messages for its hooks as normal.\n *\n * @defaultValue false\n */\n silenceHookLogging?: boolean;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<TContext extends UnresolvedContext>(\n context: TContext,\n options: CreateUnpluginResolverOptions = {}\n): () => UnpluginOptions<TContext> {\n setParseImpl(context.parse);\n\n const name = options.name || \"powerlines\";\n\n const logger = context.extendLogger(\n !options.silenceHookLogging && name !== \"powerlines\" ? { source: name } : {}\n );\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n return () => ({\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n context,\n resolveId,\n load\n });\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n}\n\nexport interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n options: CreateUnpluginOptions = {}\n): () => UnpluginOptions<TContext> {\n setParseImpl(context.parse.bind(context));\n\n const name = options.name || \"powerlines\";\n\n const logger = context.extendLogger(\n !options.silenceHookLogging && name !== \"powerlines\" ? { source: name } : {}\n );\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n async function buildStart(this: UnpluginBuildContext) {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin starting...\");\n }\n\n await context.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of context.environment.selectHooks(\"transform\")) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(context, this), [\n getString(transformed),\n removeVirtualPrefix(id)\n ] as [code: string, id: string]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin finishing...\");\n }\n\n return context.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Finalizing Powerlines project output...\");\n }\n\n return context.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return () => ({\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n context,\n resolveId,\n load,\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n });\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,uBACd,SACA,UAAyC,CAAC,GACT;CACjC,aAAa,QAAQ,KAAK;CAE1B,MAAM,OAAO,QAAQ,QAAQ;CAE7B,MAAM,SAAS,QAAQ,aACrB,CAAC,QAAQ,sBAAsB,SAAS,eAAe,EAAE,QAAQ,KAAK,IAAI,CAAC,CAC7E;CACA,OAAO,MAAM,gBAAgB,UAAU,IAAI,EAAE,QAAQ;CAErD,IAAI;EACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,OAAO;EAEpE,cAAc;GACZ,MACE,KAAK,YAAY,MAAM,eACnB,eACA,cAAc,UAAU,IAAI;GAClC;GACA;GACA;EACF;CACF,SAAS,OAAO;EACd,OAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EAEnE,MAAM;CACR;AACF;;;;;;;AAUA,SAAgB,eACd,SACA,UAAiC,CAAC,GACD;CACjC,aAAa,QAAQ,MAAM,KAAK,OAAO,CAAC;CAExC,MAAM,OAAO,QAAQ,QAAQ;CAE7B,MAAM,SAAS,QAAQ,aACrB,CAAC,QAAQ,sBAAsB,SAAS,eAAe,EAAE,QAAQ,KAAK,IAAI,CAAC,CAC7E;CACA,OAAO,MAAM,gBAAgB,UAAU,IAAI,EAAE,QAAQ;CAErD,IAAI;EACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,OAAO;EAEpE,eAAe,aAAuC;GACpD,IAAI,CAAC,QAAQ,oBACX,OAAO,MAAM,qCAAqC;GAGpD,MAAM,QAAQ,SAAS,cAAc,EACnC,YAAY,KACd,CAAC;EACH;EAEA,eAAe,UAEb,MACA,IAC6C;GAC7C,IAAI,cAAwC;GAE5C,KAAK,MAAM,QAAQ,QAAQ,YAAY,YAAY,WAAW,GAAG;IAC/D,MAAM,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,SAAS,IAAI,GAAG,CACvD,UAAU,WAAW,GACrB,oBAAoB,EAAE,CACxB,CAA+B;IACjC,IAAI,QACF,cAAc;GAElB;GAEA,OAAO;EACT;EAEA,eAAe,WAAoD;GACjE,IAAI,CAAC,QAAQ,oBACX,OAAO,MAAM,sCAAsC;GAGrD,OAAO,QAAQ,SAAS,YAAY,EAClC,YAAY,KACd,CAAC;EACH;EAEA,eAAe,cAA6B;GAC1C,IAAI,CAAC,QAAQ,oBACX,OAAO,MAAM,yCAAyC;GAGxD,OAAO,QAAQ,SAAS,eAAe,EACrC,YAAY,KACd,CAAC;EACH;EAEA,cAAc;GACZ,MACE,KAAK,YAAY,MAAM,eACnB,eACA,cAAc,UAAU,IAAI;GAClC;GACA;GACA;GACA;GACA;GACA;GACA;GACA,MAAM,EACJ,mBAAmB,KACrB;EACF;CACF,SAAS,OAAO;EACd,OAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EAEnE,MAAM;CACR;AACF"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
3
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-header.d.mts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-header.d.mts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"mappings":";;;;;UAqBiB,iBAAA;EACf,SAAA;EACA,cAAc;AAAA;;;;;;;AAFhB;iBAYgB,wBAAA,CACd,SAAA,YACA,SAAwB;;;AAZV;AAUhB;;;iBAegB,oBAAA,CAAqB,OAAgB,EAAP,OAAO;AAb3B;AAa1B;;;;AAAqD;AAcrD;AA3B0B,iBA2BV,aAAA,CAAc,OAAA,EAAS,OAAO,EAAE,OAAA;;;;;;;AAAc;iBAc9C,uBAAA,CACd,OAAA,EAAS,OAAA,EACT,OAAA,GAAS,iBAAsB"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
2
10
|
|
|
3
11
|
//#region src/lib/utilities/file-header.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-header.mjs","names":[],"sources":["../../../src/lib/utilities/file-header.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 { titleCase } from \"@stryke/string-format/title-case\";\nimport { Context } from \"../../types/context\";\n\nexport interface FileHeaderOptions {\n directive?: string | null;\n prettierIgnore?: boolean;\n}\n\n/**\n * Generates a file header comment with a warning about automatic overwriting.\n *\n * @param overwrite - Whether the file will be automatically overwritten. If `false`, the warning will indicate that the file will not be overwritten. If `true` or omitted, the warning will indicate that the file will be overwritten.\n * @param framework - The name of the framework to include in the warning message. Defaults to \"powerlines\".\n * @returns A string containing the file header warning message.\n */\nexport function getFileHeaderWarningText(\n overwrite = true,\n framework = \"powerlines\"\n): string {\n return overwrite !== false\n ? `Do not edit this file manually - it will be overwritten automatically. Automatic overwrites can be disabled by using the \\`output.overwrite\\` option.`\n : `This file was generated on ${new Date().toLocaleString()} - it will not be overwritten by ${titleCase(framework)} while the \\`output.overwrite\\` option is set to \\`true\\`.`;\n}\n\n/**\n * Generates a file header warning message based on the provided context.\n *\n * @param context - The Powerlines context.\n * @returns A string containing the file header warning message.\n */\nexport function getFileHeaderWarning(context: Context): string {\n return getFileHeaderWarningText(\n context.config.output?.overwrite,\n context.config.framework?.name\n );\n}\n\n/**\n * Generates a file header comment for a generated source file, including a warning about automatic overwriting.\n *\n * @param context - The Powerlines context.\n * @param comment - The comment syntax to use for the header (e.g., `//` for JavaScript/TypeScript, `#` for Python). Defaults to `//`.\n * @returns A string containing the file header comment.\n */\nexport function getFileHeader(context: Context, comment = \"//\"): string {\n return `\n${comment} Generated by ${titleCase(context.config.framework?.name) || \"Powerlines\"}\n${comment} ${getFileHeaderWarning(context)}\n`;\n}\n\n/**\n * Generates a file header comment for a generated TypeScript source file, including a warning about automatic overwriting.\n *\n * @param context - The Powerlines context.\n * @param options - Additional options for generating the file header, such as a directive to include and whether to add a Prettier ignore comment.\n * @returns A string containing the file header comment for a TypeScript file.\n */\nexport function getTypescriptFileHeader(\n context: Context,\n options: FileHeaderOptions = {}\n): string {\n const { directive = null, prettierIgnore = false } = options;\n\n return `/* eslint-disable */\n// biome-ignore lint: disable\n${prettierIgnore ? `// prettier-ignore` : \"\"}${directive ? `\\n\\n${directive}\\n` : \"\\n\"}\n${getFileHeader(context)}\n\n`;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-header.mjs","names":[],"sources":["../../../src/lib/utilities/file-header.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 { titleCase } from \"@stryke/string-format/title-case\";\nimport { Context } from \"../../types/context\";\n\nexport interface FileHeaderOptions {\n directive?: string | null;\n prettierIgnore?: boolean;\n}\n\n/**\n * Generates a file header comment with a warning about automatic overwriting.\n *\n * @param overwrite - Whether the file will be automatically overwritten. If `false`, the warning will indicate that the file will not be overwritten. If `true` or omitted, the warning will indicate that the file will be overwritten.\n * @param framework - The name of the framework to include in the warning message. Defaults to \"powerlines\".\n * @returns A string containing the file header warning message.\n */\nexport function getFileHeaderWarningText(\n overwrite = true,\n framework = \"powerlines\"\n): string {\n return overwrite !== false\n ? `Do not edit this file manually - it will be overwritten automatically. Automatic overwrites can be disabled by using the \\`output.overwrite\\` option.`\n : `This file was generated on ${new Date().toLocaleString()} - it will not be overwritten by ${titleCase(framework)} while the \\`output.overwrite\\` option is set to \\`true\\`.`;\n}\n\n/**\n * Generates a file header warning message based on the provided context.\n *\n * @param context - The Powerlines context.\n * @returns A string containing the file header warning message.\n */\nexport function getFileHeaderWarning(context: Context): string {\n return getFileHeaderWarningText(\n context.config.output?.overwrite,\n context.config.framework?.name\n );\n}\n\n/**\n * Generates a file header comment for a generated source file, including a warning about automatic overwriting.\n *\n * @param context - The Powerlines context.\n * @param comment - The comment syntax to use for the header (e.g., `//` for JavaScript/TypeScript, `#` for Python). Defaults to `//`.\n * @returns A string containing the file header comment.\n */\nexport function getFileHeader(context: Context, comment = \"//\"): string {\n return `\n${comment} Generated by ${titleCase(context.config.framework?.name) || \"Powerlines\"}\n${comment} ${getFileHeaderWarning(context)}\n`;\n}\n\n/**\n * Generates a file header comment for a generated TypeScript source file, including a warning about automatic overwriting.\n *\n * @param context - The Powerlines context.\n * @param options - Additional options for generating the file header, such as a directive to include and whether to add a Prettier ignore comment.\n * @returns A string containing the file header comment for a TypeScript file.\n */\nexport function getTypescriptFileHeader(\n context: Context,\n options: FileHeaderOptions = {}\n): string {\n const { directive = null, prettierIgnore = false } = options;\n\n return `/* eslint-disable */\n// biome-ignore lint: disable\n${prettierIgnore ? `// prettier-ignore` : \"\"}${directive ? `\\n\\n${directive}\\n` : \"\\n\"}\n${getFileHeader(context)}\n\n`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiCA,SAAgB,yBACd,YAAY,MACZ,YAAY,cACJ;CACR,OAAO,cAAc,QACjB,0JACA,+CAA8B,IAAI,KAAK,GAAE,eAAe,EAAE,mCAAmC,UAAU,SAAS,EAAE;AACxH;;;;;;;AAQA,SAAgB,qBAAqB,SAA0B;CAC7D,OAAO,yBACL,QAAQ,OAAO,QAAQ,WACvB,QAAQ,OAAO,WAAW,IAC5B;AACF;;;;;;;;AASA,SAAgB,cAAc,SAAkB,UAAU,MAAc;CACtE,OAAO;EACP,QAAQ,gBAAgB,UAAU,QAAQ,OAAO,WAAW,IAAI,KAAK,aAAa;EAClF,QAAQ,GAAG,qBAAqB,OAAO,EAAE;;AAE3C;;;;;;;;AASA,SAAgB,wBACd,SACA,UAA6B,CAAC,GACtB;CACR,MAAM,EAAE,YAAY,MAAM,iBAAiB,UAAU;CAErD,OAAO;;EAEP,iBAAiB,uBAAuB,KAAK,YAAY,OAAO,UAAU,MAAM,KAAK;EACrF,cAAc,OAAO,EAAE;;;AAGzB"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
let _stryke_path_append = require("@stryke/path/append");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.mts","names":[],"sources":["../../../src/lib/utilities/format.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"format.d.mts","names":[],"sources":["../../../src/lib/utilities/format.ts"],"mappings":";;;;;;;;;;;;;;iBAoCsB,MAAA,CACpB,OAAA,EAAS,OAAA,EACT,IAAA,UACA,IAAA,UACA,KAAA,aACC,OAAO;AALV;;;;;;;AAAA,iBAyDsB,YAAA,CAAa,OAAA,EAAS,OAAA,EAAS,IAAA,WAAY,OAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { appendPath } from "@stryke/path/append";
|
|
2
10
|
import { findFileExtension } from "@stryke/path/file-path-fns";
|
|
3
11
|
import { defu as defu$1 } from "defu";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.mjs","names":["prettier","defu"],"sources":["../../../src/lib/utilities/format.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 { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { defu } from \"defu\";\nimport { format as prettier, resolveConfig } from \"prettier\";\nimport importsPlugin from \"prettier-plugin-organize-imports\";\nimport { Context } from \"../../types/context\";\n\n/**\n * Formats code using Prettier based on the file path.\n *\n * @param context - The Powerlines context.\n * @param path - The file path to use for resolving Prettier configuration.\n * @param data - The code string to format.\n * @param force - Whether to force formatting even for output/build paths.\n * @returns A promise that resolves to the formatted code string.\n */\nexport async function format(\n context: Context,\n path: string,\n data: string,\n force = false\n): Promise<string> {\n if (\n !force &&\n ((context.config.output.copy &&\n isParentPath(\n path,\n appendPath(context.config.output.copy.path, context.config.cwd)\n )) ||\n isParentPath(\n path,\n appendPath(context.config.output.path, context.config.cwd)\n ))\n ) {\n return data;\n }\n\n let code = data;\n try {\n const resolvedConfig = await resolveConfig(path);\n if (resolvedConfig) {\n code = await prettier(\n data,\n defu(\n {\n absolutePath: path,\n ...resolvedConfig\n },\n findFileExtension(path) === \"ts\" || findFileExtension(path) === \"tsx\"\n ? { plugins: [importsPlugin] }\n : {}\n )\n );\n }\n } catch (error) {\n throw new Error(\n `Failed to format file at ${path} with Prettier: ${\n (error as Error).message\n }`,\n { cause: error }\n );\n }\n\n return code;\n}\n\n/**\n * Formats all files in a folder using Prettier based on their file paths.\n *\n * @param context - The Powerlines context.\n * @param path - The folder path containing files to format.\n * @returns A promise that resolves when all files have been formatted.\n */\nexport async function formatFolder(context: Context, path: string) {\n if (\n !context.config.output.copy ||\n (!isParentPath(\n path,\n appendPath(context.config.output.copy.path, context.config.cwd)\n ) &&\n !isParentPath(\n path,\n appendPath(context.config.output.path, context.config.cwd)\n ))\n ) {\n await Promise.allSettled(\n (await listFiles(path)).map(async file => {\n if (\n (!context.config.output.copy ||\n !isParentPath(\n file,\n appendPath(context.config.output.copy.path, context.config.cwd)\n )) &&\n !isParentPath(\n file,\n appendPath(context.config.output.path, context.config.cwd)\n )\n ) {\n const data = await context.fs.read(file);\n if (data) {\n const formatted = await format(context, file, data);\n\n return context.fs.write(file, formatted);\n }\n }\n })\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"format.mjs","names":["prettier","defu"],"sources":["../../../src/lib/utilities/format.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 { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { defu } from \"defu\";\nimport { format as prettier, resolveConfig } from \"prettier\";\nimport importsPlugin from \"prettier-plugin-organize-imports\";\nimport { Context } from \"../../types/context\";\n\n/**\n * Formats code using Prettier based on the file path.\n *\n * @param context - The Powerlines context.\n * @param path - The file path to use for resolving Prettier configuration.\n * @param data - The code string to format.\n * @param force - Whether to force formatting even for output/build paths.\n * @returns A promise that resolves to the formatted code string.\n */\nexport async function format(\n context: Context,\n path: string,\n data: string,\n force = false\n): Promise<string> {\n if (\n !force &&\n ((context.config.output.copy &&\n isParentPath(\n path,\n appendPath(context.config.output.copy.path, context.config.cwd)\n )) ||\n isParentPath(\n path,\n appendPath(context.config.output.path, context.config.cwd)\n ))\n ) {\n return data;\n }\n\n let code = data;\n try {\n const resolvedConfig = await resolveConfig(path);\n if (resolvedConfig) {\n code = await prettier(\n data,\n defu(\n {\n absolutePath: path,\n ...resolvedConfig\n },\n findFileExtension(path) === \"ts\" || findFileExtension(path) === \"tsx\"\n ? { plugins: [importsPlugin] }\n : {}\n )\n );\n }\n } catch (error) {\n throw new Error(\n `Failed to format file at ${path} with Prettier: ${\n (error as Error).message\n }`,\n { cause: error }\n );\n }\n\n return code;\n}\n\n/**\n * Formats all files in a folder using Prettier based on their file paths.\n *\n * @param context - The Powerlines context.\n * @param path - The folder path containing files to format.\n * @returns A promise that resolves when all files have been formatted.\n */\nexport async function formatFolder(context: Context, path: string) {\n if (\n !context.config.output.copy ||\n (!isParentPath(\n path,\n appendPath(context.config.output.copy.path, context.config.cwd)\n ) &&\n !isParentPath(\n path,\n appendPath(context.config.output.path, context.config.cwd)\n ))\n ) {\n await Promise.allSettled(\n (await listFiles(path)).map(async file => {\n if (\n (!context.config.output.copy ||\n !isParentPath(\n file,\n appendPath(context.config.output.copy.path, context.config.cwd)\n )) &&\n !isParentPath(\n file,\n appendPath(context.config.output.path, context.config.cwd)\n )\n ) {\n const data = await context.fs.read(file);\n if (data) {\n const formatted = await format(context, file, data);\n\n return context.fs.write(file, formatted);\n }\n }\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,eAAsB,OACpB,SACA,MACA,MACA,QAAQ,OACS;CACjB,IACE,CAAC,UACC,QAAQ,OAAO,OAAO,QACtB,aACE,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,KACA,aACE,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,IAEF,OAAO;CAGT,IAAI,OAAO;CACX,IAAI;EACF,MAAM,iBAAiB,MAAM,cAAc,IAAI;EAC/C,IAAI,gBACF,OAAO,MAAMA,SACX,MACAC,OACE;GACE,cAAc;GACd,GAAG;EACL,GACA,kBAAkB,IAAI,MAAM,QAAQ,kBAAkB,IAAI,MAAM,QAC5D,EAAE,SAAS,CAAC,aAAa,EAAE,IAC3B,CAAC,CACP,CACF;CAEJ,SAAS,OAAO;EACd,MAAM,IAAI,MACR,4BAA4B,KAAK,kBAC9B,MAAgB,WAEnB,EAAE,OAAO,MAAM,CACjB;CACF;CAEA,OAAO;AACT;;;;;;;;AASA,eAAsB,aAAa,SAAkB,MAAc;CACjE,IACE,CAAC,QAAQ,OAAO,OAAO,QACtB,CAAC,aACA,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,KACE,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,GAEF,MAAM,QAAQ,YACX,MAAM,UAAU,IAAI,GAAG,IAAI,OAAM,SAAQ;EACxC,KACG,CAAC,QAAQ,OAAO,OAAO,QACtB,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,MACF,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,GACA;GACA,MAAM,OAAO,MAAM,QAAQ,GAAG,KAAK,IAAI;GACvC,IAAI,MAAM;IACR,MAAM,YAAY,MAAM,OAAO,SAAS,MAAM,IAAI;IAElD,OAAO,QAAQ,GAAG,MAAM,MAAM,SAAS;GACzC;EACF;CACF,CAAC,CACH;AAEJ"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_lib_utilities_format = require('./format.cjs');
|
|
3
11
|
const require_lib_utilities_file_header = require('./file-header.cjs');
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { FileHeaderOptions, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getTypescriptFileHeader } from "./file-header.mjs";
|
|
2
4
|
import { format, formatFolder } from "./format.mjs";
|
|
3
5
|
import { getMagicString, getSourceFile, getString } from "./source-file.mjs";
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { format, formatFolder } from "./format.mjs";
|
|
2
10
|
import { getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getTypescriptFileHeader } from "./file-header.mjs";
|
|
3
11
|
import { getMagicString, getSourceFile, getString } from "./source-file.mjs";
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-file.d.mts","names":[],"sources":["../../../src/lib/utilities/source-file.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-file.d.mts","names":[],"sources":["../../../src/lib/utilities/source-file.ts"],"mappings":";;;;;;;;;;;;;iBA+BgB,SAAA,CACd,IAAA,WAAe,WAAA,GAAc,eAAe;;;;AAD9C;;;iBAwBgB,cAAA,CAAe,IAAA,WAAe,WAAA,GAAc,WAAW;;;;;AAvBzB;AAuB9C;;iBAegB,aAAA,CACd,IAAA,WAAe,WAAA,EACf,EAAA,WACC,UAAU"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
10
|
import { isString } from "@stryke/type-checks/is-string";
|
|
3
11
|
import { readFileIfExistingSync } from "@stryke/fs/read-file";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-file.mjs","names":[],"sources":["../../../src/lib/utilities/source-file.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 { readFileIfExistingSync } from \"@stryke/fs/read-file\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport MagicString from \"magic-string\";\nimport { TransformResult } from \"unplugin\";\nimport { SourceFile } from \"../../types/context\";\n\n/**\n * Get the string from the source.\n *\n * @param code - The source string or magic string.\n * @returns The source string.\n */\nexport function getString(\n code: string | MagicString | TransformResult\n): string {\n if (!code) {\n return \"\";\n }\n\n if (isString(code)) {\n return code;\n }\n\n if (isSetObject(code) && \"code\" in code) {\n return code.code;\n }\n\n return code.toString();\n}\n\n/**\n * Get the magic string.\n *\n * @param code - The source string or magic string.\n * @returns The magic string.\n */\nexport function getMagicString(code: string | MagicString): MagicString {\n if (isString(code)) {\n return new MagicString(code);\n }\n\n return code;\n}\n\n/**\n * Get the source file.\n *\n * @param code - The source code.\n * @param id - The name of the file.\n * @returns The source file.\n */\nexport function getSourceFile(\n code: string | MagicString,\n id: string\n): SourceFile {\n const content = code ?? readFileIfExistingSync(id);\n\n return {\n id,\n code: getMagicString(content),\n env: []\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-file.mjs","names":[],"sources":["../../../src/lib/utilities/source-file.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 { readFileIfExistingSync } from \"@stryke/fs/read-file\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport MagicString from \"magic-string\";\nimport { TransformResult } from \"unplugin\";\nimport { SourceFile } from \"../../types/context\";\n\n/**\n * Get the string from the source.\n *\n * @param code - The source string or magic string.\n * @returns The source string.\n */\nexport function getString(\n code: string | MagicString | TransformResult\n): string {\n if (!code) {\n return \"\";\n }\n\n if (isString(code)) {\n return code;\n }\n\n if (isSetObject(code) && \"code\" in code) {\n return code.code;\n }\n\n return code.toString();\n}\n\n/**\n * Get the magic string.\n *\n * @param code - The source string or magic string.\n * @returns The magic string.\n */\nexport function getMagicString(code: string | MagicString): MagicString {\n if (isString(code)) {\n return new MagicString(code);\n }\n\n return code;\n}\n\n/**\n * Get the source file.\n *\n * @param code - The source code.\n * @param id - The name of the file.\n * @returns The source file.\n */\nexport function getSourceFile(\n code: string | MagicString,\n id: string\n): SourceFile {\n const content = code ?? readFileIfExistingSync(id);\n\n return {\n id,\n code: getMagicString(content),\n env: []\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,UACd,MACQ;CACR,IAAI,CAAC,MACH,OAAO;CAGT,IAAI,SAAS,IAAI,GACf,OAAO;CAGT,IAAI,YAAY,IAAI,KAAK,UAAU,MACjC,OAAO,KAAK;CAGd,OAAO,KAAK,SAAS;AACvB;;;;;;;AAQA,SAAgB,eAAe,MAAyC;CACtE,IAAI,SAAS,IAAI,GACf,OAAO,IAAI,YAAY,IAAI;CAG7B,OAAO;AACT;;;;;;;;AASA,SAAgB,cACd,MACA,IACY;CAGZ,OAAO;EACL;EACA,MAAM,eAJQ,QAAQ,uBAAuB,EAAE,CAInB;EAC5B,KAAK,CAAC;CACR;AACF"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
let diff_match_patch = require("diff-match-patch");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-map.d.mts","names":[],"sources":["../../../src/lib/utilities/source-map.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-map.d.mts","names":[],"sources":["../../../src/lib/utilities/source-map.ts"],"mappings":";;;;;;;;;;;;;;iBAgCgB,iBAAA,CACd,IAAA,EAAM,WAAA,EACN,EAAA,UACA,UAAA,YACC,eAAe"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import Diff from "diff-match-patch";
|
|
2
10
|
|
|
3
11
|
//#region src/lib/utilities/source-map.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-map.mjs","names":[],"sources":["../../../src/lib/utilities/source-map.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 Diff from \"diff-match-patch\";\nimport type MagicString from \"magic-string\";\nimport type { TransformResult } from \"../../types/context\";\n\nconst dmp = new Diff();\n\n/**\n * Generate code with source map.\n *\n * @param code - The source code.\n * @param id - The file name.\n * @param transpiled - The transpiled code.\n * @returns The compiler result.\n */\nexport function generateSourceMap(\n code: MagicString,\n id: string,\n transpiled?: string\n): TransformResult | undefined {\n if (!transpiled) {\n return;\n }\n\n const diff = dmp.diff_main(code.toString(), transpiled);\n dmp.diff_cleanupSemantic(diff);\n\n let offset = 0;\n\n for (let index = 0; index < diff.length; index++) {\n if (diff[index]) {\n const [type, text] = diff[index]!;\n const textLength = text.length;\n\n switch (type) {\n case 0: {\n offset += textLength;\n break;\n }\n case 1: {\n code.prependLeft(offset, text);\n break;\n }\n case -1: {\n const next = diff.at(index + 1);\n\n if (next && next[0] === 1) {\n const replaceText = next[1];\n\n const firstNonWhitespaceIndexOfText = text.search(/\\S/);\n const offsetStart =\n offset + Math.max(firstNonWhitespaceIndexOfText, 0);\n\n code.update(offsetStart, offset + textLength, replaceText);\n index += 1;\n } else {\n code.remove(offset, offset + textLength);\n }\n\n offset += textLength;\n\n break;\n }\n }\n }\n }\n\n if (!code.hasChanged()) {\n return;\n }\n\n return {\n code: code.toString(),\n map: code.generateMap({\n source: id,\n file: `${id}.map`,\n includeContent: true\n })\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-map.mjs","names":[],"sources":["../../../src/lib/utilities/source-map.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 Diff from \"diff-match-patch\";\nimport type MagicString from \"magic-string\";\nimport type { TransformResult } from \"../../types/context\";\n\nconst dmp = new Diff();\n\n/**\n * Generate code with source map.\n *\n * @param code - The source code.\n * @param id - The file name.\n * @param transpiled - The transpiled code.\n * @returns The compiler result.\n */\nexport function generateSourceMap(\n code: MagicString,\n id: string,\n transpiled?: string\n): TransformResult | undefined {\n if (!transpiled) {\n return;\n }\n\n const diff = dmp.diff_main(code.toString(), transpiled);\n dmp.diff_cleanupSemantic(diff);\n\n let offset = 0;\n\n for (let index = 0; index < diff.length; index++) {\n if (diff[index]) {\n const [type, text] = diff[index]!;\n const textLength = text.length;\n\n switch (type) {\n case 0: {\n offset += textLength;\n break;\n }\n case 1: {\n code.prependLeft(offset, text);\n break;\n }\n case -1: {\n const next = diff.at(index + 1);\n\n if (next && next[0] === 1) {\n const replaceText = next[1];\n\n const firstNonWhitespaceIndexOfText = text.search(/\\S/);\n const offsetStart =\n offset + Math.max(firstNonWhitespaceIndexOfText, 0);\n\n code.update(offsetStart, offset + textLength, replaceText);\n index += 1;\n } else {\n code.remove(offset, offset + textLength);\n }\n\n offset += textLength;\n\n break;\n }\n }\n }\n }\n\n if (!code.hasChanged()) {\n return;\n }\n\n return {\n code: code.toString(),\n map: code.generateMap({\n source: id,\n file: `${id}.map`,\n includeContent: true\n })\n };\n}\n"],"mappings":";;;;;;;;;;;AAsBA,MAAM,MAAM,IAAI,KAAK;;;;;;;;;AAUrB,SAAgB,kBACd,MACA,IACA,YAC6B;CAC7B,IAAI,CAAC,YACH;CAGF,MAAM,OAAO,IAAI,UAAU,KAAK,SAAS,GAAG,UAAU;CACtD,IAAI,qBAAqB,IAAI;CAE7B,IAAI,SAAS;CAEb,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SACvC,IAAI,KAAK,QAAQ;EACf,MAAM,CAAC,MAAM,QAAQ,KAAK;EAC1B,MAAM,aAAa,KAAK;EAExB,QAAQ,MAAR;GACE,KAAK;IACH,UAAU;IACV;GAEF,KAAK;IACH,KAAK,YAAY,QAAQ,IAAI;IAC7B;GAEF,KAAK,IAAI;IACP,MAAM,OAAO,KAAK,GAAG,QAAQ,CAAC;IAE9B,IAAI,QAAQ,KAAK,OAAO,GAAG;KACzB,MAAM,cAAc,KAAK;KAEzB,MAAM,gCAAgC,KAAK,OAAO,IAAI;KACtD,MAAM,cACJ,SAAS,KAAK,IAAI,+BAA+B,CAAC;KAEpD,KAAK,OAAO,aAAa,SAAS,YAAY,WAAW;KACzD,SAAS;IACX,OACE,KAAK,OAAO,QAAQ,SAAS,UAAU;IAGzC,UAAU;IAEV;GACF;EACF;CACF;CAGF,IAAI,CAAC,KAAK,WAAW,GACnB;CAGF,OAAO;EACL,MAAM,KAAK,SAAS;EACpB,KAAK,KAAK,YAAY;GACpB,QAAQ;GACR,MAAM,GAAG,GAAG;GACZ,gBAAgB;EAClB,CAAC;CACH;AACF"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
let prettier = require("prettier");
|
|
3
11
|
let _stryke_fs_write_file = require("@stryke/fs/write-file");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.d.mts","names":[],"sources":["../../../src/lib/utilities/write-file.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"write-file.d.mts","names":[],"sources":["../../../src/lib/utilities/write-file.ts"],"mappings":";;;;;;;;;;;;;iBA8BsB,SAAA,CACpB,GAAA,EAAK,KAAA,EACL,QAAA,UACA,OAAA,UACA,UAAA,aAAkB,OAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { format, resolveConfig } from "prettier";
|
|
2
10
|
import { writeFile as writeFile$1 } from "@stryke/fs/write-file";
|
|
3
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.mjs","names":["writeFileBase"],"sources":["../../../src/lib/utilities/write-file.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 { writeFile as writeFileBase } from \"@stryke/fs/write-file\";\nimport { format, resolveConfig } from \"prettier\";\nimport type { LogFn } from \"../../types/logging\";\n\n/**\n * Writes and formats a file to the file system\n *\n * @param log - The logging function to use for logging errors\n * @param filepath - The file path to write the file\n * @param content - The content to write to the file\n * @param skipFormat - Should the plugin skip formatting the `content` string with Prettier\n */\nexport async function writeFile(\n log: LogFn,\n filepath: string,\n content: string,\n skipFormat = false\n) {\n try {\n if (skipFormat) {\n await writeFileBase(filepath, content);\n } else {\n const config = await resolveConfig(filepath);\n const formatted = await format(content, {\n ...(config ?? {}),\n filepath\n });\n\n await writeFileBase(filepath, formatted || \"\");\n }\n } catch (error) {\n log(\n \"error\",\n `Failed to write file ${filepath} to disk \\n${(error as Error)?.message ? (error as Error).message : \"\"}`\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"write-file.mjs","names":["writeFileBase"],"sources":["../../../src/lib/utilities/write-file.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 { writeFile as writeFileBase } from \"@stryke/fs/write-file\";\nimport { format, resolveConfig } from \"prettier\";\nimport type { LogFn } from \"../../types/logging\";\n\n/**\n * Writes and formats a file to the file system\n *\n * @param log - The logging function to use for logging errors\n * @param filepath - The file path to write the file\n * @param content - The content to write to the file\n * @param skipFormat - Should the plugin skip formatting the `content` string with Prettier\n */\nexport async function writeFile(\n log: LogFn,\n filepath: string,\n content: string,\n skipFormat = false\n) {\n try {\n if (skipFormat) {\n await writeFileBase(filepath, content);\n } else {\n const config = await resolveConfig(filepath);\n const formatted = await format(content, {\n ...(config ?? {}),\n filepath\n });\n\n await writeFileBase(filepath, formatted || \"\");\n }\n } catch (error) {\n log(\n \"error\",\n `Failed to write file ${filepath} to disk \\n${(error as Error)?.message ? (error as Error).message : \"\"}`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,eAAsB,UACpB,KACA,UACA,SACA,aAAa,OACb;CACA,IAAI;EACF,IAAI,YACF,MAAMA,YAAc,UAAU,OAAO;OAQrC,MAAMA,YAAc,UAAU,MALN,OAAO,SAAS;GACtC,GAAI,MAFe,cAAc,QAAQ,KAE3B,CAAC;GACf;EACF,CAAC,KAE0C,EAAE;CAEjD,SAAS,OAAO;EACd,IACE,SACA,wBAAwB,SAAS,aAAc,OAAiB,UAAW,MAAgB,UAAU,IACvG;CACF;AACF"}
|
package/dist/lib/vfs.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
const require_lib_utilities_format = require('./utilities/format.cjs');
|
package/dist/lib/vfs.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { ResolveOptions, VirtualFileMetadata, VirtualFileSystemInterface, WriteOptions } from "../types/fs.mjs";
|
|
2
4
|
import { Context } from "../types/context.mjs";
|
|
3
5
|
import { FlatCache } from "flat-cache";
|