@powerlines/core 0.46.5 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/index.cjs +1 -4
- package/dist/constants/index.d.cts +1 -2
- package/dist/constants/index.d.mts +1 -2
- package/dist/constants/index.mjs +2 -3
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/unplugin/module-resolution.cjs +10 -10
- package/dist/lib/unplugin/module-resolution.d.cts.map +1 -1
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -1
- package/dist/lib/unplugin/module-resolution.mjs +10 -10
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +3 -3
- package/dist/lib/unplugin/plugin.mjs +3 -3
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/index.cjs +1 -1
- package/dist/lib/utilities/index.mjs +1 -1
- package/dist/plugin-utils/format.cjs +36 -0
- package/dist/plugin-utils/format.d.cts +11 -0
- package/dist/plugin-utils/format.d.cts.map +1 -0
- package/dist/plugin-utils/format.d.mts +11 -0
- package/dist/plugin-utils/format.d.mts.map +1 -0
- package/dist/plugin-utils/format.mjs +35 -0
- package/dist/plugin-utils/format.mjs.map +1 -0
- package/dist/plugin-utils/index.cjs +10 -1
- package/dist/plugin-utils/index.d.cts +3 -1
- package/dist/plugin-utils/index.d.mts +3 -1
- package/dist/plugin-utils/index.mjs +4 -2
- package/dist/plugin-utils/logging.cjs +1 -1
- package/dist/plugin-utils/logging.mjs +1 -1
- package/dist/plugin-utils/virtual.cjs +51 -0
- package/dist/plugin-utils/virtual.d.cts +34 -0
- package/dist/plugin-utils/virtual.d.cts.map +1 -0
- package/dist/plugin-utils/virtual.d.mts +34 -0
- package/dist/plugin-utils/virtual.d.mts.map +1 -0
- package/dist/plugin-utils/virtual.mjs +45 -0
- package/dist/plugin-utils/virtual.mjs.map +1 -0
- package/package.json +10 -6
- package/dist/constants/virtual-modules.cjs +0 -11
- package/dist/constants/virtual-modules.d.cts +0 -6
- package/dist/constants/virtual-modules.d.cts.map +0 -1
- package/dist/constants/virtual-modules.d.mts +0 -6
- package/dist/constants/virtual-modules.d.mts.map +0 -1
- package/dist/constants/virtual-modules.mjs +0 -9
- package/dist/constants/virtual-modules.mjs.map +0 -1
package/dist/constants/index.cjs
CHANGED
|
@@ -3,11 +3,10 @@ const require_constants_api = require('./api.cjs');
|
|
|
3
3
|
const require_constants_commands = require('./commands.cjs');
|
|
4
4
|
const require_constants_plugin = require('./plugin.cjs');
|
|
5
5
|
const require_constants_environments = require('./environments.cjs');
|
|
6
|
+
const require_constants_log_level = require('./log-level.cjs');
|
|
6
7
|
const require_constants_fs = require('./fs.cjs');
|
|
7
8
|
const require_constants_hooks = require('./hooks.cjs');
|
|
8
|
-
const require_constants_log_level = require('./log-level.cjs');
|
|
9
9
|
const require_constants_meta = require('./meta.cjs');
|
|
10
|
-
const require_constants_virtual_modules = require('./virtual-modules.cjs');
|
|
11
10
|
|
|
12
11
|
exports.BASE_API_FUNCTIONS = require_constants_api.BASE_API_FUNCTIONS;
|
|
13
12
|
exports.BUILDER_VARIANTS = require_constants_plugin.BUILDER_VARIANTS;
|
|
@@ -35,7 +34,5 @@ exports.SSR_ENVIRONMENT = require_constants_environments.SSR_ENVIRONMENT;
|
|
|
35
34
|
exports.STORAGE_PRESETS = require_constants_fs.STORAGE_PRESETS;
|
|
36
35
|
exports.SUPPORTED_COMMANDS = require_constants_commands.SUPPORTED_COMMANDS;
|
|
37
36
|
exports.UNPLUGIN_BUILDER_VARIANTS = require_constants_plugin.UNPLUGIN_BUILDER_VARIANTS;
|
|
38
|
-
exports.VIRTUAL_MODULE_PREFIX = require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX;
|
|
39
|
-
exports.VIRTUAL_MODULE_PREFIX_REGEX = require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX_REGEX;
|
|
40
37
|
exports.__VFS_PATCH__ = require_constants_fs.__VFS_PATCH__;
|
|
41
38
|
exports.__VFS_REVERT__ = require_constants_fs.__VFS_REVERT__;
|
|
@@ -6,5 +6,4 @@ import { HOOKS_LIST_ORDERS } from "./hooks.cjs";
|
|
|
6
6
|
import { DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels } from "./log-level.cjs";
|
|
7
7
|
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./meta.cjs";
|
|
8
8
|
import { BUILDER_VARIANTS, KNOWN_PLUGIN_FIELDS, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, UNPLUGIN_BUILDER_VARIANTS } from "./plugin.cjs";
|
|
9
|
-
|
|
10
|
-
export { BASE_API_FUNCTIONS, BUILDER_VARIANTS, CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, HOOKS_LIST_ORDERS, KNOWN_PLUGIN_FIELDS, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, POWERLINES_API_FUNCTIONS, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT, STORAGE_PRESETS, SUPPORTED_COMMANDS, UNPLUGIN_BUILDER_VARIANTS, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __VFS_PATCH__, __VFS_REVERT__ };
|
|
9
|
+
export { BASE_API_FUNCTIONS, BUILDER_VARIANTS, CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, HOOKS_LIST_ORDERS, KNOWN_PLUGIN_FIELDS, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, POWERLINES_API_FUNCTIONS, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT, STORAGE_PRESETS, SUPPORTED_COMMANDS, UNPLUGIN_BUILDER_VARIANTS, __VFS_PATCH__, __VFS_REVERT__ };
|
|
@@ -6,5 +6,4 @@ import { HOOKS_LIST_ORDERS } from "./hooks.mjs";
|
|
|
6
6
|
import { DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels } from "./log-level.mjs";
|
|
7
7
|
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./meta.mjs";
|
|
8
8
|
import { BUILDER_VARIANTS, KNOWN_PLUGIN_FIELDS, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, UNPLUGIN_BUILDER_VARIANTS } from "./plugin.mjs";
|
|
9
|
-
|
|
10
|
-
export { BASE_API_FUNCTIONS, BUILDER_VARIANTS, CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, HOOKS_LIST_ORDERS, KNOWN_PLUGIN_FIELDS, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, POWERLINES_API_FUNCTIONS, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT, STORAGE_PRESETS, SUPPORTED_COMMANDS, UNPLUGIN_BUILDER_VARIANTS, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __VFS_PATCH__, __VFS_REVERT__ };
|
|
9
|
+
export { BASE_API_FUNCTIONS, BUILDER_VARIANTS, CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, HOOKS_LIST_ORDERS, KNOWN_PLUGIN_FIELDS, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, POWERLINES_API_FUNCTIONS, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT, STORAGE_PRESETS, SUPPORTED_COMMANDS, UNPLUGIN_BUILDER_VARIANTS, __VFS_PATCH__, __VFS_REVERT__ };
|
package/dist/constants/index.mjs
CHANGED
|
@@ -2,10 +2,9 @@ import { BASE_API_FUNCTIONS, POWERLINES_API_FUNCTIONS } from "./api.mjs";
|
|
|
2
2
|
import { SUPPORTED_COMMANDS } from "./commands.mjs";
|
|
3
3
|
import { BUILDER_VARIANTS, KNOWN_PLUGIN_FIELDS, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, UNPLUGIN_BUILDER_VARIANTS } from "./plugin.mjs";
|
|
4
4
|
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./environments.mjs";
|
|
5
|
+
import { DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels } from "./log-level.mjs";
|
|
5
6
|
import { STORAGE_PRESETS, __VFS_PATCH__, __VFS_REVERT__ } from "./fs.mjs";
|
|
6
7
|
import { HOOKS_LIST_ORDERS } from "./hooks.mjs";
|
|
7
|
-
import { DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels } from "./log-level.mjs";
|
|
8
8
|
import { CACHE_HASH_LENGTH, ROOT_HASH_LENGTH } from "./meta.mjs";
|
|
9
|
-
import { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX } from "./virtual-modules.mjs";
|
|
10
9
|
|
|
11
|
-
export { BASE_API_FUNCTIONS, BUILDER_VARIANTS, CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, HOOKS_LIST_ORDERS, KNOWN_PLUGIN_FIELDS, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, POWERLINES_API_FUNCTIONS, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT, STORAGE_PRESETS, SUPPORTED_COMMANDS, UNPLUGIN_BUILDER_VARIANTS,
|
|
10
|
+
export { BASE_API_FUNCTIONS, BUILDER_VARIANTS, CACHE_HASH_LENGTH, CLIENT_ENVIRONMENT, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, HOOKS_LIST_ORDERS, KNOWN_PLUGIN_FIELDS, LOG_CATEGORIES, LOG_CATEGORIES_ARRAY, LOG_LEVELS, LogCategories, LogLevels, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, POWERLINES_API_FUNCTIONS, ROOT_HASH_LENGTH, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT, STORAGE_PRESETS, SUPPORTED_COMMANDS, UNPLUGIN_BUILDER_VARIANTS, __VFS_PATCH__, __VFS_REVERT__ };
|
package/dist/index.cjs
CHANGED
|
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_lib_config = require('./lib/config.cjs');
|
|
3
3
|
const require_lib_entry = require('./lib/entry.cjs');
|
|
4
4
|
const require_lib_unplugin_helpers = require('./lib/unplugin/helpers.cjs');
|
|
5
|
+
const require_lib_utilities_format = require('./lib/utilities/format.cjs');
|
|
5
6
|
const require_lib_unplugin_module_resolution = require('./lib/unplugin/module-resolution.cjs');
|
|
6
7
|
const require_lib_utilities_source_file = require('./lib/utilities/source-file.cjs');
|
|
7
8
|
const require_lib_unplugin_plugin = require('./lib/unplugin/plugin.cjs');
|
|
8
9
|
const require_lib_utilities_file_header = require('./lib/utilities/file-header.cjs');
|
|
9
|
-
const require_lib_utilities_format = require('./lib/utilities/format.cjs');
|
|
10
10
|
const require_lib_utilities_source_map = require('./lib/utilities/source-map.cjs');
|
|
11
11
|
const require_lib_utilities_write_file = require('./lib/utilities/write-file.cjs');
|
|
12
12
|
require('./lib/index.cjs');
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./lib/config.mjs";
|
|
2
2
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.mjs";
|
|
3
3
|
import { combineContexts, isUnpluginBuilderVariant } from "./lib/unplugin/helpers.mjs";
|
|
4
|
+
import { format, formatFolder } from "./lib/utilities/format.mjs";
|
|
4
5
|
import { createUnpluginModuleResolutionFunctions } from "./lib/unplugin/module-resolution.mjs";
|
|
5
6
|
import { getMagicString, getSourceFile, getString } from "./lib/utilities/source-file.mjs";
|
|
6
7
|
import { createUnplugin, createUnpluginResolver } from "./lib/unplugin/plugin.mjs";
|
|
7
8
|
import { getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getTypescriptFileHeader } from "./lib/utilities/file-header.mjs";
|
|
8
|
-
import { format, formatFolder } from "./lib/utilities/format.mjs";
|
|
9
9
|
import { generateSourceMap } from "./lib/utilities/source-map.mjs";
|
|
10
10
|
import { writeFile } from "./lib/utilities/write-file.mjs";
|
|
11
11
|
import "./lib/index.mjs";
|
package/dist/lib/index.cjs
CHANGED
|
@@ -2,12 +2,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_lib_config = require('./config.cjs');
|
|
3
3
|
const require_lib_entry = require('./entry.cjs');
|
|
4
4
|
const require_lib_unplugin_helpers = require('./unplugin/helpers.cjs');
|
|
5
|
+
const require_lib_utilities_format = require('./utilities/format.cjs');
|
|
5
6
|
const require_lib_unplugin_module_resolution = require('./unplugin/module-resolution.cjs');
|
|
6
7
|
const require_lib_utilities_source_file = require('./utilities/source-file.cjs');
|
|
7
8
|
const require_lib_unplugin_plugin = require('./unplugin/plugin.cjs');
|
|
8
9
|
require('./unplugin/index.cjs');
|
|
9
10
|
const require_lib_utilities_file_header = require('./utilities/file-header.cjs');
|
|
10
|
-
const require_lib_utilities_format = require('./utilities/format.cjs');
|
|
11
11
|
const require_lib_utilities_source_map = require('./utilities/source-map.cjs');
|
|
12
12
|
const require_lib_utilities_write_file = require('./utilities/write-file.cjs');
|
|
13
13
|
require('./utilities/index.cjs');
|
package/dist/lib/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./config.mjs";
|
|
2
2
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./entry.mjs";
|
|
3
3
|
import { combineContexts, isUnpluginBuilderVariant } from "./unplugin/helpers.mjs";
|
|
4
|
+
import { format, formatFolder } from "./utilities/format.mjs";
|
|
4
5
|
import { createUnpluginModuleResolutionFunctions } from "./unplugin/module-resolution.mjs";
|
|
5
6
|
import { getMagicString, getSourceFile, getString } from "./utilities/source-file.mjs";
|
|
6
7
|
import { createUnplugin, createUnpluginResolver } from "./unplugin/plugin.mjs";
|
|
7
8
|
import "./unplugin/index.mjs";
|
|
8
9
|
import { getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getTypescriptFileHeader } from "./utilities/file-header.mjs";
|
|
9
|
-
import { format, formatFolder } from "./utilities/format.mjs";
|
|
10
10
|
import { generateSourceMap } from "./utilities/source-map.mjs";
|
|
11
11
|
import { writeFile } from "./utilities/write-file.mjs";
|
|
12
12
|
import "./utilities/index.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const
|
|
4
|
-
require('../../
|
|
3
|
+
const require_plugin_utils_virtual = require('../../plugin-utils/virtual.cjs');
|
|
4
|
+
require('../../plugin-utils/index.cjs');
|
|
5
5
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
6
6
|
let defu = require("defu");
|
|
7
7
|
defu = require_runtime.__toESM(defu, 1);
|
|
@@ -25,8 +25,8 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
25
25
|
const ctx = context;
|
|
26
26
|
return {
|
|
27
27
|
async resolveId(id, importer, opts = { isEntry: false }) {
|
|
28
|
-
const normalizedId =
|
|
29
|
-
const normalizedImporter = importer ?
|
|
28
|
+
const normalizedId = require_plugin_utils_virtual.removeVirtualPrefix(id);
|
|
29
|
+
const normalizedImporter = importer ? require_plugin_utils_virtual.removeVirtualPrefix(importer) : void 0;
|
|
30
30
|
let result = await ctx.api.callHook("resolveId", {
|
|
31
31
|
sequential: true,
|
|
32
32
|
result: "first",
|
|
@@ -35,7 +35,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
35
35
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
36
36
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
37
37
|
...result,
|
|
38
|
-
id: result.virtual && options.prefix !== false ?
|
|
38
|
+
id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
|
|
39
39
|
};
|
|
40
40
|
result = await ctx.api.callHook("resolveId", {
|
|
41
41
|
sequential: true,
|
|
@@ -45,7 +45,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
45
45
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
46
46
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
47
47
|
...result,
|
|
48
|
-
id: result.virtual && options.prefix !== false ?
|
|
48
|
+
id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
|
|
49
49
|
};
|
|
50
50
|
result = await ctx.resolve(normalizedId, normalizedImporter, (0, defu.default)(options.overrides ?? {}, {
|
|
51
51
|
isFile: true,
|
|
@@ -53,7 +53,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
53
53
|
}));
|
|
54
54
|
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
55
55
|
...result,
|
|
56
|
-
id: result.virtual && options.prefix !== false ?
|
|
56
|
+
id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
|
|
57
57
|
};
|
|
58
58
|
result = await ctx.api.callHook("resolveId", {
|
|
59
59
|
sequential: true,
|
|
@@ -63,14 +63,14 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
63
63
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
64
64
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
65
65
|
...result,
|
|
66
|
-
id: result.virtual && options.prefix !== false ?
|
|
66
|
+
id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
|
|
67
67
|
};
|
|
68
68
|
return null;
|
|
69
69
|
},
|
|
70
70
|
load: {
|
|
71
|
-
filter: options.prefix !== false ? { id:
|
|
71
|
+
filter: options.prefix !== false ? { id: require_plugin_utils_virtual.VIRTUAL_MODULE_PREFIX_REGEX } : void 0,
|
|
72
72
|
async handler(id) {
|
|
73
|
-
const normalizedId =
|
|
73
|
+
const normalizedId = require_plugin_utils_virtual.removeVirtualPrefix(id);
|
|
74
74
|
let result = await ctx.api.callHook("load", {
|
|
75
75
|
sequential: true,
|
|
76
76
|
result: "first",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAoCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAgBN,uCAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA;AAAA"}
|
|
@@ -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":";;;;;UAoCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAgBN,uCAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../
|
|
1
|
+
import { VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, removeVirtualPrefix } from "../../plugin-utils/virtual.mjs";
|
|
2
|
+
import "../../plugin-utils/index.mjs";
|
|
3
3
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
4
4
|
import defu from "defu";
|
|
5
5
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
@@ -22,8 +22,8 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
22
22
|
const ctx = context;
|
|
23
23
|
return {
|
|
24
24
|
async resolveId(id, importer, opts = { isEntry: false }) {
|
|
25
|
-
const normalizedId = id
|
|
26
|
-
const normalizedImporter = importer ? importer
|
|
25
|
+
const normalizedId = removeVirtualPrefix(id);
|
|
26
|
+
const normalizedImporter = importer ? removeVirtualPrefix(importer) : void 0;
|
|
27
27
|
let result = await ctx.api.callHook("resolveId", {
|
|
28
28
|
sequential: true,
|
|
29
29
|
result: "first",
|
|
@@ -32,7 +32,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
32
32
|
if (isSetString(result)) return result;
|
|
33
33
|
else if (isSetObject(result)) return {
|
|
34
34
|
...result,
|
|
35
|
-
id: result.virtual && options.prefix !== false ?
|
|
35
|
+
id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
|
|
36
36
|
};
|
|
37
37
|
result = await ctx.api.callHook("resolveId", {
|
|
38
38
|
sequential: true,
|
|
@@ -42,7 +42,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
42
42
|
if (isSetString(result)) return result;
|
|
43
43
|
else if (isSetObject(result)) return {
|
|
44
44
|
...result,
|
|
45
|
-
id: result.virtual && options.prefix !== false ?
|
|
45
|
+
id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
|
|
46
46
|
};
|
|
47
47
|
result = await ctx.resolve(normalizedId, normalizedImporter, defu(options.overrides ?? {}, {
|
|
48
48
|
isFile: true,
|
|
@@ -50,7 +50,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
50
50
|
}));
|
|
51
51
|
if (isSetObject(result)) return {
|
|
52
52
|
...result,
|
|
53
|
-
id: result.virtual && options.prefix !== false ?
|
|
53
|
+
id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
|
|
54
54
|
};
|
|
55
55
|
result = await ctx.api.callHook("resolveId", {
|
|
56
56
|
sequential: true,
|
|
@@ -60,14 +60,14 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
60
60
|
if (isSetString(result)) return result;
|
|
61
61
|
else if (isSetObject(result)) return {
|
|
62
62
|
...result,
|
|
63
|
-
id: result.virtual && options.prefix !== false ?
|
|
63
|
+
id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
|
|
64
64
|
};
|
|
65
65
|
return null;
|
|
66
66
|
},
|
|
67
67
|
load: {
|
|
68
|
-
filter: options.prefix !== false ? { id:
|
|
68
|
+
filter: options.prefix !== false ? { id: VIRTUAL_MODULE_PREFIX_REGEX } : void 0,
|
|
69
69
|
async handler(id) {
|
|
70
|
-
const normalizedId = id
|
|
70
|
+
const normalizedId = removeVirtualPrefix(id);
|
|
71
71
|
let result = await ctx.api.callHook("load", {
|
|
72
72
|
sequential: true,
|
|
73
73
|
result: "first",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-resolution.mjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { LoadResult } from \"rollup\";\nimport type {\n UnpluginBuildContext,\n UnpluginContext,\n UnpluginOptions\n} from \"unplugin\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"module-resolution.mjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { LoadResult } from \"rollup\";\nimport type {\n UnpluginBuildContext,\n UnpluginContext,\n UnpluginOptions\n} from \"unplugin\";\nimport {\n addVirtualPrefix,\n removeVirtualPrefix,\n VIRTUAL_MODULE_PREFIX_REGEX\n} from \"../../plugin-utils\";\nimport { Unstable_PluginContext } from \"../../types/_internal\";\nimport { PluginContext, ResolveResult } 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 PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginModuleResolutionFunctionsOptions = {}\n): Pick<UnpluginOptions, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as Unstable_PluginContext;\n\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 ctx.api.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 ctx.api.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 ctx.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 ctx.api.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 ctx.api.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 ctx.api.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 ctx.load(normalizedId);\n if (result) {\n return result;\n }\n\n return ctx.api.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId\n );\n }\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsEA,SAAgB,wCAGd,SACA,UAA0D,EAAE,EACf;CAC7C,MAAM,MAAM;AAEZ,QAAO;EACL,MAAM,UAEJ,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EAC8B;GACpD,MAAM,eAAe,oBAAoB,GAAG;GAC5C,MAAM,qBAAqB,WACvB,oBAAoB,SAAS,GAC7B;GAEJ,IAAI,SAAS,MAAM,IAAI,IAAI,SACzB,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,cACA,oBACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO;YACE,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,GAAG,GAC3B,OAAO;IACd;AAGH,YAAS,MAAM,IAAI,IAAI,SACrB,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,cACA,oBACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO;YACE,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,GAAG,GAC3B,OAAO;IACd;AAGH,YAAS,MAAM,IAAI,QACjB,cACA,oBACA,KAAK,QAAQ,aAAa,EAAE,EAAE;IAC5B,QAAQ;IACR,GAAG;IACJ,CAAC,CACH;AACD,OAAI,YAAY,OAAO,CACrB,QAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,GAAG,GAC3B,OAAO;IACd;AAGH,YAAS,MAAM,IAAI,IAAI,SACrB,aACA;IACE,YAAY;IACZ,QAAQ;IACR,OAAO;IACR,EACD,cACA,oBACA,KACD;AACD,OAAI,YAAY,OAAO,CACrB,QAAO;YACE,YAAY,OAAO,CAC5B,QAAO;IACL,GAAG;IACH,IACE,OAAO,WAAW,QAAQ,WAAW,QACjC,iBAAiB,OAAO,GAAG,GAC3B,OAAO;IACd;AAGH,UAAO;;EAET,MAAM;GACJ,QACE,QAAQ,WAAW,QACf,EACE,IAAI,6BACL,GACD;GACN,MAAM,QAEJ,IACwC;IACxC,MAAM,eAAe,oBAAoB,GAAG;IAE5C,IAAI,SAAS,MAAM,IAAI,IAAI,SACzB,QACA;KACE,YAAY;KACZ,QAAQ;KACR,OAAO;KACR,EACD,aACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,IAAI,IAAI,SACrB,QACA;KACE,YAAY;KACZ,QAAQ;KACR,OAAO;KACR,EACD,aACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,IAAI,KAAK,aAAa;AACrC,QAAI,OACF,QAAO;AAGT,WAAO,IAAI,IAAI,SACb,QACA;KACE,YAAY;KACZ,QAAQ;KACR,OAAO;KACR,EACD,aACD;;GAEJ;EACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_lib_unplugin_helpers = require('./helpers.cjs');
|
|
4
|
-
const
|
|
5
|
-
require('../../
|
|
4
|
+
const require_plugin_utils_virtual = require('../../plugin-utils/virtual.cjs');
|
|
5
|
+
require('../../plugin-utils/index.cjs');
|
|
6
6
|
const require_lib_unplugin_module_resolution = require('./module-resolution.cjs');
|
|
7
7
|
const require_lib_utilities_source_file = require('../utilities/source-file.cjs');
|
|
8
8
|
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
@@ -59,7 +59,7 @@ function createUnplugin(context, options = {}) {
|
|
|
59
59
|
async function transform(code, id) {
|
|
60
60
|
let transformed = code;
|
|
61
61
|
for (const hook of ctx.environment.selectHooks("transform")) {
|
|
62
|
-
const result = await hook.handler.apply(require_lib_unplugin_helpers.combineContexts(ctx, this), [require_lib_utilities_source_file.getString(transformed),
|
|
62
|
+
const result = await hook.handler.apply(require_lib_unplugin_helpers.combineContexts(ctx, this), [require_lib_utilities_source_file.getString(transformed), require_plugin_utils_virtual.removeVirtualPrefix(id)]);
|
|
63
63
|
if (result) transformed = result;
|
|
64
64
|
}
|
|
65
65
|
return transformed;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { combineContexts } from "./helpers.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import "../../
|
|
2
|
+
import { removeVirtualPrefix } from "../../plugin-utils/virtual.mjs";
|
|
3
|
+
import "../../plugin-utils/index.mjs";
|
|
4
4
|
import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
|
|
5
5
|
import { getString } from "../utilities/source-file.mjs";
|
|
6
6
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
@@ -57,7 +57,7 @@ function createUnplugin(context, options = {}) {
|
|
|
57
57
|
async function transform(code, id) {
|
|
58
58
|
let transformed = code;
|
|
59
59
|
for (const hook of ctx.environment.selectHooks("transform")) {
|
|
60
|
-
const result = await hook.handler.apply(combineContexts(ctx, this), [getString(transformed), id
|
|
60
|
+
const result = await hook.handler.apply(combineContexts(ctx, this), [getString(transformed), removeVirtualPrefix(id)]);
|
|
61
61
|
if (result) transformed = result;
|
|
62
62
|
}
|
|
63
63
|
return transformed;
|
|
@@ -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 {
|
|
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 { Unstable_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } 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<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginResolverOptions = {}\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as Unstable_PluginContext<any>;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const logger = ctx.extendLogger(\n !options.silenceHookLogging && name !== \"powerlines\"\n ? { source: name }\n : {}\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 api: ctx.$$internal.api,\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}\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): UnpluginFactory<TContext> {\n const ctx = context as unknown as Unstable_PluginContext;\n setParseImpl(ctx.parse.bind(ctx));\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const logger = ctx.extendLogger(\n !options.silenceHookLogging && name !== \"powerlines\"\n ? { source: name }\n : {}\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 ctx.api.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 ctx.environment.selectHooks(\"transform\")) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, 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 ctx.api.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 ctx.api.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.api,\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}\n"],"mappings":";;;;;;;;;;;;;;;;AA8DA,SAAgB,uBAGd,SACA,UAAyC,EAAE,EAChB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,SAAS,IAAI,aACjB,CAAC,QAAQ,sBAAsB,SAAS,eACpC,EAAE,QAAQ,MAAM,GAChB,EAAE,CACP;AACD,SAAO,MAAM,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAEtD,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;AAErE,UAAO;IACL,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB;IACA;IACD;WACM,OAAO;AACd,UAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AAEpE,SAAM;;;;;;;;;;AAaZ,SAAgB,eACd,SACA,UAAiC,EAAE,EACR;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM,KAAK,IAAI,CAAC;CAEjC,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,SAAS,IAAI,aACjB,CAAC,QAAQ,sBAAsB,SAAS,eACpC,EAAE,QAAQ,MAAM,GAChB,EAAE,CACP;AACD,SAAO,MAAM,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAEtD,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;GAErE,eAAe,aAAuC;AACpD,QAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,sCAAsC;AAGrD,UAAM,IAAI,IAAI,SAAS,cAAc,EACnC,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAI,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,YAAY,YAAY,YAAY,EAAE;KAC3D,MAAM,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,KAAK,KAAK,EAAE,CACnD,UAAU,YAAY,EACtB,oBAAoB,GAAG,CACxB,CAA+B;AAClC,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,uCAAuC;AAGtD,WAAO,IAAI,IAAI,SAAS,YAAY,EAClC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,0CAA0C;AAGzD,WAAO,IAAI,IAAI,SAAS,eAAe,EACrC,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI;IACT;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,UAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AAEpE,SAAM"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_lib_utilities_format = require('./format.cjs');
|
|
2
3
|
const require_lib_utilities_source_file = require('./source-file.cjs');
|
|
3
4
|
const require_lib_utilities_file_header = require('./file-header.cjs');
|
|
4
|
-
const require_lib_utilities_format = require('./format.cjs');
|
|
5
5
|
const require_lib_utilities_source_map = require('./source-map.cjs');
|
|
6
6
|
const require_lib_utilities_write_file = require('./write-file.cjs');
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { format, formatFolder } from "./format.mjs";
|
|
1
2
|
import { getMagicString, getSourceFile, getString } from "./source-file.mjs";
|
|
2
3
|
import { getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getTypescriptFileHeader } from "./file-header.mjs";
|
|
3
|
-
import { format, formatFolder } from "./format.mjs";
|
|
4
4
|
import { generateSourceMap } from "./source-map.mjs";
|
|
5
5
|
import { writeFile } from "./write-file.mjs";
|
|
6
6
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
4
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
5
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
|
+
let _stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
|
|
7
|
+
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
8
|
+
|
|
9
|
+
//#region src/plugin-utils/format.ts
|
|
10
|
+
/**
|
|
11
|
+
* Formats a configuration object into a human-readable string, omitting certain properties and simplifying others for better readability.
|
|
12
|
+
*
|
|
13
|
+
* @param config - The configuration object to format.
|
|
14
|
+
* @returns A formatted string representation of the configuration.
|
|
15
|
+
*/
|
|
16
|
+
function formatConfig(config) {
|
|
17
|
+
return JSON.stringify(Object.fromEntries(Object.entries({
|
|
18
|
+
...(0, _stryke_helpers_omit.omit)(config, [
|
|
19
|
+
"plugins",
|
|
20
|
+
"initialConfig",
|
|
21
|
+
"userConfig",
|
|
22
|
+
"inlineConfig",
|
|
23
|
+
"pluginConfig",
|
|
24
|
+
"environmentConfig"
|
|
25
|
+
]),
|
|
26
|
+
resolve: {
|
|
27
|
+
...config.resolve,
|
|
28
|
+
external: (config.resolve?.external ?? []).filter(Boolean).map((external) => (0, _stryke_type_checks_is_set_string.isSetString)(external) ? external : (0, _stryke_type_checks_is_regexp.isRegExp)(external) ? external.source : "<unknown-external>"),
|
|
29
|
+
noExternal: (config.resolve?.noExternal ?? []).filter(Boolean).map((noExternal) => (0, _stryke_type_checks_is_set_string.isSetString)(noExternal) ? noExternal : (0, _stryke_type_checks_is_regexp.isRegExp)(noExternal) ? noExternal.source : "<unknown-no-external>")
|
|
30
|
+
},
|
|
31
|
+
plugins: config.plugins ? (0, _stryke_convert_to_array.toArray)(config.plugins)?.flatMap((plugin) => (0, _stryke_convert_to_array.toArray)(plugin))?.map((plugin) => String((0, _stryke_type_checks_is_set_string.isSetString)(plugin) ? plugin : (0, _stryke_type_checks_is_set_object.isSetObject)(plugin) && (0, _stryke_type_checks_is_set_string.isSetString)(plugin.name) ? plugin.name : Array.isArray(plugin) && (0, _stryke_type_checks_is_set_string.isSetString)(plugin[0]) ? plugin[0] : "<function-plugin>")) : []
|
|
32
|
+
}).sort(([key1], [key2]) => key1.localeCompare(key2))), null, 4).replace(/"([^"]+)":/g, "$1:").replace(/,\s*$/g, "");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.formatConfig = formatConfig;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/plugin-utils/format.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Formats a configuration object into a human-readable string, omitting certain properties and simplifying others for better readability.
|
|
4
|
+
*
|
|
5
|
+
* @param config - The configuration object to format.
|
|
6
|
+
* @returns A formatted string representation of the configuration.
|
|
7
|
+
*/
|
|
8
|
+
declare function formatConfig(config: Record<string, any>): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { formatConfig };
|
|
11
|
+
//# sourceMappingURL=format.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.cts","names":[],"sources":["../../src/plugin-utils/format.ts"],"mappings":";;AA+BA;;;;;iBAAgB,YAAA,CAAa,MAAA,EAAQ,MAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/plugin-utils/format.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Formats a configuration object into a human-readable string, omitting certain properties and simplifying others for better readability.
|
|
4
|
+
*
|
|
5
|
+
* @param config - The configuration object to format.
|
|
6
|
+
* @returns A formatted string representation of the configuration.
|
|
7
|
+
*/
|
|
8
|
+
declare function formatConfig(config: Record<string, any>): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { formatConfig };
|
|
11
|
+
//# sourceMappingURL=format.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.mts","names":[],"sources":["../../src/plugin-utils/format.ts"],"mappings":";;AA+BA;;;;;iBAAgB,YAAA,CAAa,MAAA,EAAQ,MAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
3
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
+
import { isRegExp } from "@stryke/type-checks/is-regexp";
|
|
5
|
+
import { omit } from "@stryke/helpers/omit";
|
|
6
|
+
|
|
7
|
+
//#region src/plugin-utils/format.ts
|
|
8
|
+
/**
|
|
9
|
+
* Formats a configuration object into a human-readable string, omitting certain properties and simplifying others for better readability.
|
|
10
|
+
*
|
|
11
|
+
* @param config - The configuration object to format.
|
|
12
|
+
* @returns A formatted string representation of the configuration.
|
|
13
|
+
*/
|
|
14
|
+
function formatConfig(config) {
|
|
15
|
+
return JSON.stringify(Object.fromEntries(Object.entries({
|
|
16
|
+
...omit(config, [
|
|
17
|
+
"plugins",
|
|
18
|
+
"initialConfig",
|
|
19
|
+
"userConfig",
|
|
20
|
+
"inlineConfig",
|
|
21
|
+
"pluginConfig",
|
|
22
|
+
"environmentConfig"
|
|
23
|
+
]),
|
|
24
|
+
resolve: {
|
|
25
|
+
...config.resolve,
|
|
26
|
+
external: (config.resolve?.external ?? []).filter(Boolean).map((external) => isSetString(external) ? external : isRegExp(external) ? external.source : "<unknown-external>"),
|
|
27
|
+
noExternal: (config.resolve?.noExternal ?? []).filter(Boolean).map((noExternal) => isSetString(noExternal) ? noExternal : isRegExp(noExternal) ? noExternal.source : "<unknown-no-external>")
|
|
28
|
+
},
|
|
29
|
+
plugins: config.plugins ? toArray(config.plugins)?.flatMap((plugin) => toArray(plugin))?.map((plugin) => String(isSetString(plugin) ? plugin : isSetObject(plugin) && isSetString(plugin.name) ? plugin.name : Array.isArray(plugin) && isSetString(plugin[0]) ? plugin[0] : "<function-plugin>")) : []
|
|
30
|
+
}).sort(([key1], [key2]) => key1.localeCompare(key2))), null, 4).replace(/"([^"]+)":/g, "$1:").replace(/,\s*$/g, "");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { formatConfig };
|
|
35
|
+
//# sourceMappingURL=format.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.mjs","names":[],"sources":["../../src/plugin-utils/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 { toArray } from \"@stryke/convert/to-array\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { ResolveConfig, ResolvedConfig } from \"../types/config\";\n\n/**\n * Formats a configuration object into a human-readable string, omitting certain properties and simplifying others for better readability.\n *\n * @param config - The configuration object to format.\n * @returns A formatted string representation of the configuration.\n */\nexport function formatConfig(config: Record<string, any>): string {\n return JSON.stringify(\n Object.fromEntries(\n Object.entries({\n ...omit(config, [\n \"plugins\",\n \"initialConfig\",\n \"userConfig\",\n \"inlineConfig\",\n \"pluginConfig\",\n \"environmentConfig\"\n ]),\n resolve: {\n ...config.resolve,\n external: ((config.resolve as ResolveConfig)?.external ?? [])\n .filter(Boolean)\n .map(external =>\n isSetString(external)\n ? external\n : isRegExp(external)\n ? external.source\n : \"<unknown-external>\"\n ),\n noExternal: ((config.resolve as ResolveConfig)?.noExternal ?? [])\n .filter(Boolean)\n .map(noExternal =>\n isSetString(noExternal)\n ? noExternal\n : isRegExp(noExternal)\n ? noExternal.source\n : \"<unknown-no-external>\"\n )\n },\n plugins: config.plugins\n ? (toArray(config.plugins) as ResolvedConfig[\"plugins\"])\n ?.flatMap(plugin => toArray(plugin))\n ?.map(plugin =>\n String(\n isSetString(plugin)\n ? plugin\n : isSetObject(plugin) &&\n isSetString((plugin as { name: string }).name)\n ? (plugin as { name: string }).name\n : Array.isArray(plugin) && isSetString(plugin[0])\n ? plugin[0]\n : \"<function-plugin>\"\n )\n )\n : []\n }).sort(([key1], [key2]) => key1.localeCompare(key2))\n ),\n null,\n 4\n )\n .replace(/\"([^\"]+)\":/g, \"$1:\")\n .replace(/,\\s*$/g, \"\");\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,SAAgB,aAAa,QAAqC;AAChE,QAAO,KAAK,UACV,OAAO,YACL,OAAO,QAAQ;EACb,GAAG,KAAK,QAAQ;GACd;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;EACF,SAAS;GACP,GAAG,OAAO;GACV,WAAY,OAAO,SAA2B,YAAY,EAAE,EACzD,OAAO,QAAQ,CACf,KAAI,aACH,YAAY,SAAS,GACjB,WACA,SAAS,SAAS,GAChB,SAAS,SACT,qBACP;GACH,aAAc,OAAO,SAA2B,cAAc,EAAE,EAC7D,OAAO,QAAQ,CACf,KAAI,eACH,YAAY,WAAW,GACnB,aACA,SAAS,WAAW,GAClB,WAAW,SACX,wBACP;GACJ;EACD,SAAS,OAAO,UACX,QAAQ,OAAO,QAAQ,EACpB,SAAQ,WAAU,QAAQ,OAAO,CAAC,EAClC,KAAI,WACJ,OACE,YAAY,OAAO,GACf,SACA,YAAY,OAAO,IACjB,YAAa,OAA4B,KAAK,GAC7C,OAA4B,OAC7B,MAAM,QAAQ,OAAO,IAAI,YAAY,OAAO,GAAG,GAC7C,OAAO,KACP,oBACT,CACF,GACH,EAAE;EACP,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,KAAK,cAAc,KAAK,CAAC,CACtD,EACD,MACA,EACD,CACE,QAAQ,eAAe,MAAM,CAC7B,QAAQ,UAAU,GAAG"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_plugin_utils_paths = require('./paths.cjs');
|
|
3
|
-
const require_plugin_utils_format_package_json = require('./format-package-json.cjs');
|
|
4
3
|
const require_plugin_utils_build_helpers = require('./build-helpers.cjs');
|
|
5
4
|
const require_plugin_utils_helpers = require('./helpers.cjs');
|
|
6
5
|
const require_plugin_utils_merge = require('./merge.cjs');
|
|
@@ -9,11 +8,17 @@ const require_plugin_utils_context_helpers = require('./context-helpers.cjs');
|
|
|
9
8
|
const require_plugin_utils_docs_helper = require('./docs-helper.cjs');
|
|
10
9
|
const require_plugin_utils_extend = require('./extend.cjs');
|
|
11
10
|
const require_plugin_utils_filter = require('./filter.cjs');
|
|
11
|
+
const require_plugin_utils_format = require('./format.cjs');
|
|
12
|
+
const require_plugin_utils_format_package_json = require('./format-package-json.cjs');
|
|
12
13
|
const require_plugin_utils_get_config_path = require('./get-config-path.cjs');
|
|
13
14
|
const require_plugin_utils_logging = require('./logging.cjs');
|
|
14
15
|
const require_plugin_utils_modules = require('./modules.cjs');
|
|
16
|
+
const require_plugin_utils_virtual = require('./virtual.cjs');
|
|
15
17
|
|
|
18
|
+
exports.VIRTUAL_MODULE_PREFIX = require_plugin_utils_virtual.VIRTUAL_MODULE_PREFIX;
|
|
19
|
+
exports.VIRTUAL_MODULE_PREFIX_REGEX = require_plugin_utils_virtual.VIRTUAL_MODULE_PREFIX_REGEX;
|
|
16
20
|
exports.addPluginHook = require_plugin_utils_helpers.addPluginHook;
|
|
21
|
+
exports.addVirtualPrefix = require_plugin_utils_virtual.addVirtualPrefix;
|
|
17
22
|
exports.colorBackground = require_plugin_utils_logging.colorBackground;
|
|
18
23
|
exports.colorText = require_plugin_utils_logging.colorText;
|
|
19
24
|
exports.combinePluginOptions = require_plugin_utils_combine_plugins.combinePluginOptions;
|
|
@@ -27,12 +32,14 @@ exports.createFilterForTransform = require_plugin_utils_filter.createFilterForTr
|
|
|
27
32
|
exports.createIdFilter = require_plugin_utils_filter.createIdFilter;
|
|
28
33
|
exports.createLogFn = require_plugin_utils_logging.createLogFn;
|
|
29
34
|
exports.createLogger = require_plugin_utils_logging.createLogger;
|
|
35
|
+
exports.createVirtualPrefixRegex = require_plugin_utils_virtual.createVirtualPrefixRegex;
|
|
30
36
|
exports.dedupeHooklist = require_plugin_utils_helpers.dedupeHooklist;
|
|
31
37
|
exports.extend = require_plugin_utils_extend.extend;
|
|
32
38
|
exports.extendLogFn = require_plugin_utils_logging.extendLogFn;
|
|
33
39
|
exports.extendLogger = require_plugin_utils_logging.extendLogger;
|
|
34
40
|
exports.extractPluginHook = require_plugin_utils_helpers.extractPluginHook;
|
|
35
41
|
exports.findInvalidPluginConfig = require_plugin_utils_helpers.findInvalidPluginConfig;
|
|
42
|
+
exports.formatConfig = require_plugin_utils_format.formatConfig;
|
|
36
43
|
exports.formatPackageJson = require_plugin_utils_format_package_json.formatPackageJson;
|
|
37
44
|
exports.getConfigPath = require_plugin_utils_get_config_path.getConfigPath;
|
|
38
45
|
exports.getDependencyConfig = require_plugin_utils_build_helpers.getDependencyConfig;
|
|
@@ -57,11 +64,13 @@ exports.isUnpluginHookKey = require_plugin_utils_helpers.isUnpluginHookKey;
|
|
|
57
64
|
exports.isValidLogLevel = require_plugin_utils_logging.isValidLogLevel;
|
|
58
65
|
exports.isValidLogLevelConfig = require_plugin_utils_logging.isValidLogLevelConfig;
|
|
59
66
|
exports.isVerbose = require_plugin_utils_logging.isVerbose;
|
|
67
|
+
exports.isVirtualModule = require_plugin_utils_virtual.isVirtualModule;
|
|
60
68
|
exports.merge = require_plugin_utils_merge.merge;
|
|
61
69
|
exports.mergeConfig = require_plugin_utils_merge.mergeConfig;
|
|
62
70
|
exports.normalizeFilter = require_plugin_utils_filter.normalizeFilter;
|
|
63
71
|
exports.patternToCodeFilter = require_plugin_utils_filter.patternToCodeFilter;
|
|
64
72
|
exports.patternToIdFilter = require_plugin_utils_filter.patternToIdFilter;
|
|
73
|
+
exports.removeVirtualPrefix = require_plugin_utils_virtual.removeVirtualPrefix;
|
|
65
74
|
exports.replacePathTokens = require_plugin_utils_paths.replacePathTokens;
|
|
66
75
|
exports.resolveLogLevel = require_plugin_utils_logging.resolveLogLevel;
|
|
67
76
|
exports.withCustomLogger = require_plugin_utils_logging.withCustomLogger;
|
|
@@ -5,10 +5,12 @@ import { getDocsOutputPath } from "./docs-helper.cjs";
|
|
|
5
5
|
import { extend } from "./extend.cjs";
|
|
6
6
|
import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.cjs";
|
|
7
7
|
import { formatPackageJson } from "./format-package-json.cjs";
|
|
8
|
+
import { formatConfig } from "./format.cjs";
|
|
8
9
|
import { getConfigPath } from "./get-config-path.cjs";
|
|
9
10
|
import { GetHookHandlerReturnType, __ΩGetHookHandlerReturnType, addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.cjs";
|
|
10
11
|
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.cjs";
|
|
11
12
|
import { MergeResult, __ΩMergeResult, merge, mergeConfig } from "./merge.cjs";
|
|
12
13
|
import { isBuiltinModule } from "./modules.cjs";
|
|
13
14
|
import { replacePathTokens } from "./paths.cjs";
|
|
14
|
-
|
|
15
|
+
import { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, removeVirtualPrefix } from "./virtual.cjs";
|
|
16
|
+
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, addVirtualPrefix, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, createVirtualPrefixRegex, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, isVirtualModule, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, removeVirtualPrefix, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
@@ -5,10 +5,12 @@ import { getDocsOutputPath } from "./docs-helper.mjs";
|
|
|
5
5
|
import { extend } from "./extend.mjs";
|
|
6
6
|
import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
|
|
7
7
|
import { formatPackageJson } from "./format-package-json.mjs";
|
|
8
|
+
import { formatConfig } from "./format.mjs";
|
|
8
9
|
import { getConfigPath } from "./get-config-path.mjs";
|
|
9
10
|
import { GetHookHandlerReturnType, __ΩGetHookHandlerReturnType, addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.mjs";
|
|
10
11
|
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.mjs";
|
|
11
12
|
import { MergeResult, __ΩMergeResult, merge, mergeConfig } from "./merge.mjs";
|
|
12
13
|
import { isBuiltinModule } from "./modules.mjs";
|
|
13
14
|
import { replacePathTokens } from "./paths.mjs";
|
|
14
|
-
|
|
15
|
+
import { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, removeVirtualPrefix } from "./virtual.mjs";
|
|
16
|
+
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, addVirtualPrefix, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, createVirtualPrefixRegex, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, isVirtualModule, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, removeVirtualPrefix, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { replacePathTokens } from "./paths.mjs";
|
|
2
|
-
import { formatPackageJson } from "./format-package-json.mjs";
|
|
3
2
|
import { getDependencyConfig } from "./build-helpers.mjs";
|
|
4
3
|
import { addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.mjs";
|
|
5
4
|
import { merge, mergeConfig } from "./merge.mjs";
|
|
@@ -8,8 +7,11 @@ import { getOrganizationName, getPackageJsonOrganization, getWorkspaceName } fro
|
|
|
8
7
|
import { getDocsOutputPath } from "./docs-helper.mjs";
|
|
9
8
|
import { extend } from "./extend.mjs";
|
|
10
9
|
import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
|
|
10
|
+
import { formatConfig } from "./format.mjs";
|
|
11
|
+
import { formatPackageJson } from "./format-package-json.mjs";
|
|
11
12
|
import { getConfigPath } from "./get-config-path.mjs";
|
|
12
13
|
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.mjs";
|
|
13
14
|
import { isBuiltinModule } from "./modules.mjs";
|
|
15
|
+
import { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, removeVirtualPrefix } from "./virtual.mjs";
|
|
14
16
|
|
|
15
|
-
export { addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
17
|
+
export { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addPluginHook, addVirtualPrefix, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, createVirtualPrefixRegex, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, isVirtualModule, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, removeVirtualPrefix, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
@@ -7,9 +7,9 @@ let defu = require("defu");
|
|
|
7
7
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
8
8
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
9
|
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
10
|
-
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
11
10
|
let _storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
|
|
12
11
|
let _storm_software_config_tools_utilities_colors = require("@storm-software/config-tools/utilities/colors");
|
|
12
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
13
13
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
14
14
|
let chalk = require("chalk");
|
|
15
15
|
chalk = require_runtime.__toESM(chalk, 1);
|
|
@@ -5,9 +5,9 @@ import { defu as defu$1 } from "defu";
|
|
|
5
5
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
6
6
|
import { isString } from "@stryke/type-checks/is-string";
|
|
7
7
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
8
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
9
8
|
import { getLogFn, getLogLevel } from "@storm-software/config-tools/logger";
|
|
10
9
|
import { getColor } from "@storm-software/config-tools/utilities/colors";
|
|
10
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
11
11
|
import { uuid } from "@stryke/unique-id/uuid";
|
|
12
12
|
import chalk from "chalk";
|
|
13
13
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _rolldown_pluginutils = require("@rolldown/pluginutils");
|
|
4
|
+
|
|
5
|
+
//#region src/plugin-utils/virtual.ts
|
|
6
|
+
const VIRTUAL_MODULE_PREFIX = "\0";
|
|
7
|
+
const VIRTUAL_MODULE_PREFIX_REGEX = (0, _rolldown_pluginutils.prefixRegex)("\0");
|
|
8
|
+
/**
|
|
9
|
+
* Adds the virtual module prefix to the given ID.
|
|
10
|
+
*
|
|
11
|
+
* @param id - The ID to add the virtual module prefix to.
|
|
12
|
+
* @returns The ID with the virtual module prefix added.
|
|
13
|
+
*/
|
|
14
|
+
function addVirtualPrefix(id) {
|
|
15
|
+
return `${"\0"}${id}`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Removes the virtual module prefix from the given ID, if it exists.
|
|
19
|
+
*
|
|
20
|
+
* @param id - The ID to remove the virtual module prefix from.
|
|
21
|
+
* @returns The ID without the virtual module prefix.
|
|
22
|
+
*/
|
|
23
|
+
function removeVirtualPrefix(id) {
|
|
24
|
+
return id.replace(VIRTUAL_MODULE_PREFIX_REGEX, "");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the given ID is a virtual module by checking if it starts with the virtual module prefix.
|
|
28
|
+
*
|
|
29
|
+
* @param id - The ID to check.
|
|
30
|
+
* @returns True if the ID is a virtual module, false otherwise.
|
|
31
|
+
*/
|
|
32
|
+
function isVirtualModule(id) {
|
|
33
|
+
return id.startsWith("\0");
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a regular expression that matches the given ID with the virtual module prefix.
|
|
37
|
+
*
|
|
38
|
+
* @param id - The ID to create a regular expression for.
|
|
39
|
+
* @returns A regular expression that matches the given ID with the virtual module prefix.
|
|
40
|
+
*/
|
|
41
|
+
function createVirtualPrefixRegex(id) {
|
|
42
|
+
return (0, _rolldown_pluginutils.prefixRegex)(addVirtualPrefix(removeVirtualPrefix(id)));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.VIRTUAL_MODULE_PREFIX = VIRTUAL_MODULE_PREFIX;
|
|
47
|
+
exports.VIRTUAL_MODULE_PREFIX_REGEX = VIRTUAL_MODULE_PREFIX_REGEX;
|
|
48
|
+
exports.addVirtualPrefix = addVirtualPrefix;
|
|
49
|
+
exports.createVirtualPrefixRegex = createVirtualPrefixRegex;
|
|
50
|
+
exports.isVirtualModule = isVirtualModule;
|
|
51
|
+
exports.removeVirtualPrefix = removeVirtualPrefix;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/plugin-utils/virtual.d.ts
|
|
2
|
+
declare const VIRTUAL_MODULE_PREFIX = "\0";
|
|
3
|
+
declare const VIRTUAL_MODULE_PREFIX_REGEX: RegExp;
|
|
4
|
+
/**
|
|
5
|
+
* Adds the virtual module prefix to the given ID.
|
|
6
|
+
*
|
|
7
|
+
* @param id - The ID to add the virtual module prefix to.
|
|
8
|
+
* @returns The ID with the virtual module prefix added.
|
|
9
|
+
*/
|
|
10
|
+
declare function addVirtualPrefix(id: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Removes the virtual module prefix from the given ID, if it exists.
|
|
13
|
+
*
|
|
14
|
+
* @param id - The ID to remove the virtual module prefix from.
|
|
15
|
+
* @returns The ID without the virtual module prefix.
|
|
16
|
+
*/
|
|
17
|
+
declare function removeVirtualPrefix(id: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if the given ID is a virtual module by checking if it starts with the virtual module prefix.
|
|
20
|
+
*
|
|
21
|
+
* @param id - The ID to check.
|
|
22
|
+
* @returns True if the ID is a virtual module, false otherwise.
|
|
23
|
+
*/
|
|
24
|
+
declare function isVirtualModule(id: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a regular expression that matches the given ID with the virtual module prefix.
|
|
27
|
+
*
|
|
28
|
+
* @param id - The ID to create a regular expression for.
|
|
29
|
+
* @returns A regular expression that matches the given ID with the virtual module prefix.
|
|
30
|
+
*/
|
|
31
|
+
declare function createVirtualPrefixRegex(id: string): RegExp;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, removeVirtualPrefix };
|
|
34
|
+
//# sourceMappingURL=virtual.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual.d.cts","names":[],"sources":["../../src/plugin-utils/virtual.ts"],"mappings":";cAoBa,qBAAA;AAAA,cACA,2BAAA,EAA2B,MAAA;;;;;AAAxC;;iBAQgB,gBAAA,CAAiB,EAAA;;;AAAjC;;;;iBAUgB,mBAAA,CAAoB,EAAA;AAApC;;;;;AAUA;AAVA,iBAUgB,eAAA,CAAgB,EAAA;;;;AAUhC;;;iBAAgB,wBAAA,CAAyB,EAAA,WAAa,MAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/plugin-utils/virtual.d.ts
|
|
2
|
+
declare const VIRTUAL_MODULE_PREFIX = "\0";
|
|
3
|
+
declare const VIRTUAL_MODULE_PREFIX_REGEX: RegExp;
|
|
4
|
+
/**
|
|
5
|
+
* Adds the virtual module prefix to the given ID.
|
|
6
|
+
*
|
|
7
|
+
* @param id - The ID to add the virtual module prefix to.
|
|
8
|
+
* @returns The ID with the virtual module prefix added.
|
|
9
|
+
*/
|
|
10
|
+
declare function addVirtualPrefix(id: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Removes the virtual module prefix from the given ID, if it exists.
|
|
13
|
+
*
|
|
14
|
+
* @param id - The ID to remove the virtual module prefix from.
|
|
15
|
+
* @returns The ID without the virtual module prefix.
|
|
16
|
+
*/
|
|
17
|
+
declare function removeVirtualPrefix(id: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if the given ID is a virtual module by checking if it starts with the virtual module prefix.
|
|
20
|
+
*
|
|
21
|
+
* @param id - The ID to check.
|
|
22
|
+
* @returns True if the ID is a virtual module, false otherwise.
|
|
23
|
+
*/
|
|
24
|
+
declare function isVirtualModule(id: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a regular expression that matches the given ID with the virtual module prefix.
|
|
27
|
+
*
|
|
28
|
+
* @param id - The ID to create a regular expression for.
|
|
29
|
+
* @returns A regular expression that matches the given ID with the virtual module prefix.
|
|
30
|
+
*/
|
|
31
|
+
declare function createVirtualPrefixRegex(id: string): RegExp;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, removeVirtualPrefix };
|
|
34
|
+
//# sourceMappingURL=virtual.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual.d.mts","names":[],"sources":["../../src/plugin-utils/virtual.ts"],"mappings":";cAoBa,qBAAA;AAAA,cACA,2BAAA,EAA2B,MAAA;;;;;AAAxC;;iBAQgB,gBAAA,CAAiB,EAAA;;;AAAjC;;;;iBAUgB,mBAAA,CAAoB,EAAA;AAApC;;;;;AAUA;AAVA,iBAUgB,eAAA,CAAgB,EAAA;;;;AAUhC;;;iBAAgB,wBAAA,CAAyB,EAAA,WAAa,MAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { prefixRegex } from "@rolldown/pluginutils";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin-utils/virtual.ts
|
|
4
|
+
const VIRTUAL_MODULE_PREFIX = "\0";
|
|
5
|
+
const VIRTUAL_MODULE_PREFIX_REGEX = prefixRegex("\0");
|
|
6
|
+
/**
|
|
7
|
+
* Adds the virtual module prefix to the given ID.
|
|
8
|
+
*
|
|
9
|
+
* @param id - The ID to add the virtual module prefix to.
|
|
10
|
+
* @returns The ID with the virtual module prefix added.
|
|
11
|
+
*/
|
|
12
|
+
function addVirtualPrefix(id) {
|
|
13
|
+
return `${"\0"}${id}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Removes the virtual module prefix from the given ID, if it exists.
|
|
17
|
+
*
|
|
18
|
+
* @param id - The ID to remove the virtual module prefix from.
|
|
19
|
+
* @returns The ID without the virtual module prefix.
|
|
20
|
+
*/
|
|
21
|
+
function removeVirtualPrefix(id) {
|
|
22
|
+
return id.replace(VIRTUAL_MODULE_PREFIX_REGEX, "");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the given ID is a virtual module by checking if it starts with the virtual module prefix.
|
|
26
|
+
*
|
|
27
|
+
* @param id - The ID to check.
|
|
28
|
+
* @returns True if the ID is a virtual module, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
function isVirtualModule(id) {
|
|
31
|
+
return id.startsWith("\0");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a regular expression that matches the given ID with the virtual module prefix.
|
|
35
|
+
*
|
|
36
|
+
* @param id - The ID to create a regular expression for.
|
|
37
|
+
* @returns A regular expression that matches the given ID with the virtual module prefix.
|
|
38
|
+
*/
|
|
39
|
+
function createVirtualPrefixRegex(id) {
|
|
40
|
+
return prefixRegex(addVirtualPrefix(removeVirtualPrefix(id)));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, removeVirtualPrefix };
|
|
45
|
+
//# sourceMappingURL=virtual.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual.mjs","names":[],"sources":["../../src/plugin-utils/virtual.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 { prefixRegex } from \"@rolldown/pluginutils\";\n\nexport const VIRTUAL_MODULE_PREFIX = \"\\0\";\nexport const VIRTUAL_MODULE_PREFIX_REGEX = prefixRegex(\"\\0\");\n\n/**\n * Adds the virtual module prefix to the given ID.\n *\n * @param id - The ID to add the virtual module prefix to.\n * @returns The ID with the virtual module prefix added.\n */\nexport function addVirtualPrefix(id: string): string {\n return `${VIRTUAL_MODULE_PREFIX}${id}`;\n}\n\n/**\n * Removes the virtual module prefix from the given ID, if it exists.\n *\n * @param id - The ID to remove the virtual module prefix from.\n * @returns The ID without the virtual module prefix.\n */\nexport function removeVirtualPrefix(id: string): string {\n return id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\");\n}\n\n/**\n * Checks if the given ID is a virtual module by checking if it starts with the virtual module prefix.\n *\n * @param id - The ID to check.\n * @returns True if the ID is a virtual module, false otherwise.\n */\nexport function isVirtualModule(id: string): boolean {\n return id.startsWith(VIRTUAL_MODULE_PREFIX);\n}\n\n/**\n * Creates a regular expression that matches the given ID with the virtual module prefix.\n *\n * @param id - The ID to create a regular expression for.\n * @returns A regular expression that matches the given ID with the virtual module prefix.\n */\nexport function createVirtualPrefixRegex(id: string): RegExp {\n return prefixRegex(addVirtualPrefix(removeVirtualPrefix(id)));\n}\n"],"mappings":";;;AAoBA,MAAa,wBAAwB;AACrC,MAAa,8BAA8B,YAAY,KAAK;;;;;;;AAQ5D,SAAgB,iBAAiB,IAAoB;AACnD,QAAO,UAA2B;;;;;;;;AASpC,SAAgB,oBAAoB,IAAoB;AACtD,QAAO,GAAG,QAAQ,6BAA6B,GAAG;;;;;;;;AASpD,SAAgB,gBAAgB,IAAqB;AACnD,QAAO,GAAG,gBAAiC;;;;;;;;AAS7C,SAAgB,yBAAyB,IAAoB;AAC3D,QAAO,YAAY,iBAAiB,oBAAoB,GAAG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
|
|
6
6
|
"homepage": "https://stormsoftware.com",
|
|
@@ -76,10 +76,6 @@
|
|
|
76
76
|
"import": "./dist/constants/plugin.mjs",
|
|
77
77
|
"require": "./dist/constants/plugin.cjs"
|
|
78
78
|
},
|
|
79
|
-
"./constants/virtual-modules": {
|
|
80
|
-
"import": "./dist/constants/virtual-modules.mjs",
|
|
81
|
-
"require": "./dist/constants/virtual-modules.cjs"
|
|
82
|
-
},
|
|
83
79
|
"./lib": {
|
|
84
80
|
"import": "./dist/lib/index.mjs",
|
|
85
81
|
"require": "./dist/lib/index.cjs"
|
|
@@ -164,6 +160,10 @@
|
|
|
164
160
|
"import": "./dist/plugin-utils/filter.mjs",
|
|
165
161
|
"require": "./dist/plugin-utils/filter.cjs"
|
|
166
162
|
},
|
|
163
|
+
"./plugin-utils/format": {
|
|
164
|
+
"import": "./dist/plugin-utils/format.mjs",
|
|
165
|
+
"require": "./dist/plugin-utils/format.cjs"
|
|
166
|
+
},
|
|
167
167
|
"./plugin-utils/format-package-json": {
|
|
168
168
|
"import": "./dist/plugin-utils/format-package-json.mjs",
|
|
169
169
|
"require": "./dist/plugin-utils/format-package-json.cjs"
|
|
@@ -192,6 +192,10 @@
|
|
|
192
192
|
"import": "./dist/plugin-utils/paths.mjs",
|
|
193
193
|
"require": "./dist/plugin-utils/paths.cjs"
|
|
194
194
|
},
|
|
195
|
+
"./plugin-utils/virtual": {
|
|
196
|
+
"import": "./dist/plugin-utils/virtual.mjs",
|
|
197
|
+
"require": "./dist/plugin-utils/virtual.cjs"
|
|
198
|
+
},
|
|
195
199
|
"./types/_internal": {
|
|
196
200
|
"import": "./dist/types/_internal.mjs",
|
|
197
201
|
"require": "./dist/types/_internal.cjs"
|
|
@@ -238,5 +242,5 @@
|
|
|
238
242
|
"typescript": "^6.0.3"
|
|
239
243
|
},
|
|
240
244
|
"publishConfig": { "access": "public" },
|
|
241
|
-
"gitHead": "
|
|
245
|
+
"gitHead": "3ffdf81ad60da786acd42f9b750df6c7837f8003"
|
|
242
246
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _rolldown_pluginutils = require("@rolldown/pluginutils");
|
|
4
|
-
|
|
5
|
-
//#region src/constants/virtual-modules.ts
|
|
6
|
-
const VIRTUAL_MODULE_PREFIX = "\0";
|
|
7
|
-
const VIRTUAL_MODULE_PREFIX_REGEX = (0, _rolldown_pluginutils.prefixRegex)("\0");
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
exports.VIRTUAL_MODULE_PREFIX = VIRTUAL_MODULE_PREFIX;
|
|
11
|
-
exports.VIRTUAL_MODULE_PREFIX_REGEX = VIRTUAL_MODULE_PREFIX_REGEX;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
//#region src/constants/virtual-modules.d.ts
|
|
2
|
-
declare const VIRTUAL_MODULE_PREFIX = "\0";
|
|
3
|
-
declare const VIRTUAL_MODULE_PREFIX_REGEX: RegExp;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX };
|
|
6
|
-
//# sourceMappingURL=virtual-modules.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-modules.d.cts","names":[],"sources":["../../src/constants/virtual-modules.ts"],"mappings":";cAoBa,qBAAA;AAAA,cACA,2BAAA,EAA2B,MAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
//#region src/constants/virtual-modules.d.ts
|
|
2
|
-
declare const VIRTUAL_MODULE_PREFIX = "\0";
|
|
3
|
-
declare const VIRTUAL_MODULE_PREFIX_REGEX: RegExp;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX };
|
|
6
|
-
//# sourceMappingURL=virtual-modules.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-modules.d.mts","names":[],"sources":["../../src/constants/virtual-modules.ts"],"mappings":";cAoBa,qBAAA;AAAA,cACA,2BAAA,EAA2B,MAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { prefixRegex } from "@rolldown/pluginutils";
|
|
2
|
-
|
|
3
|
-
//#region src/constants/virtual-modules.ts
|
|
4
|
-
const VIRTUAL_MODULE_PREFIX = "\0";
|
|
5
|
-
const VIRTUAL_MODULE_PREFIX_REGEX = prefixRegex("\0");
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX };
|
|
9
|
-
//# sourceMappingURL=virtual-modules.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-modules.mjs","names":[],"sources":["../../src/constants/virtual-modules.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { prefixRegex } from \"@rolldown/pluginutils\";\n\nexport const VIRTUAL_MODULE_PREFIX = \"\\0\";\nexport const VIRTUAL_MODULE_PREFIX_REGEX = prefixRegex(\"\\0\");\n"],"mappings":";;;AAoBA,MAAa,wBAAwB;AACrC,MAAa,8BAA8B,YAAY,KAAK"}
|