@powerlines/plugin-plugin 0.11.54 → 0.12.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/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +11 -0
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +9 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.cjs +69 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.js +67 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.cjs +110 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.js +107 -0
- package/dist/src/index.cjs +53 -38
- package/dist/src/index.js +55 -41
- package/dist/src/types/index.cjs +1 -0
- package/dist/src/types/index.js +1 -1
- package/dist/src/types/plugin.cjs +5 -4
- package/dist/src/types/plugin.d.ts +20 -4
- package/dist/src/types/plugin.js +5 -5
- package/package.json +13 -15
- package/dist/config.d.ts +0 -23
- package/dist/node_modules/.pnpm/esbuild-plugin-babel@0.2.3_@babel_core@7.28.5/node_modules/esbuild-plugin-babel/src/index.cjs +0 -46
- package/dist/node_modules/.pnpm/esbuild-plugin-babel@0.2.3_@babel_core@7.28.5/node_modules/esbuild-plugin-babel/src/index.js +0 -44
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/vlq.ts
|
|
4
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
5
|
+
var intToChar = new Uint8Array(64);
|
|
6
|
+
var charToInt = new Uint8Array(128);
|
|
7
|
+
for (let i = 0; i < chars.length; i++) {
|
|
8
|
+
const c = chars.charCodeAt(i);
|
|
9
|
+
intToChar[i] = c;
|
|
10
|
+
charToInt[c] = i;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/vlq.ts
|
|
2
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3
|
+
var intToChar = new Uint8Array(64);
|
|
4
|
+
var charToInt = new Uint8Array(128);
|
|
5
|
+
for (let i = 0; i < chars.length; i++) {
|
|
6
|
+
const c = chars.charCodeAt(i);
|
|
7
|
+
intToChar[i] = c;
|
|
8
|
+
charToInt[c] = i;
|
|
9
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var parseCRORloGP = require('./parse-CRORloGP.cjs');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
require('node:fs');
|
|
6
|
+
require('node:buffer');
|
|
7
|
+
require('../../../../@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs');
|
|
8
|
+
require('node:querystring');
|
|
9
|
+
require('node:process');
|
|
10
|
+
require('webpack-virtual-modules');
|
|
11
|
+
|
|
12
|
+
function toRollupPlugin(plugin, key) {
|
|
13
|
+
if (plugin.resolveId && false) ;
|
|
14
|
+
if (plugin.load && (plugin.loadInclude || false)) {
|
|
15
|
+
const loadHook = plugin.load;
|
|
16
|
+
const { handler, filter } = parseCRORloGP.r("load", loadHook);
|
|
17
|
+
replaceHookHandler("load", loadHook, function(...args) {
|
|
18
|
+
const [id] = args;
|
|
19
|
+
if (plugin.loadInclude && !plugin.loadInclude(id)) return;
|
|
20
|
+
if (!supportNativeFilter() && !filter(id)) return;
|
|
21
|
+
return handler.apply(this, args);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (plugin.transform && (plugin.transformInclude || false)) {
|
|
25
|
+
const transformHook = plugin.transform;
|
|
26
|
+
const { handler, filter } = parseCRORloGP.r("transform", transformHook);
|
|
27
|
+
replaceHookHandler("transform", transformHook, function(...args) {
|
|
28
|
+
const [code, id] = args;
|
|
29
|
+
if (plugin.transformInclude && !plugin.transformInclude(id)) return;
|
|
30
|
+
if (!supportNativeFilter() && !filter(id, code)) return;
|
|
31
|
+
return handler.apply(this, args);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (plugin[key]) Object.assign(plugin, plugin[key]);
|
|
35
|
+
return plugin;
|
|
36
|
+
function replaceHookHandler(name, hook, handler) {
|
|
37
|
+
if (typeof hook === "function") plugin[name] = handler;
|
|
38
|
+
else hook.handler = handler;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function supportNativeFilter(context, framework) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/rolldown/index.ts
|
|
47
|
+
function getRolldownPlugin(factory) {
|
|
48
|
+
return ((userOptions) => {
|
|
49
|
+
const plugins = parseCRORloGP.i(factory(userOptions, { framework: "rolldown" })).map((rawPlugin) => {
|
|
50
|
+
return toRollupPlugin(rawPlugin, "rolldown");
|
|
51
|
+
});
|
|
52
|
+
return plugins.length === 1 ? plugins[0] : plugins;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/rspack/index.ts
|
|
58
|
+
path.resolve(undefined, "rspack/loaders/transform.mjs");
|
|
59
|
+
path.resolve(undefined, "rspack/loaders/load.mjs");
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/webpack/index.ts
|
|
63
|
+
path.resolve(undefined, "webpack/loaders/transform.mjs");
|
|
64
|
+
path.resolve(undefined, "webpack/loaders/load.mjs");
|
|
65
|
+
function createRolldownPlugin(factory) {
|
|
66
|
+
return getRolldownPlugin(factory);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
exports.createRolldownPlugin = createRolldownPlugin;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { i as toArray, r as normalizeObjectHook } from './parse-CRORloGP.js';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import 'node:fs';
|
|
4
|
+
import 'node:buffer';
|
|
5
|
+
import '../../../../@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js';
|
|
6
|
+
import 'node:querystring';
|
|
7
|
+
import 'node:process';
|
|
8
|
+
import 'webpack-virtual-modules';
|
|
9
|
+
|
|
10
|
+
function toRollupPlugin(plugin, key) {
|
|
11
|
+
if (plugin.resolveId && false) ;
|
|
12
|
+
if (plugin.load && (plugin.loadInclude || false)) {
|
|
13
|
+
const loadHook = plugin.load;
|
|
14
|
+
const { handler, filter } = normalizeObjectHook("load", loadHook);
|
|
15
|
+
replaceHookHandler("load", loadHook, function(...args) {
|
|
16
|
+
const [id] = args;
|
|
17
|
+
if (plugin.loadInclude && !plugin.loadInclude(id)) return;
|
|
18
|
+
if (!supportNativeFilter() && !filter(id)) return;
|
|
19
|
+
return handler.apply(this, args);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (plugin.transform && (plugin.transformInclude || false)) {
|
|
23
|
+
const transformHook = plugin.transform;
|
|
24
|
+
const { handler, filter } = normalizeObjectHook("transform", transformHook);
|
|
25
|
+
replaceHookHandler("transform", transformHook, function(...args) {
|
|
26
|
+
const [code, id] = args;
|
|
27
|
+
if (plugin.transformInclude && !plugin.transformInclude(id)) return;
|
|
28
|
+
if (!supportNativeFilter() && !filter(id, code)) return;
|
|
29
|
+
return handler.apply(this, args);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (plugin[key]) Object.assign(plugin, plugin[key]);
|
|
33
|
+
return plugin;
|
|
34
|
+
function replaceHookHandler(name, hook, handler) {
|
|
35
|
+
if (typeof hook === "function") plugin[name] = handler;
|
|
36
|
+
else hook.handler = handler;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function supportNativeFilter(context, framework) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/rolldown/index.ts
|
|
45
|
+
function getRolldownPlugin(factory) {
|
|
46
|
+
return ((userOptions) => {
|
|
47
|
+
const plugins = toArray(factory(userOptions, { framework: "rolldown" })).map((rawPlugin) => {
|
|
48
|
+
return toRollupPlugin(rawPlugin, "rolldown");
|
|
49
|
+
});
|
|
50
|
+
return plugins.length === 1 ? plugins[0] : plugins;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/rspack/index.ts
|
|
56
|
+
resolve(import.meta.dirname, "rspack/loaders/transform.mjs");
|
|
57
|
+
resolve(import.meta.dirname, "rspack/loaders/load.mjs");
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/webpack/index.ts
|
|
61
|
+
resolve(import.meta.dirname, "webpack/loaders/transform.mjs");
|
|
62
|
+
resolve(import.meta.dirname, "webpack/loaders/load.mjs");
|
|
63
|
+
function createRolldownPlugin(factory) {
|
|
64
|
+
return getRolldownPlugin(factory);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { createRolldownPlugin };
|
package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.cjs
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('node:path');
|
|
4
|
+
var picomatch = require('picomatch');
|
|
5
|
+
|
|
6
|
+
//#region src/utils/general.ts
|
|
7
|
+
function toArray(array) {
|
|
8
|
+
array = array || [];
|
|
9
|
+
if (Array.isArray(array)) return array;
|
|
10
|
+
return [array];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/utils/filter.ts
|
|
15
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
16
|
+
function normalize$1(path$1) {
|
|
17
|
+
return path$1.replace(BACKSLASH_REGEX, "/");
|
|
18
|
+
}
|
|
19
|
+
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
|
|
20
|
+
function isAbsolute$1(path$1) {
|
|
21
|
+
return ABSOLUTE_PATH_REGEX.test(path$1);
|
|
22
|
+
}
|
|
23
|
+
function getMatcherString(glob, cwd) {
|
|
24
|
+
if (glob.startsWith("**") || isAbsolute$1(glob)) return normalize$1(glob);
|
|
25
|
+
return normalize$1(path.resolve(cwd, glob));
|
|
26
|
+
}
|
|
27
|
+
function patternToIdFilter(pattern) {
|
|
28
|
+
if (pattern instanceof RegExp) return (id) => {
|
|
29
|
+
const normalizedId = normalize$1(id);
|
|
30
|
+
const result = pattern.test(normalizedId);
|
|
31
|
+
pattern.lastIndex = 0;
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
const matcher = picomatch(getMatcherString(pattern, process.cwd()), { dot: true });
|
|
35
|
+
return (id) => {
|
|
36
|
+
return matcher(normalize$1(id));
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function patternToCodeFilter(pattern) {
|
|
40
|
+
if (pattern instanceof RegExp) return (code) => {
|
|
41
|
+
const result = pattern.test(code);
|
|
42
|
+
pattern.lastIndex = 0;
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
return (code) => code.includes(pattern);
|
|
46
|
+
}
|
|
47
|
+
function createFilter(exclude, include) {
|
|
48
|
+
if (!exclude && !include) return;
|
|
49
|
+
return (input) => {
|
|
50
|
+
if (exclude?.some((filter) => filter(input))) return false;
|
|
51
|
+
if (include?.some((filter) => filter(input))) return true;
|
|
52
|
+
return !(include && include.length > 0);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function normalizeFilter(filter) {
|
|
56
|
+
if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
|
|
57
|
+
if (Array.isArray(filter)) return { include: filter };
|
|
58
|
+
return {
|
|
59
|
+
exclude: filter.exclude ? toArray(filter.exclude) : void 0,
|
|
60
|
+
include: filter.include ? toArray(filter.include) : void 0
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function createIdFilter(filter) {
|
|
64
|
+
if (!filter) return;
|
|
65
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
66
|
+
const excludeFilter = exclude?.map(patternToIdFilter);
|
|
67
|
+
const includeFilter = include?.map(patternToIdFilter);
|
|
68
|
+
return createFilter(excludeFilter, includeFilter);
|
|
69
|
+
}
|
|
70
|
+
function createCodeFilter(filter) {
|
|
71
|
+
if (!filter) return;
|
|
72
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
73
|
+
const excludeFilter = exclude?.map(patternToCodeFilter);
|
|
74
|
+
const includeFilter = include?.map(patternToCodeFilter);
|
|
75
|
+
return createFilter(excludeFilter, includeFilter);
|
|
76
|
+
}
|
|
77
|
+
function createFilterForId(filter) {
|
|
78
|
+
const filterFunction = createIdFilter(filter);
|
|
79
|
+
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
80
|
+
}
|
|
81
|
+
function createFilterForTransform(idFilter, codeFilter) {
|
|
82
|
+
if (!idFilter && !codeFilter) return;
|
|
83
|
+
const idFilterFunction = createIdFilter(idFilter);
|
|
84
|
+
const codeFilterFunction = createCodeFilter(codeFilter);
|
|
85
|
+
return (id, code) => {
|
|
86
|
+
let fallback = true;
|
|
87
|
+
if (idFilterFunction) fallback &&= idFilterFunction(id);
|
|
88
|
+
if (!fallback) return false;
|
|
89
|
+
if (codeFilterFunction) fallback &&= codeFilterFunction(code);
|
|
90
|
+
return fallback;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function normalizeObjectHook(name, hook) {
|
|
94
|
+
let handler;
|
|
95
|
+
let filter;
|
|
96
|
+
if (typeof hook === "function") handler = hook;
|
|
97
|
+
else {
|
|
98
|
+
handler = hook.handler;
|
|
99
|
+
const hookFilter = hook.filter;
|
|
100
|
+
if (name === "resolveId" || name === "load") filter = createFilterForId(hookFilter?.id);
|
|
101
|
+
else filter = createFilterForTransform(hookFilter?.id, hookFilter?.code);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
handler,
|
|
105
|
+
filter: filter || (() => true)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
exports.i = toArray;
|
|
110
|
+
exports.r = normalizeObjectHook;
|
package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import picomatch from 'picomatch';
|
|
3
|
+
|
|
4
|
+
//#region src/utils/general.ts
|
|
5
|
+
function toArray(array) {
|
|
6
|
+
array = array || [];
|
|
7
|
+
if (Array.isArray(array)) return array;
|
|
8
|
+
return [array];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/utils/filter.ts
|
|
13
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
14
|
+
function normalize$1(path$1) {
|
|
15
|
+
return path$1.replace(BACKSLASH_REGEX, "/");
|
|
16
|
+
}
|
|
17
|
+
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
|
|
18
|
+
function isAbsolute$1(path$1) {
|
|
19
|
+
return ABSOLUTE_PATH_REGEX.test(path$1);
|
|
20
|
+
}
|
|
21
|
+
function getMatcherString(glob, cwd) {
|
|
22
|
+
if (glob.startsWith("**") || isAbsolute$1(glob)) return normalize$1(glob);
|
|
23
|
+
return normalize$1(resolve(cwd, glob));
|
|
24
|
+
}
|
|
25
|
+
function patternToIdFilter(pattern) {
|
|
26
|
+
if (pattern instanceof RegExp) return (id) => {
|
|
27
|
+
const normalizedId = normalize$1(id);
|
|
28
|
+
const result = pattern.test(normalizedId);
|
|
29
|
+
pattern.lastIndex = 0;
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
const matcher = picomatch(getMatcherString(pattern, process.cwd()), { dot: true });
|
|
33
|
+
return (id) => {
|
|
34
|
+
return matcher(normalize$1(id));
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function patternToCodeFilter(pattern) {
|
|
38
|
+
if (pattern instanceof RegExp) return (code) => {
|
|
39
|
+
const result = pattern.test(code);
|
|
40
|
+
pattern.lastIndex = 0;
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
return (code) => code.includes(pattern);
|
|
44
|
+
}
|
|
45
|
+
function createFilter(exclude, include) {
|
|
46
|
+
if (!exclude && !include) return;
|
|
47
|
+
return (input) => {
|
|
48
|
+
if (exclude?.some((filter) => filter(input))) return false;
|
|
49
|
+
if (include?.some((filter) => filter(input))) return true;
|
|
50
|
+
return !(include && include.length > 0);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function normalizeFilter(filter) {
|
|
54
|
+
if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
|
|
55
|
+
if (Array.isArray(filter)) return { include: filter };
|
|
56
|
+
return {
|
|
57
|
+
exclude: filter.exclude ? toArray(filter.exclude) : void 0,
|
|
58
|
+
include: filter.include ? toArray(filter.include) : void 0
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createIdFilter(filter) {
|
|
62
|
+
if (!filter) return;
|
|
63
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
64
|
+
const excludeFilter = exclude?.map(patternToIdFilter);
|
|
65
|
+
const includeFilter = include?.map(patternToIdFilter);
|
|
66
|
+
return createFilter(excludeFilter, includeFilter);
|
|
67
|
+
}
|
|
68
|
+
function createCodeFilter(filter) {
|
|
69
|
+
if (!filter) return;
|
|
70
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
71
|
+
const excludeFilter = exclude?.map(patternToCodeFilter);
|
|
72
|
+
const includeFilter = include?.map(patternToCodeFilter);
|
|
73
|
+
return createFilter(excludeFilter, includeFilter);
|
|
74
|
+
}
|
|
75
|
+
function createFilterForId(filter) {
|
|
76
|
+
const filterFunction = createIdFilter(filter);
|
|
77
|
+
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
78
|
+
}
|
|
79
|
+
function createFilterForTransform(idFilter, codeFilter) {
|
|
80
|
+
if (!idFilter && !codeFilter) return;
|
|
81
|
+
const idFilterFunction = createIdFilter(idFilter);
|
|
82
|
+
const codeFilterFunction = createCodeFilter(codeFilter);
|
|
83
|
+
return (id, code) => {
|
|
84
|
+
let fallback = true;
|
|
85
|
+
if (idFilterFunction) fallback &&= idFilterFunction(id);
|
|
86
|
+
if (!fallback) return false;
|
|
87
|
+
if (codeFilterFunction) fallback &&= codeFilterFunction(code);
|
|
88
|
+
return fallback;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function normalizeObjectHook(name, hook) {
|
|
92
|
+
let handler;
|
|
93
|
+
let filter;
|
|
94
|
+
if (typeof hook === "function") handler = hook;
|
|
95
|
+
else {
|
|
96
|
+
handler = hook.handler;
|
|
97
|
+
const hookFilter = hook.filter;
|
|
98
|
+
if (name === "resolveId" || name === "load") filter = createFilterForId(hookFilter?.id);
|
|
99
|
+
else filter = createFilterForTransform(hookFilter?.id, hookFilter?.code);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
handler,
|
|
103
|
+
filter: filter || (() => true)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { toArray as i, normalizeObjectHook as r };
|
package/dist/src/index.cjs
CHANGED
|
@@ -3,22 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var src_types_plugin = require('./types/plugin.cjs');
|
|
6
|
-
var
|
|
7
|
-
var typescriptBabelPreset = require('@babel/preset-typescript');
|
|
6
|
+
var alloyPlugin = require('@alloy-js/rollup-plugin');
|
|
8
7
|
var types = require('@storm-software/config-tools/types');
|
|
9
|
-
var
|
|
8
|
+
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
10
9
|
var stormJson = require('@stryke/json/storm-json');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
10
|
+
var titleCase = require('@stryke/string-format/title-case');
|
|
11
|
+
var isSetString = require('@stryke/type-checks/is-set-string');
|
|
13
12
|
var defu = require('defu');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
13
|
+
var tsdown$1 = require('powerlines/lib/build/tsdown');
|
|
14
|
+
var unplugin = require('powerlines/lib/unplugin');
|
|
15
|
+
var tsdown = require('tsdown');
|
|
16
|
+
var index = require('../node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.cjs');
|
|
16
17
|
|
|
17
18
|
/*@ts-ignore*/
|
|
18
19
|
function __assignType(fn, args) {
|
|
19
20
|
fn.__type = args;
|
|
20
21
|
return fn;
|
|
21
22
|
}
|
|
23
|
+
function createPlugin(context) {
|
|
24
|
+
return index.createRolldownPlugin(unplugin.createUnplugin(context))({});
|
|
25
|
+
}
|
|
26
|
+
createPlugin.__type = ['context', 'createPlugin', 'P"2!"/"'];
|
|
22
27
|
/**
|
|
23
28
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
24
29
|
*/
|
|
@@ -31,13 +36,12 @@ const plugin = __assignType((options = {}) => {
|
|
|
31
36
|
type: "library",
|
|
32
37
|
entry: ["src/**/*.ts", "src/**/*.tsx"],
|
|
33
38
|
output: {
|
|
34
|
-
dts: false,
|
|
35
39
|
format: ["cjs", "esm"]
|
|
36
40
|
},
|
|
37
41
|
build: {
|
|
38
|
-
variant: "
|
|
42
|
+
variant: "tsdown",
|
|
43
|
+
unbundle: false,
|
|
39
44
|
external: ["powerlines"],
|
|
40
|
-
bundle: false,
|
|
41
45
|
skipNodeModulesBundle: true,
|
|
42
46
|
platform: "node"
|
|
43
47
|
}
|
|
@@ -52,36 +56,46 @@ const plugin = __assignType((options = {}) => {
|
|
|
52
56
|
await this.fs.write(this.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
53
57
|
}
|
|
54
58
|
}, ['configResolved', 'P"/!']),
|
|
59
|
+
generateTypes: __assignType(async function generateTypes(code) {
|
|
60
|
+
if (!options.types?.userConfig) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let typeDef;
|
|
64
|
+
if (isSetString.isSetString(options.types.userConfig) &&
|
|
65
|
+
!options.types.userConfig.includes("#") &&
|
|
66
|
+
this.packageJson?.name) {
|
|
67
|
+
const pluginRoot = await this.resolve(this.packageJson.name);
|
|
68
|
+
if (pluginRoot &&
|
|
69
|
+
this.packageJson?.name &&
|
|
70
|
+
!(await this.resolve(options.types.userConfig, pluginRoot.id))) {
|
|
71
|
+
typeDef = {
|
|
72
|
+
file: this.packageJson.name,
|
|
73
|
+
name: options.types.userConfig
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (!typeDef) {
|
|
78
|
+
typeDef = parseTypeDefinition.parseTypeDefinition(options.types.userConfig);
|
|
79
|
+
if (!typeDef) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return `${code || ""}
|
|
84
|
+
|
|
85
|
+
// Extend \`UserConfig\` with the ${titleCase.titleCase(this.config.name)} plugin's type definition
|
|
86
|
+
declare module "powerlines" {
|
|
87
|
+
export interface UserConfig extends import("${typeDef.file}").${typeDef.name || "default"}
|
|
88
|
+
}
|
|
89
|
+
`.trim();
|
|
90
|
+
}, ['code', 'generateTypes', 'P&2!"/"']),
|
|
55
91
|
async build() {
|
|
56
|
-
await
|
|
92
|
+
await tsdown.build(defu.defu({
|
|
57
93
|
config: false,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
], ['param0', '', 'P"2!"/"'])))
|
|
64
|
-
}, tsup$1.extractTsupConfig(this), {
|
|
65
|
-
esbuildPlugins: options.alloy
|
|
66
|
-
? [
|
|
67
|
-
index({
|
|
68
|
-
filter: /\.tsx$/,
|
|
69
|
-
config: {
|
|
70
|
-
presets: [
|
|
71
|
-
[
|
|
72
|
-
typescriptBabelPreset,
|
|
73
|
-
{
|
|
74
|
-
allExtensions: true,
|
|
75
|
-
allowDeclareFields: true,
|
|
76
|
-
isTSX: true
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
alloyBabelPreset
|
|
80
|
-
]
|
|
81
|
-
}})
|
|
82
|
-
]
|
|
83
|
-
: []
|
|
84
|
-
})));
|
|
94
|
+
plugins: [
|
|
95
|
+
(createPlugin.Ω = [[() => src_types_plugin.__ΩPluginPluginContext, 'n!']], createPlugin(this)),
|
|
96
|
+
options.alloy && alloyPlugin()
|
|
97
|
+
].filter(Boolean)
|
|
98
|
+
}, tsdown$1.extractTsdownConfig(this)));
|
|
85
99
|
}
|
|
86
100
|
};
|
|
87
101
|
}, [() => src_types_plugin.__ΩPluginPluginOptions, 'options', () => ({}), '', 'Pn!2">#!/$']);
|
|
@@ -90,6 +104,7 @@ exports.__ΩPluginPluginAlloyOptions = src_types_plugin.__ΩPluginPluginAlloyOpt
|
|
|
90
104
|
exports.__ΩPluginPluginContext = src_types_plugin.__ΩPluginPluginContext;
|
|
91
105
|
exports.__ΩPluginPluginOptions = src_types_plugin.__ΩPluginPluginOptions;
|
|
92
106
|
exports.__ΩPluginPluginResolvedConfig = src_types_plugin.__ΩPluginPluginResolvedConfig;
|
|
107
|
+
exports.__ΩPluginPluginTypesOptions = src_types_plugin.__ΩPluginPluginTypesOptions;
|
|
93
108
|
exports.__ΩPluginPluginUserConfig = src_types_plugin.__ΩPluginPluginUserConfig;
|
|
94
109
|
exports.default = plugin;
|
|
95
110
|
exports.plugin = plugin;
|
package/dist/src/index.js
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { __ΩPluginPluginOptions as ___PluginPluginOptions } from './types/plugin.js';
|
|
2
|
-
export { __ΩPluginPluginAlloyOptions, __Ω
|
|
3
|
-
import
|
|
4
|
-
import typescriptBabelPreset from '@babel/preset-typescript';
|
|
1
|
+
import { __ΩPluginPluginOptions as ___PluginPluginOptions, __ΩPluginPluginContext as ___PluginPluginContext } from './types/plugin.js';
|
|
2
|
+
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginTypesOptions, __ΩPluginPluginUserConfig } from './types/plugin.js';
|
|
3
|
+
import alloyPlugin from '@alloy-js/rollup-plugin';
|
|
5
4
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
6
|
-
import {
|
|
5
|
+
import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
|
|
7
6
|
import { StormJSON } from '@stryke/json/storm-json';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { titleCase } from '@stryke/string-format/title-case';
|
|
8
|
+
import { isSetString } from '@stryke/type-checks/is-set-string';
|
|
10
9
|
import { defu } from 'defu';
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
10
|
+
import { extractTsdownConfig } from 'powerlines/lib/build/tsdown';
|
|
11
|
+
import { createUnplugin } from 'powerlines/lib/unplugin';
|
|
12
|
+
import { build } from 'tsdown';
|
|
13
|
+
import { createRolldownPlugin } from '../node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.js';
|
|
13
14
|
|
|
14
15
|
/*@ts-ignore*/
|
|
15
16
|
function __assignType(fn, args) {
|
|
16
17
|
fn.__type = args;
|
|
17
18
|
return fn;
|
|
18
19
|
}
|
|
20
|
+
function createPlugin(context) {
|
|
21
|
+
return createRolldownPlugin(createUnplugin(context))({});
|
|
22
|
+
}
|
|
23
|
+
createPlugin.__type = ['context', 'createPlugin', 'P"2!"/"'];
|
|
19
24
|
/**
|
|
20
25
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
21
26
|
*/
|
|
@@ -28,13 +33,12 @@ const plugin = __assignType((options = {}) => {
|
|
|
28
33
|
type: "library",
|
|
29
34
|
entry: ["src/**/*.ts", "src/**/*.tsx"],
|
|
30
35
|
output: {
|
|
31
|
-
dts: false,
|
|
32
36
|
format: ["cjs", "esm"]
|
|
33
37
|
},
|
|
34
38
|
build: {
|
|
35
|
-
variant: "
|
|
39
|
+
variant: "tsdown",
|
|
40
|
+
unbundle: false,
|
|
36
41
|
external: ["powerlines"],
|
|
37
|
-
bundle: false,
|
|
38
42
|
skipNodeModulesBundle: true,
|
|
39
43
|
platform: "node"
|
|
40
44
|
}
|
|
@@ -49,38 +53,48 @@ const plugin = __assignType((options = {}) => {
|
|
|
49
53
|
await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
50
54
|
}
|
|
51
55
|
}, ['configResolved', 'P"/!']),
|
|
56
|
+
generateTypes: __assignType(async function generateTypes(code) {
|
|
57
|
+
if (!options.types?.userConfig) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
let typeDef;
|
|
61
|
+
if (isSetString(options.types.userConfig) &&
|
|
62
|
+
!options.types.userConfig.includes("#") &&
|
|
63
|
+
this.packageJson?.name) {
|
|
64
|
+
const pluginRoot = await this.resolve(this.packageJson.name);
|
|
65
|
+
if (pluginRoot &&
|
|
66
|
+
this.packageJson?.name &&
|
|
67
|
+
!(await this.resolve(options.types.userConfig, pluginRoot.id))) {
|
|
68
|
+
typeDef = {
|
|
69
|
+
file: this.packageJson.name,
|
|
70
|
+
name: options.types.userConfig
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!typeDef) {
|
|
75
|
+
typeDef = parseTypeDefinition(options.types.userConfig);
|
|
76
|
+
if (!typeDef) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return `${code || ""}
|
|
81
|
+
|
|
82
|
+
// Extend \`UserConfig\` with the ${titleCase(this.config.name)} plugin's type definition
|
|
83
|
+
declare module "powerlines" {
|
|
84
|
+
export interface UserConfig extends import("${typeDef.file}").${typeDef.name || "default"}
|
|
85
|
+
}
|
|
86
|
+
`.trim();
|
|
87
|
+
}, ['code', 'generateTypes', 'P&2!"/"']),
|
|
52
88
|
async build() {
|
|
53
|
-
await build(
|
|
89
|
+
await build(defu({
|
|
54
90
|
config: false,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
], ['param0', '', 'P"2!"/"'])))
|
|
61
|
-
}, extractTsupConfig(this), {
|
|
62
|
-
esbuildPlugins: options.alloy
|
|
63
|
-
? [
|
|
64
|
-
pluginBabel({
|
|
65
|
-
filter: /\.tsx$/,
|
|
66
|
-
config: {
|
|
67
|
-
presets: [
|
|
68
|
-
[
|
|
69
|
-
typescriptBabelPreset,
|
|
70
|
-
{
|
|
71
|
-
allExtensions: true,
|
|
72
|
-
allowDeclareFields: true,
|
|
73
|
-
isTSX: true
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
alloyBabelPreset
|
|
77
|
-
]
|
|
78
|
-
}})
|
|
79
|
-
]
|
|
80
|
-
: []
|
|
81
|
-
})));
|
|
91
|
+
plugins: [
|
|
92
|
+
(createPlugin.Ω = [[() => ___PluginPluginContext, 'n!']], createPlugin(this)),
|
|
93
|
+
options.alloy && alloyPlugin()
|
|
94
|
+
].filter(Boolean)
|
|
95
|
+
}, extractTsdownConfig(this)));
|
|
82
96
|
}
|
|
83
97
|
};
|
|
84
98
|
}, [() => ___PluginPluginOptions, 'options', () => ({}), '', 'Pn!2">#!/$']);
|
|
85
99
|
|
|
86
|
-
export { ___PluginPluginOptions as __ΩPluginPluginOptions, plugin as default, plugin };
|
|
100
|
+
export { ___PluginPluginContext as __ΩPluginPluginContext, ___PluginPluginOptions as __ΩPluginPluginOptions, plugin as default, plugin };
|
package/dist/src/types/index.cjs
CHANGED
|
@@ -8,4 +8,5 @@ exports.__ΩPluginPluginAlloyOptions = src_types_plugin.__ΩPluginPluginAlloyOpt
|
|
|
8
8
|
exports.__ΩPluginPluginContext = src_types_plugin.__ΩPluginPluginContext;
|
|
9
9
|
exports.__ΩPluginPluginOptions = src_types_plugin.__ΩPluginPluginOptions;
|
|
10
10
|
exports.__ΩPluginPluginResolvedConfig = src_types_plugin.__ΩPluginPluginResolvedConfig;
|
|
11
|
+
exports.__ΩPluginPluginTypesOptions = src_types_plugin.__ΩPluginPluginTypesOptions;
|
|
11
12
|
exports.__ΩPluginPluginUserConfig = src_types_plugin.__ΩPluginPluginUserConfig;
|
package/dist/src/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginUserConfig } from './plugin.js';
|
|
1
|
+
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginTypesOptions, __ΩPluginPluginUserConfig } from './plugin.js';
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const __ΩPartial = ['T', 'Partial', 'l+e#!e"!fRb!Pde"!gN#"w"y'];
|
|
4
|
-
const __ΩRequired = ['T', 'Required', 'l+e#!e"!fRb!Pde"!gN##w"y'];
|
|
5
4
|
const __ΩPluginPluginAlloyOptions = [() => __ΩPartial, 'PrintTreeOptions', 'generatesJson', true, 'generatesMarkdown', 'PluginPluginAlloyOptions', 'P"w"o!"P)4#8>$)4%8>$MKw&y'];
|
|
6
|
-
const __Ω
|
|
7
|
-
const __Ω
|
|
8
|
-
const __Ω
|
|
5
|
+
const __ΩPluginPluginTypesOptions = ['TypeDefinitionParameter', 'options', 'userConfig', 'PluginPluginTypesOptions', 'P"w!4"8"w!4#8Mw$y'];
|
|
6
|
+
const __ΩPluginPluginOptions = [() => __ΩPluginPluginAlloyOptions, 'alloy', false, () => __ΩPluginPluginTypesOptions, 'types', 'PluginPluginOptions', 'PPn!)J4"8>#n$4%8Mw&y'];
|
|
7
|
+
const __ΩPluginPluginUserConfig = [() => __ΩPluginPluginOptions, 'plugin', 'PluginPluginUserConfig', 'P!Pn!4"MKw#y'];
|
|
8
|
+
const __ΩPluginPluginResolvedConfig = [() => __ΩPluginPluginOptions, 'plugin', 'PluginPluginResolvedConfig', 'P!Pn!4"MKw#y'];
|
|
9
9
|
const __ΩPluginPluginContext = [() => __ΩPluginPluginResolvedConfig, 'TResolvedConfig', 'PluginPluginContext', 'n!c"!w#y'];
|
|
10
10
|
|
|
11
11
|
exports.__ΩPluginPluginAlloyOptions = __ΩPluginPluginAlloyOptions;
|
|
12
12
|
exports.__ΩPluginPluginContext = __ΩPluginPluginContext;
|
|
13
13
|
exports.__ΩPluginPluginOptions = __ΩPluginPluginOptions;
|
|
14
14
|
exports.__ΩPluginPluginResolvedConfig = __ΩPluginPluginResolvedConfig;
|
|
15
|
+
exports.__ΩPluginPluginTypesOptions = __ΩPluginPluginTypesOptions;
|
|
15
16
|
exports.__ΩPluginPluginUserConfig = __ΩPluginPluginUserConfig;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PrintTreeOptions } from "@alloy-js/core";
|
|
2
|
-
import
|
|
2
|
+
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
3
|
+
import type { TsdownBuildConfig, TsdownResolvedBuildConfig } from "powerlines/types/build";
|
|
3
4
|
import type { UserConfig } from "powerlines/types/config";
|
|
4
5
|
import type { PluginContext } from "powerlines/types/context";
|
|
5
6
|
import type { ResolvedConfig } from "powerlines/types/resolved";
|
|
@@ -17,6 +18,16 @@ export type PluginPluginAlloyOptions = Partial<PrintTreeOptions> & {
|
|
|
17
18
|
*/
|
|
18
19
|
generatesMarkdown?: boolean;
|
|
19
20
|
};
|
|
21
|
+
export interface PluginPluginTypesOptions {
|
|
22
|
+
/**
|
|
23
|
+
* The type definition for the plugin's options.
|
|
24
|
+
*/
|
|
25
|
+
options?: TypeDefinitionParameter;
|
|
26
|
+
/**
|
|
27
|
+
* The type definition for the plugin's user config.
|
|
28
|
+
*/
|
|
29
|
+
userConfig?: TypeDefinitionParameter;
|
|
30
|
+
}
|
|
20
31
|
export interface PluginPluginOptions {
|
|
21
32
|
/**
|
|
22
33
|
* The options applied to the [Alloy framework](https://alloy-framework.github.io/alloy/) for rendering templates.
|
|
@@ -27,15 +38,20 @@ export interface PluginPluginOptions {
|
|
|
27
38
|
* @defaultValue false
|
|
28
39
|
*/
|
|
29
40
|
alloy?: PluginPluginAlloyOptions | boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The type definitions for the Plugin plugin.
|
|
43
|
+
*/
|
|
44
|
+
types?: PluginPluginTypesOptions;
|
|
30
45
|
}
|
|
31
|
-
export type PluginPluginUserConfig = UserConfig<
|
|
32
|
-
|
|
46
|
+
export type PluginPluginUserConfig = UserConfig<TsdownBuildConfig, TsdownResolvedBuildConfig, "tsdown"> & {
|
|
47
|
+
plugin: PluginPluginOptions;
|
|
33
48
|
};
|
|
34
49
|
export type PluginPluginResolvedConfig = ResolvedConfig<PluginPluginUserConfig> & {
|
|
35
|
-
|
|
50
|
+
plugin: PluginPluginOptions;
|
|
36
51
|
};
|
|
37
52
|
export type PluginPluginContext<TResolvedConfig extends PluginPluginResolvedConfig = PluginPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
38
53
|
export declare type __ΩPluginPluginAlloyOptions = any[];
|
|
54
|
+
export declare type __ΩPluginPluginTypesOptions = any[];
|
|
39
55
|
export declare type __ΩPluginPluginOptions = any[];
|
|
40
56
|
export declare type __ΩPluginPluginUserConfig = any[];
|
|
41
57
|
export declare type __ΩPluginPluginResolvedConfig = any[];
|
package/dist/src/types/plugin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const __ΩPartial = ['T', 'Partial', 'l+e#!e"!fRb!Pde"!gN#"w"y'];
|
|
2
|
-
const __ΩRequired = ['T', 'Required', 'l+e#!e"!fRb!Pde"!gN##w"y'];
|
|
3
2
|
const __ΩPluginPluginAlloyOptions = [() => __ΩPartial, 'PrintTreeOptions', 'generatesJson', true, 'generatesMarkdown', 'PluginPluginAlloyOptions', 'P"w"o!"P)4#8>$)4%8>$MKw&y'];
|
|
4
|
-
const __Ω
|
|
5
|
-
const __Ω
|
|
6
|
-
const __Ω
|
|
3
|
+
const __ΩPluginPluginTypesOptions = ['TypeDefinitionParameter', 'options', 'userConfig', 'PluginPluginTypesOptions', 'P"w!4"8"w!4#8Mw$y'];
|
|
4
|
+
const __ΩPluginPluginOptions = [() => __ΩPluginPluginAlloyOptions, 'alloy', false, () => __ΩPluginPluginTypesOptions, 'types', 'PluginPluginOptions', 'PPn!)J4"8>#n$4%8Mw&y'];
|
|
5
|
+
const __ΩPluginPluginUserConfig = [() => __ΩPluginPluginOptions, 'plugin', 'PluginPluginUserConfig', 'P!Pn!4"MKw#y'];
|
|
6
|
+
const __ΩPluginPluginResolvedConfig = [() => __ΩPluginPluginOptions, 'plugin', 'PluginPluginResolvedConfig', 'P!Pn!4"MKw#y'];
|
|
7
7
|
const __ΩPluginPluginContext = [() => __ΩPluginPluginResolvedConfig, 'TResolvedConfig', 'PluginPluginContext', 'n!c"!w#y'];
|
|
8
8
|
|
|
9
|
-
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginUserConfig };
|
|
9
|
+
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginTypesOptions, __ΩPluginPluginUserConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -117,34 +117,32 @@
|
|
|
117
117
|
"files": ["dist/**/*"],
|
|
118
118
|
"keywords": ["powerlines", "storm-software", "powerlines-plugin"],
|
|
119
119
|
"dependencies": {
|
|
120
|
-
"@alloy-js/
|
|
120
|
+
"@alloy-js/rollup-plugin": "^0.1.0",
|
|
121
121
|
"@alloy-js/core": "^0.20.0",
|
|
122
122
|
"@alloy-js/json": "^0.20.0",
|
|
123
123
|
"@alloy-js/markdown": "^0.20.0",
|
|
124
124
|
"@alloy-js/typescript": "^0.20.0",
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"@stryke/fs": "^0.33.
|
|
128
|
-
"@stryke/json": "^0.9.
|
|
129
|
-
"@stryke/path": "^0.
|
|
130
|
-
"@stryke/
|
|
131
|
-
"@stryke/
|
|
125
|
+
"tsdown": "0.17.0-beta.5",
|
|
126
|
+
"unplugin": "3.0.0-beta.3",
|
|
127
|
+
"@stryke/fs": "^0.33.9",
|
|
128
|
+
"@stryke/json": "^0.9.16",
|
|
129
|
+
"@stryke/path": "^0.22.0",
|
|
130
|
+
"@stryke/string-format": "^0.12.13",
|
|
131
|
+
"@stryke/type-checks": "^0.4.4",
|
|
132
|
+
"@stryke/types": "^0.10.13",
|
|
132
133
|
"defu": "^6.1.4",
|
|
133
|
-
"esbuild-plugin-babel": "^0.2.3",
|
|
134
134
|
"jiti": "^2.6.1",
|
|
135
|
-
"powerlines": "^0.
|
|
135
|
+
"powerlines": "^0.29.0"
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
138
|
-
"@
|
|
139
|
-
"@powerlines/nx": "^0.10.46",
|
|
138
|
+
"@powerlines/nx": "^0.10.48",
|
|
140
139
|
"@rollup/plugin-commonjs": "^28.0.9",
|
|
141
140
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
142
141
|
"@types/babel__helper-plugin-utils": "^7.10.3",
|
|
143
142
|
"@types/node": "^24.10.1",
|
|
144
|
-
"esbuild": "^0.25.12",
|
|
145
143
|
"rollup": "^4.53.3",
|
|
146
144
|
"rollup-plugin-typescript2": "^0.36.0"
|
|
147
145
|
},
|
|
148
146
|
"publishConfig": { "access": "public" },
|
|
149
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "f65e5efb5fd5a7f5eab1936aec5a2807b931ae87"
|
|
150
148
|
}
|
package/dist/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* -------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
⚡ Storm Software - Powerlines
|
|
4
|
-
|
|
5
|
-
This code was released as part of the Powerlines project. Powerlines
|
|
6
|
-
is maintained by Storm Software under the Apache-2.0 license, and is
|
|
7
|
-
free for commercial and private use. For more information, please visit
|
|
8
|
-
our licensing page at https://stormsoftware.com/licenses/projects/powerlines.
|
|
9
|
-
|
|
10
|
-
Website: https://stormsoftware.com
|
|
11
|
-
Repository: https://github.com/storm-software/powerlines
|
|
12
|
-
Documentation: https://docs.stormsoftware.com/projects/powerlines
|
|
13
|
-
Contact: https://stormsoftware.com/contact
|
|
14
|
-
|
|
15
|
-
SPDX-License-Identifier: Apache-2.0
|
|
16
|
-
|
|
17
|
-
------------------------------------------------------------------- */
|
|
18
|
-
|
|
19
|
-
/// <reference path="./src/types/plugin.d.ts" />
|
|
20
|
-
|
|
21
|
-
declare module "powerlines" {
|
|
22
|
-
export interface BaseConfig extends PluginPluginUserConfig {}
|
|
23
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var babel = require('@babel/core');
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
var path = require('path');
|
|
6
|
-
|
|
7
|
-
const pluginBabel = (options = {}) => ({
|
|
8
|
-
name: 'babel',
|
|
9
|
-
setup(build, { transform } = {}) {
|
|
10
|
-
const { filter = /.*/, namespace = '', config = {} } = options;
|
|
11
|
-
|
|
12
|
-
const transformContents = ({ args, contents }) => {
|
|
13
|
-
const babelOptions = babel.loadOptions({
|
|
14
|
-
...config,
|
|
15
|
-
filename: args.path,
|
|
16
|
-
caller: {
|
|
17
|
-
name: 'esbuild-plugin-babel',
|
|
18
|
-
supportsStaticESM: true
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
if (!babelOptions) return { contents };
|
|
22
|
-
|
|
23
|
-
if (babelOptions.sourceMaps) {
|
|
24
|
-
const filename = path.relative(process.cwd(), args.path);
|
|
25
|
-
|
|
26
|
-
babelOptions.sourceFileName = filename;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
babel.transform(contents, babelOptions, (error, result) => {
|
|
31
|
-
error ? reject(error) : resolve({ contents: result.code });
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
if (transform) return transformContents(transform);
|
|
37
|
-
|
|
38
|
-
build.onLoad({ filter, namespace }, async args => {
|
|
39
|
-
const contents = await fs.promises.readFile(args.path, 'utf8');
|
|
40
|
-
|
|
41
|
-
return transformContents({ args, contents });
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
module.exports = pluginBabel;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import babel from '@babel/core';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
const pluginBabel = (options = {}) => ({
|
|
6
|
-
name: 'babel',
|
|
7
|
-
setup(build, { transform } = {}) {
|
|
8
|
-
const { filter = /.*/, namespace = '', config = {} } = options;
|
|
9
|
-
|
|
10
|
-
const transformContents = ({ args, contents }) => {
|
|
11
|
-
const babelOptions = babel.loadOptions({
|
|
12
|
-
...config,
|
|
13
|
-
filename: args.path,
|
|
14
|
-
caller: {
|
|
15
|
-
name: 'esbuild-plugin-babel',
|
|
16
|
-
supportsStaticESM: true
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
if (!babelOptions) return { contents };
|
|
20
|
-
|
|
21
|
-
if (babelOptions.sourceMaps) {
|
|
22
|
-
const filename = path.relative(process.cwd(), args.path);
|
|
23
|
-
|
|
24
|
-
babelOptions.sourceFileName = filename;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return new Promise((resolve, reject) => {
|
|
28
|
-
babel.transform(contents, babelOptions, (error, result) => {
|
|
29
|
-
error ? reject(error) : resolve({ contents: result.code });
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
if (transform) return transformContents(transform);
|
|
35
|
-
|
|
36
|
-
build.onLoad({ filter, namespace }, async args => {
|
|
37
|
-
const contents = await fs.promises.readFile(args.path, 'utf8');
|
|
38
|
-
|
|
39
|
-
return transformContents({ args, contents });
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export { pluginBabel as default };
|