@powerlines/core 0.44.1 → 0.44.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/api.cjs +1 -0
- package/dist/constants/commands.cjs +3 -2
- package/dist/constants/environments.cjs +1 -0
- package/dist/constants/fs.cjs +1 -0
- package/dist/constants/hooks.cjs +1 -0
- package/dist/constants/index.cjs +34 -34
- package/dist/constants/index.mjs +1 -1
- package/dist/constants/log-level.cjs +3 -2
- package/dist/constants/log-level.d.cts +2 -2
- package/dist/constants/log-level.d.mts +2 -2
- package/dist/constants/log-level.mjs +2 -2
- package/dist/constants/log-level.mjs.map +1 -1
- package/dist/constants/meta.cjs +1 -0
- package/dist/constants/plugin.cjs +3 -2
- package/dist/constants/virtual-modules.cjs +1 -0
- package/dist/lib/unplugin/helpers.cjs +2 -2
- package/dist/lib/unplugin/module-resolution.cjs +10 -9
- package/dist/lib/unplugin/module-resolution.mjs +1 -0
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +3 -2
- package/dist/lib/unplugin/plugin.mjs +1 -0
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/plugin-utils/helpers.cjs +5 -5
- package/dist/plugin-utils/logging.cjs +107 -11
- package/dist/plugin-utils/logging.d.cts.map +1 -1
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +103 -7
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +1 -1
- package/dist/plugin-utils/paths.mjs +1 -1
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/types/logging.d.cts +2 -1
- package/dist/types/logging.d.cts.map +1 -1
- package/dist/types/logging.d.mts +2 -1
- package/dist/types/logging.d.mts.map +1 -1
- package/dist/types/logging.mjs.map +1 -1
- package/package.json +38 -2
package/dist/constants/api.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_constants_api = require('./api.cjs');
|
|
2
3
|
|
|
3
4
|
//#region src/constants/commands.ts
|
|
4
|
-
const SUPPORTED_COMMANDS = [...
|
|
5
|
+
const SUPPORTED_COMMANDS = [...require_constants_api.POWERLINES_API_FUNCTIONS, "finalize"];
|
|
5
6
|
|
|
6
7
|
//#endregion
|
|
7
8
|
exports.SUPPORTED_COMMANDS = SUPPORTED_COMMANDS;
|
package/dist/constants/fs.cjs
CHANGED
package/dist/constants/hooks.cjs
CHANGED
package/dist/constants/index.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
2
|
+
const require_constants_api = require('./api.cjs');
|
|
3
|
+
const require_constants_commands = require('./commands.cjs');
|
|
4
|
+
const require_constants_plugin = require('./plugin.cjs');
|
|
5
|
+
const require_constants_environments = require('./environments.cjs');
|
|
6
|
+
const require_constants_fs = require('./fs.cjs');
|
|
7
|
+
const require_constants_hooks = require('./hooks.cjs');
|
|
8
|
+
const require_constants_log_level = require('./log-level.cjs');
|
|
9
|
+
const require_constants_meta = require('./meta.cjs');
|
|
10
|
+
const require_constants_virtual_modules = require('./virtual-modules.cjs');
|
|
11
11
|
|
|
12
|
-
exports.BASE_API_FUNCTIONS =
|
|
13
|
-
exports.BUILDER_VARIANTS =
|
|
14
|
-
exports.CACHE_HASH_LENGTH =
|
|
15
|
-
exports.CLIENT_ENVIRONMENT =
|
|
16
|
-
exports.DEFAULT_DEVELOPMENT_LOG_LEVEL =
|
|
17
|
-
exports.DEFAULT_ENVIRONMENT =
|
|
18
|
-
exports.DEFAULT_PRODUCTION_LOG_LEVEL =
|
|
19
|
-
exports.DEFAULT_TEST_LOG_LEVEL =
|
|
20
|
-
exports.GLOBAL_ENVIRONMENT =
|
|
21
|
-
exports.HOOKS_LIST_ORDERS =
|
|
22
|
-
exports.KNOWN_PLUGIN_FIELDS =
|
|
23
|
-
exports.PLUGIN_HOOKS_FIELDS =
|
|
24
|
-
exports.PLUGIN_NON_HOOK_FIELDS =
|
|
25
|
-
exports.POWERLINES_API_FUNCTIONS =
|
|
26
|
-
exports.ROOT_HASH_LENGTH =
|
|
27
|
-
exports.RSC_ENVIRONMENT =
|
|
28
|
-
exports.SERVER_ENVIRONMENT =
|
|
29
|
-
exports.SSR_ENVIRONMENT =
|
|
30
|
-
exports.STORAGE_PRESETS =
|
|
31
|
-
exports.SUPPORTED_COMMANDS =
|
|
32
|
-
exports.UNPLUGIN_BUILDER_VARIANTS =
|
|
33
|
-
exports.VIRTUAL_MODULE_PREFIX =
|
|
34
|
-
exports.VIRTUAL_MODULE_PREFIX_REGEX =
|
|
35
|
-
exports.__VFS_PATCH__ =
|
|
36
|
-
exports.__VFS_REVERT__ =
|
|
12
|
+
exports.BASE_API_FUNCTIONS = require_constants_api.BASE_API_FUNCTIONS;
|
|
13
|
+
exports.BUILDER_VARIANTS = require_constants_plugin.BUILDER_VARIANTS;
|
|
14
|
+
exports.CACHE_HASH_LENGTH = require_constants_meta.CACHE_HASH_LENGTH;
|
|
15
|
+
exports.CLIENT_ENVIRONMENT = require_constants_environments.CLIENT_ENVIRONMENT;
|
|
16
|
+
exports.DEFAULT_DEVELOPMENT_LOG_LEVEL = require_constants_log_level.DEFAULT_DEVELOPMENT_LOG_LEVEL;
|
|
17
|
+
exports.DEFAULT_ENVIRONMENT = require_constants_environments.DEFAULT_ENVIRONMENT;
|
|
18
|
+
exports.DEFAULT_PRODUCTION_LOG_LEVEL = require_constants_log_level.DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
19
|
+
exports.DEFAULT_TEST_LOG_LEVEL = require_constants_log_level.DEFAULT_TEST_LOG_LEVEL;
|
|
20
|
+
exports.GLOBAL_ENVIRONMENT = require_constants_environments.GLOBAL_ENVIRONMENT;
|
|
21
|
+
exports.HOOKS_LIST_ORDERS = require_constants_hooks.HOOKS_LIST_ORDERS;
|
|
22
|
+
exports.KNOWN_PLUGIN_FIELDS = require_constants_plugin.KNOWN_PLUGIN_FIELDS;
|
|
23
|
+
exports.PLUGIN_HOOKS_FIELDS = require_constants_plugin.PLUGIN_HOOKS_FIELDS;
|
|
24
|
+
exports.PLUGIN_NON_HOOK_FIELDS = require_constants_plugin.PLUGIN_NON_HOOK_FIELDS;
|
|
25
|
+
exports.POWERLINES_API_FUNCTIONS = require_constants_api.POWERLINES_API_FUNCTIONS;
|
|
26
|
+
exports.ROOT_HASH_LENGTH = require_constants_meta.ROOT_HASH_LENGTH;
|
|
27
|
+
exports.RSC_ENVIRONMENT = require_constants_environments.RSC_ENVIRONMENT;
|
|
28
|
+
exports.SERVER_ENVIRONMENT = require_constants_environments.SERVER_ENVIRONMENT;
|
|
29
|
+
exports.SSR_ENVIRONMENT = require_constants_environments.SSR_ENVIRONMENT;
|
|
30
|
+
exports.STORAGE_PRESETS = require_constants_fs.STORAGE_PRESETS;
|
|
31
|
+
exports.SUPPORTED_COMMANDS = require_constants_commands.SUPPORTED_COMMANDS;
|
|
32
|
+
exports.UNPLUGIN_BUILDER_VARIANTS = require_constants_plugin.UNPLUGIN_BUILDER_VARIANTS;
|
|
33
|
+
exports.VIRTUAL_MODULE_PREFIX = require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX;
|
|
34
|
+
exports.VIRTUAL_MODULE_PREFIX_REGEX = require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX_REGEX;
|
|
35
|
+
exports.__VFS_PATCH__ = require_constants_fs.__VFS_PATCH__;
|
|
36
|
+
exports.__VFS_REVERT__ = require_constants_fs.__VFS_REVERT__;
|
package/dist/constants/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
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
|
-
import { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX } from "./virtual-modules.mjs";
|
|
5
4
|
import { CLIENT_ENVIRONMENT, DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT, RSC_ENVIRONMENT, SERVER_ENVIRONMENT, SSR_ENVIRONMENT } from "./environments.mjs";
|
|
6
5
|
import { STORAGE_PRESETS, __VFS_PATCH__, __VFS_REVERT__ } from "./fs.mjs";
|
|
7
6
|
import { HOOKS_LIST_ORDERS } from "./hooks.mjs";
|
|
8
7
|
import { DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL } from "./log-level.mjs";
|
|
9
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
10
|
|
|
11
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, 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__ };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
|
|
2
3
|
//#region src/constants/log-level.ts
|
|
3
4
|
const DEFAULT_DEVELOPMENT_LOG_LEVEL = {
|
|
4
5
|
general: "debug",
|
|
5
6
|
fs: "info",
|
|
6
|
-
config: "
|
|
7
|
+
config: "info",
|
|
7
8
|
plugins: "debug",
|
|
8
9
|
hooks: "debug",
|
|
9
10
|
performance: "debug",
|
|
10
11
|
env: "debug",
|
|
11
|
-
ipc: "
|
|
12
|
+
ipc: "debug",
|
|
12
13
|
network: "debug",
|
|
13
14
|
babel: "debug"
|
|
14
15
|
};
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
|
|
3
3
|
readonly general: "debug";
|
|
4
4
|
readonly fs: "info";
|
|
5
|
-
readonly config: "
|
|
5
|
+
readonly config: "info";
|
|
6
6
|
readonly plugins: "debug";
|
|
7
7
|
readonly hooks: "debug";
|
|
8
8
|
readonly performance: "debug";
|
|
9
9
|
readonly env: "debug";
|
|
10
|
-
readonly ipc: "
|
|
10
|
+
readonly ipc: "debug";
|
|
11
11
|
readonly network: "debug";
|
|
12
12
|
readonly babel: "debug";
|
|
13
13
|
};
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
|
|
3
3
|
readonly general: "debug";
|
|
4
4
|
readonly fs: "info";
|
|
5
|
-
readonly config: "
|
|
5
|
+
readonly config: "info";
|
|
6
6
|
readonly plugins: "debug";
|
|
7
7
|
readonly hooks: "debug";
|
|
8
8
|
readonly performance: "debug";
|
|
9
9
|
readonly env: "debug";
|
|
10
|
-
readonly ipc: "
|
|
10
|
+
readonly ipc: "debug";
|
|
11
11
|
readonly network: "debug";
|
|
12
12
|
readonly babel: "debug";
|
|
13
13
|
};
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
const DEFAULT_DEVELOPMENT_LOG_LEVEL = {
|
|
3
3
|
general: "debug",
|
|
4
4
|
fs: "info",
|
|
5
|
-
config: "
|
|
5
|
+
config: "info",
|
|
6
6
|
plugins: "debug",
|
|
7
7
|
hooks: "debug",
|
|
8
8
|
performance: "debug",
|
|
9
9
|
env: "debug",
|
|
10
|
-
ipc: "
|
|
10
|
+
ipc: "debug",
|
|
11
11
|
network: "debug",
|
|
12
12
|
babel: "debug"
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-level.mjs","names":[],"sources":["../../src/constants/log-level.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\nexport const DEFAULT_DEVELOPMENT_LOG_LEVEL = {\n general: \"debug\",\n fs: \"info\",\n config: \"
|
|
1
|
+
{"version":3,"file":"log-level.mjs","names":[],"sources":["../../src/constants/log-level.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\nexport const DEFAULT_DEVELOPMENT_LOG_LEVEL = {\n general: \"debug\",\n fs: \"info\",\n config: \"info\",\n plugins: \"debug\",\n hooks: \"debug\",\n performance: \"debug\",\n env: \"debug\",\n ipc: \"debug\",\n network: \"debug\",\n babel: \"debug\"\n} as const;\n\nexport const DEFAULT_TEST_LOG_LEVEL = {\n general: \"info\",\n fs: \"warn\",\n config: \"warn\",\n plugins: \"warn\",\n hooks: \"warn\",\n performance: \"info\",\n env: \"warn\",\n ipc: \"warn\",\n network: \"warn\",\n babel: \"warn\"\n} as const;\n\nexport const DEFAULT_PRODUCTION_LOG_LEVEL = {\n general: \"info\",\n fs: \"error\",\n config: \"warn\",\n plugins: \"warn\",\n hooks: \"warn\",\n performance: \"info\",\n env: \"error\",\n ipc: \"error\",\n network: \"error\",\n babel: \"warn\"\n} as const;\n"],"mappings":";AAkBA,MAAa,gCAAgC;CAC3C,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR;AAED,MAAa,yBAAyB;CACpC,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR;AAED,MAAa,+BAA+B;CAC1C,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR"}
|
package/dist/constants/meta.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_constants_commands = require('./commands.cjs');
|
|
2
3
|
|
|
3
4
|
//#region src/constants/plugin.ts
|
|
4
5
|
const UNPLUGIN_BUILDER_VARIANTS = [
|
|
@@ -26,7 +27,7 @@ const PLUGIN_NON_HOOK_FIELDS = [
|
|
|
26
27
|
"applyToEnvironment"
|
|
27
28
|
];
|
|
28
29
|
const PLUGIN_HOOKS_FIELDS = [
|
|
29
|
-
...
|
|
30
|
+
...require_constants_commands.SUPPORTED_COMMANDS,
|
|
30
31
|
"config",
|
|
31
32
|
"configEnvironment",
|
|
32
33
|
"configResolved",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const
|
|
3
|
+
const require_constants_plugin = require('../../constants/plugin.cjs');
|
|
4
4
|
let defu = require("defu");
|
|
5
5
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ function combineContexts(contextA, contextB) {
|
|
|
22
22
|
* @returns True if the value is a UnpluginBuilderVariant, false otherwise.
|
|
23
23
|
*/
|
|
24
24
|
function isUnpluginBuilderVariant(str) {
|
|
25
|
-
return (0, _stryke_type_checks_is_set_string.isSetString)(str) &&
|
|
25
|
+
return (0, _stryke_type_checks_is_set_string.isSetString)(str) && require_constants_plugin.UNPLUGIN_BUILDER_VARIANTS.includes(str);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const
|
|
3
|
+
const require_constants_virtual_modules = require('../../constants/virtual-modules.cjs');
|
|
4
|
+
require('../../constants/index.cjs');
|
|
4
5
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
5
6
|
let defu = require("defu");
|
|
6
7
|
defu = require_runtime.__toESM(defu, 1);
|
|
@@ -24,8 +25,8 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
24
25
|
const ctx = context;
|
|
25
26
|
return {
|
|
26
27
|
async resolveId(id, importer, opts = { isEntry: false }) {
|
|
27
|
-
const normalizedId = id.replace(
|
|
28
|
-
const normalizedImporter = importer ? importer.replace(
|
|
28
|
+
const normalizedId = id.replace(require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX_REGEX, "");
|
|
29
|
+
const normalizedImporter = importer ? importer.replace(require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX_REGEX, "") : void 0;
|
|
29
30
|
let result = await ctx.$$internal.callHook("resolveId", {
|
|
30
31
|
sequential: true,
|
|
31
32
|
result: "first",
|
|
@@ -34,7 +35,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
34
35
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
35
36
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
36
37
|
...result,
|
|
37
|
-
id: result.virtual && options.prefix !== false ? `${
|
|
38
|
+
id: result.virtual && options.prefix !== false ? `${require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
|
|
38
39
|
};
|
|
39
40
|
result = await ctx.$$internal.callHook("resolveId", {
|
|
40
41
|
sequential: true,
|
|
@@ -44,7 +45,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
44
45
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
45
46
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
46
47
|
...result,
|
|
47
|
-
id: result.virtual && options.prefix !== false ? `${
|
|
48
|
+
id: result.virtual && options.prefix !== false ? `${require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
|
|
48
49
|
};
|
|
49
50
|
result = await ctx.resolve(normalizedId, normalizedImporter, (0, defu.default)(options.overrides ?? {}, {
|
|
50
51
|
isFile: true,
|
|
@@ -52,7 +53,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
52
53
|
}));
|
|
53
54
|
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
54
55
|
...result,
|
|
55
|
-
id: result.virtual && options.prefix !== false ? `${
|
|
56
|
+
id: result.virtual && options.prefix !== false ? `${require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
|
|
56
57
|
};
|
|
57
58
|
result = await ctx.$$internal.callHook("resolveId", {
|
|
58
59
|
sequential: true,
|
|
@@ -62,14 +63,14 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
|
|
|
62
63
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
63
64
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
64
65
|
...result,
|
|
65
|
-
id: result.virtual && options.prefix !== false ? `${
|
|
66
|
+
id: result.virtual && options.prefix !== false ? `${require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX}${result.id}` : result.id
|
|
66
67
|
};
|
|
67
68
|
return null;
|
|
68
69
|
},
|
|
69
70
|
load: {
|
|
70
|
-
filter: options.prefix !== false ? { id: { include: [
|
|
71
|
+
filter: options.prefix !== false ? { id: { include: [require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX_REGEX] } } : void 0,
|
|
71
72
|
async handler(id) {
|
|
72
|
-
const normalizedId = id.replace(
|
|
73
|
+
const normalizedId = id.replace(require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX_REGEX, "");
|
|
73
74
|
let result = await ctx.$$internal.callHook("load", {
|
|
74
75
|
sequential: true,
|
|
75
76
|
result: "first",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX } from "../../constants/virtual-modules.mjs";
|
|
2
|
+
import "../../constants/index.mjs";
|
|
2
3
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
3
4
|
import defu from "defu";
|
|
4
5
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
@@ -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 VIRTUAL_MODULE_PREFIX,\n VIRTUAL_MODULE_PREFIX_REGEX\n} from \"../../constants
|
|
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 VIRTUAL_MODULE_PREFIX,\n VIRTUAL_MODULE_PREFIX_REGEX\n} from \"../../constants\";\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 = id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\");\n const normalizedImporter = importer\n ? importer.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\")\n : undefined;\n\n let result = await ctx.$$internal.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 ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : result.id\n };\n }\n\n result = await ctx.$$internal.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 ? `${VIRTUAL_MODULE_PREFIX}${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 ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : result.id\n };\n }\n\n result = await ctx.$$internal.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 ? `${VIRTUAL_MODULE_PREFIX}${result.id}`\n : result.id\n };\n }\n\n return null;\n },\n load: {\n filter:\n options.prefix !== false\n ? {\n id: {\n include: [VIRTUAL_MODULE_PREFIX_REGEX]\n }\n }\n : undefined,\n async handler(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const normalizedId = id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\");\n\n let result = await ctx.$$internal.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.$$internal.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.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId\n );\n }\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqEA,SAAgB,wCAGd,SACA,UAA0D,EAAE,EACf;CAC7C,MAAM,MAAM;AAEZ,QAAO;EACL,MAAM,UAEJ,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EAC8B;GACpD,MAAM,eAAe,GAAG,QAAQ,6BAA6B,GAAG;GAChE,MAAM,qBAAqB,WACvB,SAAS,QAAQ,6BAA6B,GAAG,GACjD;GAEJ,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,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,GAAG,wBAAwB,OAAO,OAClC,OAAO;IACd;AAGH,YAAS,MAAM,IAAI,WAAW,SAC5B,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,GAAG,wBAAwB,OAAO,OAClC,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,GAAG,wBAAwB,OAAO,OAClC,OAAO;IACd;AAGH,YAAS,MAAM,IAAI,WAAW,SAC5B,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,GAAG,wBAAwB,OAAO,OAClC,OAAO;IACd;AAGH,UAAO;;EAET,MAAM;GACJ,QACE,QAAQ,WAAW,QACf,EACE,IAAI,EACF,SAAS,CAAC,4BAA4B,EACvC,EACF,GACD;GACN,MAAM,QAEJ,IACwC;IACxC,MAAM,eAAe,GAAG,QAAQ,6BAA6B,GAAG;IAEhE,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,QACA;KACE,YAAY;KACZ,QAAQ;KACR,OAAO;KACR,EACD,aACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,IAAI,WAAW,SAC5B,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,WAAW,SACpB,QACA;KACE,YAAY;KACZ,QAAQ;KACR,OAAO;KACR,EACD,aACD;;GAEJ;EACF"}
|
|
@@ -1,7 +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
|
|
4
|
+
const require_constants_virtual_modules = require('../../constants/virtual-modules.cjs');
|
|
5
|
+
require('../../constants/index.cjs');
|
|
5
6
|
const require_lib_unplugin_module_resolution = require('./module-resolution.cjs');
|
|
6
7
|
const require_lib_utilities_source_file = require('../utilities/source-file.cjs');
|
|
7
8
|
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
@@ -58,7 +59,7 @@ function createUnplugin(context, options = {}) {
|
|
|
58
59
|
async function transform(code, id) {
|
|
59
60
|
let transformed = code;
|
|
60
61
|
for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
|
|
61
|
-
const result = await hook.handler.apply(require_lib_unplugin_helpers.combineContexts(ctx, this), [require_lib_utilities_source_file.getString(transformed), id.replace(
|
|
62
|
+
const result = await hook.handler.apply(require_lib_unplugin_helpers.combineContexts(ctx, this), [require_lib_utilities_source_file.getString(transformed), id.replace(require_constants_virtual_modules.VIRTUAL_MODULE_PREFIX_REGEX, "")]);
|
|
62
63
|
if (result) transformed = result;
|
|
63
64
|
}
|
|
64
65
|
return transformed;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { combineContexts } from "./helpers.mjs";
|
|
2
2
|
import { VIRTUAL_MODULE_PREFIX_REGEX } from "../../constants/virtual-modules.mjs";
|
|
3
|
+
import "../../constants/index.mjs";
|
|
3
4
|
import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
|
|
4
5
|
import { getString } from "../utilities/source-file.mjs";
|
|
5
6
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
@@ -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 {
|
|
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 { VIRTUAL_MODULE_PREFIX_REGEX } from \"../../constants\";\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/**\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;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const logger = ctx.extendLogger({ source: name });\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 * 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 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);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const logger = ctx.extendLogger({ source: name });\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.$$internal.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.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, this), [\n getString(transformed),\n id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\")\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.$$internal.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.$$internal.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.$$internal.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":";;;;;;;;;;;;;;;;AAuDA,SAAgB,uBAGd,SACA,UAAyC,EAAE,EAChB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,SAAS,IAAI,aAAa,EAAE,QAAQ,MAAM,CAAC;AACjD,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;;;;;;;;;;AAoBZ,SAAgB,eACd,SACA,UAAiC,EAAE,EACR;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,SAAS,IAAI,aAAa,EAAE,QAAQ,MAAM,CAAC;AACjD,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,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAI,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAM,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,KAAK,KAAK,EAAE,CACnD,UAAU,YAAY,EACtB,GAAG,QAAQ,6BAA6B,GAAG,CAC5C,CAA+B;AAClC,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,uCAAuC;AAGtD,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,0CAA0C;AAGzD,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB;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,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const
|
|
3
|
+
const require_constants_plugin = require('../constants/plugin.cjs');
|
|
4
4
|
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
5
5
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
6
6
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
@@ -15,7 +15,7 @@ let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined
|
|
|
15
15
|
* @returns True if the object is a {@link Plugin}, false otherwise
|
|
16
16
|
*/
|
|
17
17
|
function isPlugin(value) {
|
|
18
|
-
return (0, _stryke_type_checks_is_set_object.isSetObject)(value) && "name" in value && (0, _stryke_type_checks_is_set_string.isSetString)(value.name) && ((0, _stryke_type_checks_is_undefined.isUndefined)(value.api) || "api" in value && (0, _stryke_type_checks_is_set_object.isSetObject)(value.api)) && ((0, _stryke_type_checks_is_undefined.isUndefined)(value.applyToEnvironment) || "applyToEnvironment" in value && (0, _stryke_type_checks_is_function.isFunction)(value.applyToEnvironment)) && ((0, _stryke_type_checks_is_undefined.isUndefined)(value.dedupe) || "dedupe" in value && (0, _stryke_type_checks_is_function.isFunction)(value.dedupe)) &&
|
|
18
|
+
return (0, _stryke_type_checks_is_set_object.isSetObject)(value) && "name" in value && (0, _stryke_type_checks_is_set_string.isSetString)(value.name) && ((0, _stryke_type_checks_is_undefined.isUndefined)(value.api) || "api" in value && (0, _stryke_type_checks_is_set_object.isSetObject)(value.api)) && ((0, _stryke_type_checks_is_undefined.isUndefined)(value.applyToEnvironment) || "applyToEnvironment" in value && (0, _stryke_type_checks_is_function.isFunction)(value.applyToEnvironment)) && ((0, _stryke_type_checks_is_undefined.isUndefined)(value.dedupe) || "dedupe" in value && (0, _stryke_type_checks_is_function.isFunction)(value.dedupe)) && require_constants_plugin.PLUGIN_HOOKS_FIELDS.every((hook) => (0, _stryke_type_checks_is_undefined.isUndefined)(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && (0, _stryke_type_checks_is_set_object.isSetObject)(value[hook])));
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Type guard to check if an object is a {@link PluginConfigObject}
|
|
@@ -100,7 +100,7 @@ function extractPluginHook(context, plugin, hook) {
|
|
|
100
100
|
* @returns True if the hook is external, false otherwise.
|
|
101
101
|
*/
|
|
102
102
|
function isUnpluginHookKey(keys) {
|
|
103
|
-
return
|
|
103
|
+
return require_constants_plugin.UNPLUGIN_BUILDER_VARIANTS.some((variant) => keys.startsWith(`${variant}:`));
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Check if a hook is internal.
|
|
@@ -109,7 +109,7 @@ function isUnpluginHookKey(keys) {
|
|
|
109
109
|
* @returns True if the hook is external, false otherwise.
|
|
110
110
|
*/
|
|
111
111
|
function isPluginHookField(keys) {
|
|
112
|
-
return !
|
|
112
|
+
return !require_constants_plugin.PLUGIN_NON_HOOK_FIELDS.includes(keys);
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Check if a hook is external.
|
|
@@ -118,7 +118,7 @@ function isPluginHookField(keys) {
|
|
|
118
118
|
* @returns True if the hook is external, false otherwise.
|
|
119
119
|
*/
|
|
120
120
|
function isUnpluginHookField(field) {
|
|
121
|
-
return !isPluginHookField(field) &&
|
|
121
|
+
return !isPluginHookField(field) && require_constants_plugin.UNPLUGIN_BUILDER_VARIANTS.includes(field);
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* Check if a plugin should be deduplicated.
|