@powerlines/plugin-tsup 0.12.133 → 0.12.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/helpers/index.cjs +2 -3
- package/dist/helpers/index.d.cts +1 -3
- package/dist/helpers/index.d.mts +1 -3
- package/dist/helpers/index.mjs +1 -2
- package/dist/helpers/unplugin.cjs +11 -2
- package/dist/helpers/unplugin.d.cts +6 -2
- package/dist/helpers/unplugin.d.mts +6 -2
- package/dist/helpers/unplugin.mjs +9 -1
- package/dist/index.cjs +8 -107
- package/dist/index.d.cts +3 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +3 -103
- package/dist/powerlines/schemas/fs.cjs +226 -0
- package/dist/powerlines/schemas/fs.mjs +224 -0
- package/dist/powerlines/src/api.cjs +580 -0
- package/dist/powerlines/src/api.mjs +578 -0
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +86 -0
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +84 -0
- package/dist/powerlines/src/internal/helpers/environment.cjs +52 -0
- package/dist/powerlines/src/internal/helpers/environment.mjs +48 -0
- package/dist/powerlines/src/internal/helpers/generate-types.cjs +51 -0
- package/dist/powerlines/src/internal/helpers/generate-types.mjs +49 -0
- package/dist/powerlines/src/internal/helpers/hooks.cjs +63 -0
- package/dist/powerlines/src/internal/helpers/hooks.mjs +61 -0
- package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +25 -0
- package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +24 -0
- package/dist/powerlines/src/internal/helpers/install.cjs +37 -0
- package/dist/powerlines/src/internal/helpers/install.mjs +36 -0
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +98 -0
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +94 -0
- package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -0
- package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -0
- package/dist/powerlines/src/lib/build/esbuild.cjs +28 -0
- package/dist/powerlines/src/lib/build/esbuild.mjs +26 -0
- package/dist/powerlines/src/lib/build/tsup.cjs +85 -0
- package/dist/powerlines/src/lib/build/tsup.mjs +82 -0
- package/dist/powerlines/src/lib/config-file.cjs +79 -0
- package/dist/powerlines/src/lib/config-file.mjs +76 -0
- package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -0
- package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -0
- package/dist/powerlines/src/lib/contexts/context.cjs +933 -0
- package/dist/powerlines/src/lib/contexts/context.mjs +931 -0
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +160 -0
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +159 -0
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +75 -0
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +74 -0
- package/dist/powerlines/src/lib/entry.cjs +71 -0
- package/dist/powerlines/src/lib/entry.mjs +67 -0
- package/dist/powerlines/src/lib/fs/helpers.cjs +85 -0
- package/dist/powerlines/src/lib/fs/helpers.mjs +81 -0
- package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -0
- package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -0
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -0
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -0
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -0
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -0
- package/dist/powerlines/src/lib/fs/vfs.cjs +830 -0
- package/dist/powerlines/src/lib/fs/vfs.mjs +828 -0
- package/dist/powerlines/src/lib/logger.cjs +58 -0
- package/dist/powerlines/src/lib/logger.mjs +55 -0
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +104 -0
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +102 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -0
- package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -0
- package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -0
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +17 -0
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +16 -0
- package/dist/powerlines/src/lib/unplugin/index.cjs +3 -0
- package/dist/powerlines/src/lib/unplugin/index.mjs +5 -0
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +128 -0
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +127 -0
- package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
- package/dist/powerlines/src/lib/utilities/meta.cjs +45 -0
- package/dist/powerlines/src/lib/utilities/meta.mjs +41 -0
- package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -0
- package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -0
- package/dist/powerlines/src/plugin-utils/helpers.cjs +148 -0
- package/dist/powerlines/src/plugin-utils/helpers.mjs +138 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
- package/dist/powerlines/src/types/babel.d.mts +4 -0
- package/dist/powerlines/src/types/build.cjs +15 -0
- package/dist/powerlines/src/types/build.d.cts +149 -0
- package/dist/powerlines/src/types/build.d.mts +149 -0
- package/dist/powerlines/src/types/build.mjs +14 -0
- package/dist/powerlines/src/types/commands.cjs +16 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/commands.mjs +15 -0
- package/dist/powerlines/src/types/config.d.cts +377 -0
- package/dist/powerlines/src/types/config.d.mts +378 -0
- package/dist/powerlines/src/types/context.d.cts +403 -0
- package/dist/powerlines/src/types/context.d.mts +405 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/plugin.cjs +32 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -0
- package/dist/powerlines/src/types/plugin.mjs +31 -0
- package/dist/powerlines/src/types/resolved.d.cts +82 -0
- package/dist/powerlines/src/types/resolved.d.mts +82 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.mjs +0 -3
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +15 -1
- package/dist/types/plugin.d.mts +15 -1
- package/dist/types/plugin.mjs +0 -2
- package/package.json +5 -5
- package/dist/helpers-B15z10jN.mjs +0 -1
- package/dist/helpers-LF26RHol.cjs +0 -0
- package/dist/index-9iG2qHLe.d.mts +0 -1
- package/dist/index-D4ELpJXS.d.cts +0 -1
- package/dist/index-D6CnpA_r.d.cts +0 -1
- package/dist/index-DL0uimUT.d.mts +0 -1
- package/dist/plugin-1MQ96Bk2.d.mts +0 -1773
- package/dist/plugin-DSOxaxtV.d.cts +0 -1771
- package/dist/plugin-ifZVa20V.mjs +0 -1
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types-U3zd8PTP.mjs +0 -1
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/unplugin-BQnRwuqv.d.cts +0 -7
- package/dist/unplugin-CKp_xp7Q.cjs +0 -4673
- package/dist/unplugin-DlRwznsD.mjs +0 -4617
- package/dist/unplugin-OyZB70Up.d.mts +0 -7
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
require('../helpers-LF26RHol.cjs');
|
|
1
|
+
const require_helpers_unplugin = require('./unplugin.cjs');
|
|
3
2
|
|
|
4
|
-
exports.createTsupPlugin =
|
|
3
|
+
exports.createTsupPlugin = require_helpers_unplugin.createTsupPlugin;
|
package/dist/helpers/index.d.cts
CHANGED
package/dist/helpers/index.d.mts
CHANGED
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_plugin = require('../powerlines/src/lib/unplugin/plugin.cjs');
|
|
3
|
+
require('../powerlines/src/lib/unplugin/index.cjs');
|
|
4
|
+
let unplugin = require("unplugin");
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
//#region src/helpers/unplugin.ts
|
|
7
|
+
function createTsupPlugin(context) {
|
|
8
|
+
return (0, unplugin.createEsbuildPlugin)(require_plugin.createUnplugin(context))({});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.createTsupPlugin = createTsupPlugin;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import "../plugin
|
|
2
|
-
import
|
|
1
|
+
import { TsupPluginContext } from "../types/plugin.cjs";
|
|
2
|
+
import * as esbuild0 from "esbuild";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/unplugin.d.ts
|
|
5
|
+
declare function createTsupPlugin(context: TsupPluginContext): esbuild0.Plugin;
|
|
6
|
+
//#endregion
|
|
3
7
|
export { createTsupPlugin };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import "../plugin
|
|
2
|
-
import
|
|
1
|
+
import { TsupPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
import * as esbuild0 from "esbuild";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/unplugin.d.ts
|
|
5
|
+
declare function createTsupPlugin(context: TsupPluginContext): esbuild0.Plugin;
|
|
6
|
+
//#endregion
|
|
3
7
|
export { createTsupPlugin };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createUnplugin } from "../powerlines/src/lib/unplugin/plugin.mjs";
|
|
2
|
+
import "../powerlines/src/lib/unplugin/index.mjs";
|
|
3
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
2
4
|
|
|
5
|
+
//#region src/helpers/unplugin.ts
|
|
6
|
+
function createTsupPlugin(context) {
|
|
7
|
+
return createEsbuildPlugin(createUnplugin(context))({});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
3
11
|
export { createTsupPlugin };
|
package/dist/index.cjs
CHANGED
|
@@ -1,113 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
require('./
|
|
4
|
-
require('./
|
|
5
|
-
require('./
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_tsup = require('./powerlines/src/lib/build/tsup.cjs');
|
|
4
|
+
const require_helpers_unplugin = require('./helpers/unplugin.cjs');
|
|
5
|
+
require('./helpers/index.cjs');
|
|
6
6
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
7
7
|
let __storm_software_tsup = require("@storm-software/tsup");
|
|
8
8
|
let __stryke_path_append = require("@stryke/path/append");
|
|
9
9
|
let defu = require("defu");
|
|
10
|
-
defu =
|
|
11
|
-
let __storm_software_tsup_constants = require("@storm-software/tsup/constants");
|
|
12
|
-
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
13
|
-
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
14
|
-
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
15
|
-
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
16
|
-
let __stryke_path_replace = require("@stryke/path/replace");
|
|
17
|
-
require("@stryke/string-format/camel-case");
|
|
18
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
10
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
19
11
|
|
|
20
|
-
//#region ../powerlines/src/lib/build/esbuild.ts
|
|
21
|
-
/**
|
|
22
|
-
* Resolves the entry options for esbuild.
|
|
23
|
-
*
|
|
24
|
-
* @param context - The build context.
|
|
25
|
-
* @param entryPoints - The entry points to resolve.
|
|
26
|
-
* @returns The resolved entry options.
|
|
27
|
-
*/
|
|
28
|
-
function resolveESBuildEntry(context, entryPoints = []) {
|
|
29
|
-
return entryPoints.reduce((ret, entry) => {
|
|
30
|
-
if ((0, __stryke_type_checks_is_string.isString)(entry)) ret[(0, __stryke_path_replace.replaceExtension)((0, __stryke_path_replace.replacePath)(entry, context.config.sourceRoot || context.config.projectRoot))] = (0, __stryke_path_replace.replacePath)(entry, context.config.sourceRoot || context.config.projectRoot);
|
|
31
|
-
else ret[entry.output || require_unplugin.resolveEntryOutput(context, entry.input || entry)] = require_unplugin.resolveEntryInputFile(context, entry.input || entry);
|
|
32
|
-
return ret;
|
|
33
|
-
}, {});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region ../powerlines/src/lib/build/tsup.ts
|
|
38
|
-
const DEFAULT_TSUP_CONFIG = {
|
|
39
|
-
...__storm_software_tsup_constants.DEFAULT_BUILD_OPTIONS,
|
|
40
|
-
platform: "neutral",
|
|
41
|
-
target: "esnext",
|
|
42
|
-
config: false,
|
|
43
|
-
minify: true,
|
|
44
|
-
sourcemap: false,
|
|
45
|
-
cjsInterop: true,
|
|
46
|
-
bundle: true,
|
|
47
|
-
dts: true,
|
|
48
|
-
shims: true,
|
|
49
|
-
silent: true,
|
|
50
|
-
treeshake: true,
|
|
51
|
-
keepNames: true,
|
|
52
|
-
splitting: true,
|
|
53
|
-
banner: {}
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Resolves the entry options for [tsup](https://github.com/egoist/tsup).
|
|
57
|
-
*
|
|
58
|
-
* @param context - The build context.
|
|
59
|
-
* @param entryPoints - The entry points to resolve.
|
|
60
|
-
* @returns The resolved entry options.
|
|
61
|
-
*/
|
|
62
|
-
function resolveTsupEntry(context, entryPoints) {
|
|
63
|
-
return resolveESBuildEntry(context, entryPoints);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Resolves the options for [tsup](https://github.com/egoist/tsup).
|
|
67
|
-
*
|
|
68
|
-
* @param context - The build context.
|
|
69
|
-
* @returns The resolved options.
|
|
70
|
-
*/
|
|
71
|
-
function extractTsupConfig(context) {
|
|
72
|
-
const result = (0, defu.default)({
|
|
73
|
-
esbuildOptions: ((options, ctx) => {
|
|
74
|
-
if (context.config.build.variant === "tsup") {
|
|
75
|
-
if (context.config.build.esbuildOptions) context.config.build.esbuildOptions?.(options, ctx);
|
|
76
|
-
else if (context.config.build.override.esbuildOptions) context.config.build.override.esbuildOptions?.(options, ctx);
|
|
77
|
-
}
|
|
78
|
-
options.alias = {
|
|
79
|
-
...context.builtins.reduce((ret, id) => {
|
|
80
|
-
const path = context.fs.ids[id];
|
|
81
|
-
if (path) ret[id] = path;
|
|
82
|
-
return ret;
|
|
83
|
-
}, {}),
|
|
84
|
-
...options.alias
|
|
85
|
-
};
|
|
86
|
-
}),
|
|
87
|
-
noExternal: context.builtins
|
|
88
|
-
}, context.config.build.variant === "tsup" ? context.config.build.override : {}, context.config.build.variant === "tsup" ? (0, __stryke_helpers_omit.omit)(context.config.build, ["override", "variant"]) : {}, {
|
|
89
|
-
name: context.config.name,
|
|
90
|
-
assets: context.config.output.assets,
|
|
91
|
-
resolveExtensions: context.config.build.extensions,
|
|
92
|
-
outputPath: context.config.output.buildPath,
|
|
93
|
-
projectRoot: context.config.projectRoot,
|
|
94
|
-
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
95
|
-
dts: context.config.build.variant !== "tsup" || !context.config.build?.experimentalDts && !context.config.build.override?.experimentalDts ? { compilerOptions: context.tsconfig.tsconfigJson.compilerOptions } : void 0,
|
|
96
|
-
format: context.config.output.format,
|
|
97
|
-
mode: context.config.mode,
|
|
98
|
-
treeshake: context.config.build.variant === "tsup" ? context.config.build?.treeshake : context.config.build.variant === "tsup" ? context.config.build?.treeShaking : void 0,
|
|
99
|
-
minify: context.config.mode !== "development",
|
|
100
|
-
metafile: context.config.mode === "development",
|
|
101
|
-
sourcemap: context.config.mode === "development",
|
|
102
|
-
silent: context.config.logLevel === null || context.config.mode === "production",
|
|
103
|
-
verbose: context.config.logLevel === null || context.config.logLevel === "trace" || context.config.mode === "development",
|
|
104
|
-
workspaceConfig: { workspaceRoot: context.workspaceConfig.workspaceRoot }
|
|
105
|
-
}, DEFAULT_TSUP_CONFIG);
|
|
106
|
-
result.format = (0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(result.format));
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
//#endregion
|
|
111
12
|
//#region src/index.ts
|
|
112
13
|
/**
|
|
113
14
|
* A Powerlines plugin to use Tsup to build the project.
|
|
@@ -128,7 +29,7 @@ const plugin = (options = {}) => {
|
|
|
128
29
|
async build() {
|
|
129
30
|
return (0, __storm_software_tsup.build)(await (0, __storm_software_tsup.resolveOptions)((0, defu.default)({
|
|
130
31
|
config: false,
|
|
131
|
-
entry: Object.fromEntries(Object.entries(resolveTsupEntry(this, this.entry)).map(([key, value]) => [key, (0, __stryke_path_append.appendPath)(value, this.config.projectRoot)])),
|
|
32
|
+
entry: Object.fromEntries(Object.entries(require_tsup.resolveTsupEntry(this, this.entry)).map(([key, value]) => [key, (0, __stryke_path_append.appendPath)(value, this.config.projectRoot)])),
|
|
132
33
|
esbuildOptions: (options$1, ctx) => {
|
|
133
34
|
if (this.config.build.variant === "tsup") {
|
|
134
35
|
if (this.config.build.esbuildOptions) this.config.build.esbuildOptions?.(options$1, ctx);
|
|
@@ -144,13 +45,13 @@ const plugin = (options = {}) => {
|
|
|
144
45
|
},
|
|
145
46
|
silent: false,
|
|
146
47
|
verbose: true
|
|
147
|
-
}, extractTsupConfig(this), { esbuildPlugins: [
|
|
48
|
+
}, require_tsup.extractTsupConfig(this), { esbuildPlugins: [require_helpers_unplugin.createTsupPlugin(this)] })));
|
|
148
49
|
}
|
|
149
50
|
};
|
|
150
51
|
};
|
|
151
52
|
var src_default = plugin;
|
|
152
53
|
|
|
153
54
|
//#endregion
|
|
154
|
-
exports.createTsupPlugin =
|
|
55
|
+
exports.createTsupPlugin = require_helpers_unplugin.createTsupPlugin;
|
|
155
56
|
exports.default = src_default;
|
|
156
57
|
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import "./index-D4ELpJXS.cjs";
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
2
|
+
import { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig } from "./types/plugin.cjs";
|
|
3
|
+
import { createTsupPlugin } from "./helpers/unplugin.cjs";
|
|
5
4
|
|
|
6
5
|
//#region src/index.d.ts
|
|
7
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import "./index
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
2
|
+
import { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig } from "./types/plugin.mjs";
|
|
3
|
+
import { createTsupPlugin } from "./helpers/unplugin.mjs";
|
|
4
|
+
import "./helpers/index.mjs";
|
|
5
|
+
import "./types/index.mjs";
|
|
5
6
|
|
|
6
7
|
//#region src/index.d.ts
|
|
7
|
-
|
|
8
8
|
/**
|
|
9
9
|
* A Powerlines plugin to use Tsup to build the project.
|
|
10
10
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,111 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./helpers
|
|
3
|
-
import "./
|
|
4
|
-
import "./types-U3zd8PTP.mjs";
|
|
1
|
+
import { extractTsupConfig, resolveTsupEntry } from "./powerlines/src/lib/build/tsup.mjs";
|
|
2
|
+
import { createTsupPlugin } from "./helpers/unplugin.mjs";
|
|
3
|
+
import "./helpers/index.mjs";
|
|
5
4
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
6
5
|
import { build, resolveOptions } from "@storm-software/tsup";
|
|
7
6
|
import { appendPath } from "@stryke/path/append";
|
|
8
7
|
import defu$1 from "defu";
|
|
9
|
-
import { DEFAULT_BUILD_OPTIONS } from "@storm-software/tsup/constants";
|
|
10
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
11
|
-
import { getUnique } from "@stryke/helpers/get-unique";
|
|
12
|
-
import { omit } from "@stryke/helpers/omit";
|
|
13
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
14
|
-
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
15
|
-
import "@stryke/string-format/camel-case";
|
|
16
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
17
8
|
|
|
18
|
-
//#region ../powerlines/src/lib/build/esbuild.ts
|
|
19
|
-
/**
|
|
20
|
-
* Resolves the entry options for esbuild.
|
|
21
|
-
*
|
|
22
|
-
* @param context - The build context.
|
|
23
|
-
* @param entryPoints - The entry points to resolve.
|
|
24
|
-
* @returns The resolved entry options.
|
|
25
|
-
*/
|
|
26
|
-
function resolveESBuildEntry(context, entryPoints = []) {
|
|
27
|
-
return entryPoints.reduce((ret, entry) => {
|
|
28
|
-
if (isString(entry)) ret[replaceExtension(replacePath(entry, context.config.sourceRoot || context.config.projectRoot))] = replacePath(entry, context.config.sourceRoot || context.config.projectRoot);
|
|
29
|
-
else ret[entry.output || resolveEntryOutput(context, entry.input || entry)] = resolveEntryInputFile(context, entry.input || entry);
|
|
30
|
-
return ret;
|
|
31
|
-
}, {});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region ../powerlines/src/lib/build/tsup.ts
|
|
36
|
-
const DEFAULT_TSUP_CONFIG = {
|
|
37
|
-
...DEFAULT_BUILD_OPTIONS,
|
|
38
|
-
platform: "neutral",
|
|
39
|
-
target: "esnext",
|
|
40
|
-
config: false,
|
|
41
|
-
minify: true,
|
|
42
|
-
sourcemap: false,
|
|
43
|
-
cjsInterop: true,
|
|
44
|
-
bundle: true,
|
|
45
|
-
dts: true,
|
|
46
|
-
shims: true,
|
|
47
|
-
silent: true,
|
|
48
|
-
treeshake: true,
|
|
49
|
-
keepNames: true,
|
|
50
|
-
splitting: true,
|
|
51
|
-
banner: {}
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Resolves the entry options for [tsup](https://github.com/egoist/tsup).
|
|
55
|
-
*
|
|
56
|
-
* @param context - The build context.
|
|
57
|
-
* @param entryPoints - The entry points to resolve.
|
|
58
|
-
* @returns The resolved entry options.
|
|
59
|
-
*/
|
|
60
|
-
function resolveTsupEntry(context, entryPoints) {
|
|
61
|
-
return resolveESBuildEntry(context, entryPoints);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Resolves the options for [tsup](https://github.com/egoist/tsup).
|
|
65
|
-
*
|
|
66
|
-
* @param context - The build context.
|
|
67
|
-
* @returns The resolved options.
|
|
68
|
-
*/
|
|
69
|
-
function extractTsupConfig(context) {
|
|
70
|
-
const result = defu$1({
|
|
71
|
-
esbuildOptions: ((options, ctx) => {
|
|
72
|
-
if (context.config.build.variant === "tsup") {
|
|
73
|
-
if (context.config.build.esbuildOptions) context.config.build.esbuildOptions?.(options, ctx);
|
|
74
|
-
else if (context.config.build.override.esbuildOptions) context.config.build.override.esbuildOptions?.(options, ctx);
|
|
75
|
-
}
|
|
76
|
-
options.alias = {
|
|
77
|
-
...context.builtins.reduce((ret, id) => {
|
|
78
|
-
const path = context.fs.ids[id];
|
|
79
|
-
if (path) ret[id] = path;
|
|
80
|
-
return ret;
|
|
81
|
-
}, {}),
|
|
82
|
-
...options.alias
|
|
83
|
-
};
|
|
84
|
-
}),
|
|
85
|
-
noExternal: context.builtins
|
|
86
|
-
}, context.config.build.variant === "tsup" ? context.config.build.override : {}, context.config.build.variant === "tsup" ? omit(context.config.build, ["override", "variant"]) : {}, {
|
|
87
|
-
name: context.config.name,
|
|
88
|
-
assets: context.config.output.assets,
|
|
89
|
-
resolveExtensions: context.config.build.extensions,
|
|
90
|
-
outputPath: context.config.output.buildPath,
|
|
91
|
-
projectRoot: context.config.projectRoot,
|
|
92
|
-
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
93
|
-
dts: context.config.build.variant !== "tsup" || !context.config.build?.experimentalDts && !context.config.build.override?.experimentalDts ? { compilerOptions: context.tsconfig.tsconfigJson.compilerOptions } : void 0,
|
|
94
|
-
format: context.config.output.format,
|
|
95
|
-
mode: context.config.mode,
|
|
96
|
-
treeshake: context.config.build.variant === "tsup" ? context.config.build?.treeshake : context.config.build.variant === "tsup" ? context.config.build?.treeShaking : void 0,
|
|
97
|
-
minify: context.config.mode !== "development",
|
|
98
|
-
metafile: context.config.mode === "development",
|
|
99
|
-
sourcemap: context.config.mode === "development",
|
|
100
|
-
silent: context.config.logLevel === null || context.config.mode === "production",
|
|
101
|
-
verbose: context.config.logLevel === null || context.config.logLevel === "trace" || context.config.mode === "development",
|
|
102
|
-
workspaceConfig: { workspaceRoot: context.workspaceConfig.workspaceRoot }
|
|
103
|
-
}, DEFAULT_TSUP_CONFIG);
|
|
104
|
-
result.format = getUnique(toArray(result.format));
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
//#endregion
|
|
109
9
|
//#region src/index.ts
|
|
110
10
|
/**
|
|
111
11
|
* A Powerlines plugin to use Tsup to build the project.
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_capnp = require("@stryke/capnp");
|
|
3
|
+
__stryke_capnp = require_rolldown_runtime.__toESM(__stryke_capnp);
|
|
4
|
+
|
|
5
|
+
//#region ../powerlines/schemas/fs.ts
|
|
6
|
+
var FileMetadata_KeyValuePair = class extends __stryke_capnp.Struct {
|
|
7
|
+
static _capnp = {
|
|
8
|
+
displayName: "KeyValuePair",
|
|
9
|
+
id: "eabb26cf58b2a14c",
|
|
10
|
+
size: new __stryke_capnp.ObjectSize(0, 2)
|
|
11
|
+
};
|
|
12
|
+
get key() {
|
|
13
|
+
return __stryke_capnp.utils.getText(0, this);
|
|
14
|
+
}
|
|
15
|
+
set key(value) {
|
|
16
|
+
__stryke_capnp.utils.setText(0, value, this);
|
|
17
|
+
}
|
|
18
|
+
get value() {
|
|
19
|
+
return __stryke_capnp.utils.getText(1, this);
|
|
20
|
+
}
|
|
21
|
+
set value(value) {
|
|
22
|
+
__stryke_capnp.utils.setText(1, value, this);
|
|
23
|
+
}
|
|
24
|
+
toString() {
|
|
25
|
+
return "FileMetadata_KeyValuePair_" + super.toString();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The identifier for the file data.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
var FileMetadata = class FileMetadata extends __stryke_capnp.Struct {
|
|
33
|
+
static KeyValuePair = FileMetadata_KeyValuePair;
|
|
34
|
+
static _capnp = {
|
|
35
|
+
displayName: "FileMetadata",
|
|
36
|
+
id: "8e2cab5d7e28c7b3",
|
|
37
|
+
size: new __stryke_capnp.ObjectSize(8, 3),
|
|
38
|
+
defaultType: "normal"
|
|
39
|
+
};
|
|
40
|
+
static _Properties;
|
|
41
|
+
/**
|
|
42
|
+
* The type of the file.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
get id() {
|
|
46
|
+
return __stryke_capnp.utils.getText(0, this);
|
|
47
|
+
}
|
|
48
|
+
set id(value) {
|
|
49
|
+
__stryke_capnp.utils.setText(0, value, this);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The timestamp representing the file's creation date.
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
get type() {
|
|
56
|
+
return __stryke_capnp.utils.getText(1, this, FileMetadata._capnp.defaultType);
|
|
57
|
+
}
|
|
58
|
+
set type(value) {
|
|
59
|
+
__stryke_capnp.utils.setText(1, value, this);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Additional metadata associated with the file.
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
get timestamp() {
|
|
66
|
+
return __stryke_capnp.utils.getUint32(0, this);
|
|
67
|
+
}
|
|
68
|
+
set timestamp(value) {
|
|
69
|
+
__stryke_capnp.utils.setUint32(0, value, this);
|
|
70
|
+
}
|
|
71
|
+
_adoptProperties(value) {
|
|
72
|
+
__stryke_capnp.utils.adopt(value, __stryke_capnp.utils.getPointer(2, this));
|
|
73
|
+
}
|
|
74
|
+
_disownProperties() {
|
|
75
|
+
return __stryke_capnp.utils.disown(this.properties);
|
|
76
|
+
}
|
|
77
|
+
get properties() {
|
|
78
|
+
return __stryke_capnp.utils.getList(2, FileMetadata._Properties, this);
|
|
79
|
+
}
|
|
80
|
+
_hasProperties() {
|
|
81
|
+
return !__stryke_capnp.utils.isNull(__stryke_capnp.utils.getPointer(2, this));
|
|
82
|
+
}
|
|
83
|
+
_initProperties(length) {
|
|
84
|
+
return __stryke_capnp.utils.initList(2, FileMetadata._Properties, length, this);
|
|
85
|
+
}
|
|
86
|
+
set properties(value) {
|
|
87
|
+
__stryke_capnp.utils.copyFrom(value, __stryke_capnp.utils.getPointer(2, this));
|
|
88
|
+
}
|
|
89
|
+
toString() {
|
|
90
|
+
return "FileMetadata_" + super.toString();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* An identifier for the file.
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
var FileId = class extends __stryke_capnp.Struct {
|
|
98
|
+
static _capnp = {
|
|
99
|
+
displayName: "FileId",
|
|
100
|
+
id: "990d6a471072f997",
|
|
101
|
+
size: new __stryke_capnp.ObjectSize(0, 2)
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* A virtual (or actual) path to the file in the file system.
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
get id() {
|
|
108
|
+
return __stryke_capnp.utils.getText(0, this);
|
|
109
|
+
}
|
|
110
|
+
set id(value) {
|
|
111
|
+
__stryke_capnp.utils.setText(0, value, this);
|
|
112
|
+
}
|
|
113
|
+
get path() {
|
|
114
|
+
return __stryke_capnp.utils.getText(1, this);
|
|
115
|
+
}
|
|
116
|
+
set path(value) {
|
|
117
|
+
__stryke_capnp.utils.setText(1, value, this);
|
|
118
|
+
}
|
|
119
|
+
toString() {
|
|
120
|
+
return "FileId_" + super.toString();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* An identifier for the file.
|
|
125
|
+
*
|
|
126
|
+
*/
|
|
127
|
+
var FileStorage = class extends __stryke_capnp.Struct {
|
|
128
|
+
static _capnp = {
|
|
129
|
+
displayName: "FileStorage",
|
|
130
|
+
id: "9dca66ac858c9ebe",
|
|
131
|
+
size: new __stryke_capnp.ObjectSize(0, 2)
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* A virtual (or actual) path to the file in the file system.
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
137
|
+
get path() {
|
|
138
|
+
return __stryke_capnp.utils.getText(0, this);
|
|
139
|
+
}
|
|
140
|
+
set path(value) {
|
|
141
|
+
__stryke_capnp.utils.setText(0, value, this);
|
|
142
|
+
}
|
|
143
|
+
get code() {
|
|
144
|
+
return __stryke_capnp.utils.getText(1, this);
|
|
145
|
+
}
|
|
146
|
+
set code(value) {
|
|
147
|
+
__stryke_capnp.utils.setText(1, value, this);
|
|
148
|
+
}
|
|
149
|
+
toString() {
|
|
150
|
+
return "FileStorage_" + super.toString();
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
var FileSystem = class FileSystem extends __stryke_capnp.Struct {
|
|
154
|
+
static _capnp = {
|
|
155
|
+
displayName: "FileSystem",
|
|
156
|
+
id: "ae0c23d43e56abcf",
|
|
157
|
+
size: new __stryke_capnp.ObjectSize(0, 3)
|
|
158
|
+
};
|
|
159
|
+
static _Ids;
|
|
160
|
+
static _Storage;
|
|
161
|
+
static _Metadata;
|
|
162
|
+
_adoptIds(value) {
|
|
163
|
+
__stryke_capnp.utils.adopt(value, __stryke_capnp.utils.getPointer(0, this));
|
|
164
|
+
}
|
|
165
|
+
_disownIds() {
|
|
166
|
+
return __stryke_capnp.utils.disown(this.ids);
|
|
167
|
+
}
|
|
168
|
+
get ids() {
|
|
169
|
+
return __stryke_capnp.utils.getList(0, FileSystem._Ids, this);
|
|
170
|
+
}
|
|
171
|
+
_hasIds() {
|
|
172
|
+
return !__stryke_capnp.utils.isNull(__stryke_capnp.utils.getPointer(0, this));
|
|
173
|
+
}
|
|
174
|
+
_initIds(length) {
|
|
175
|
+
return __stryke_capnp.utils.initList(0, FileSystem._Ids, length, this);
|
|
176
|
+
}
|
|
177
|
+
set ids(value) {
|
|
178
|
+
__stryke_capnp.utils.copyFrom(value, __stryke_capnp.utils.getPointer(0, this));
|
|
179
|
+
}
|
|
180
|
+
_adoptStorage(value) {
|
|
181
|
+
__stryke_capnp.utils.adopt(value, __stryke_capnp.utils.getPointer(1, this));
|
|
182
|
+
}
|
|
183
|
+
_disownStorage() {
|
|
184
|
+
return __stryke_capnp.utils.disown(this.storage);
|
|
185
|
+
}
|
|
186
|
+
get storage() {
|
|
187
|
+
return __stryke_capnp.utils.getList(1, FileSystem._Storage, this);
|
|
188
|
+
}
|
|
189
|
+
_hasStorage() {
|
|
190
|
+
return !__stryke_capnp.utils.isNull(__stryke_capnp.utils.getPointer(1, this));
|
|
191
|
+
}
|
|
192
|
+
_initStorage(length) {
|
|
193
|
+
return __stryke_capnp.utils.initList(1, FileSystem._Storage, length, this);
|
|
194
|
+
}
|
|
195
|
+
set storage(value) {
|
|
196
|
+
__stryke_capnp.utils.copyFrom(value, __stryke_capnp.utils.getPointer(1, this));
|
|
197
|
+
}
|
|
198
|
+
_adoptMetadata(value) {
|
|
199
|
+
__stryke_capnp.utils.adopt(value, __stryke_capnp.utils.getPointer(2, this));
|
|
200
|
+
}
|
|
201
|
+
_disownMetadata() {
|
|
202
|
+
return __stryke_capnp.utils.disown(this.metadata);
|
|
203
|
+
}
|
|
204
|
+
get metadata() {
|
|
205
|
+
return __stryke_capnp.utils.getList(2, FileSystem._Metadata, this);
|
|
206
|
+
}
|
|
207
|
+
_hasMetadata() {
|
|
208
|
+
return !__stryke_capnp.utils.isNull(__stryke_capnp.utils.getPointer(2, this));
|
|
209
|
+
}
|
|
210
|
+
_initMetadata(length) {
|
|
211
|
+
return __stryke_capnp.utils.initList(2, FileSystem._Metadata, length, this);
|
|
212
|
+
}
|
|
213
|
+
set metadata(value) {
|
|
214
|
+
__stryke_capnp.utils.copyFrom(value, __stryke_capnp.utils.getPointer(2, this));
|
|
215
|
+
}
|
|
216
|
+
toString() {
|
|
217
|
+
return "FileSystem_" + super.toString();
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
FileMetadata._Properties = __stryke_capnp.CompositeList(FileMetadata_KeyValuePair);
|
|
221
|
+
FileSystem._Ids = __stryke_capnp.CompositeList(FileId);
|
|
222
|
+
FileSystem._Storage = __stryke_capnp.CompositeList(FileStorage);
|
|
223
|
+
FileSystem._Metadata = __stryke_capnp.CompositeList(FileMetadata);
|
|
224
|
+
|
|
225
|
+
//#endregion
|
|
226
|
+
exports.FileSystem = FileSystem;
|