@storm-software/unbuild 0.17.0 → 0.17.2
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/README.md +1 -1
- package/bin/unbuild.cjs +1404 -102
- package/dist/build.cjs +15 -0
- package/dist/build.d.cts +13 -0
- package/dist/build.d.ts +13 -0
- package/dist/build.js +15 -0
- package/dist/chunk-3GQAWCBQ.js +13 -0
- package/dist/chunk-3VV4SMHK.js +65 -0
- package/dist/chunk-425BMCFI.cjs +31 -0
- package/dist/chunk-5N2TOSNK.cjs +21 -0
- package/dist/chunk-5RCA5OSO.cjs +35 -0
- package/dist/chunk-6G4AZLTO.cjs +28 -0
- package/dist/chunk-BGYQAVKQ.cjs +13 -0
- package/dist/chunk-C2GKE7R5.js +35 -0
- package/dist/chunk-D7L56O4W.js +1039 -0
- package/dist/chunk-DWREBCC4.cjs +557 -0
- package/dist/chunk-EES2DAYR.cjs +65 -0
- package/dist/chunk-FYSN6ZVI.js +21 -0
- package/dist/chunk-GGNOJ77I.js +0 -0
- package/dist/chunk-KVVGB74V.js +31 -0
- package/dist/chunk-LGSLDHM4.cjs +31 -0
- package/dist/chunk-OP52W2X6.cjs +35 -0
- package/dist/chunk-P5CSSAMQ.js +557 -0
- package/dist/chunk-REG7YZIZ.js +31 -0
- package/dist/chunk-SFZRYJZ2.cjs +1 -0
- package/dist/chunk-V3TNL7N7.cjs +1039 -0
- package/dist/chunk-VN5I7Q45.js +28 -0
- package/dist/chunk-X42DGJLB.js +35 -0
- package/dist/clean-BlXMN74D.d.cts +1194 -0
- package/dist/clean-BlXMN74D.d.ts +1194 -0
- package/dist/clean.cjs +8 -0
- package/dist/clean.d.cts +2 -0
- package/dist/clean.d.ts +2 -0
- package/dist/clean.js +8 -0
- package/dist/config.cjs +13 -0
- package/dist/config.d.cts +8 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +13 -0
- package/dist/index.cjs +27 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +27 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.cts +30 -0
- package/dist/types.d.ts +30 -0
- package/dist/types.js +1 -0
- package/package.json +1 -1
package/dist/build.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkV3TNL7N7cjs = require('./chunk-V3TNL7N7.cjs');
|
|
4
|
+
require('./chunk-5N2TOSNK.cjs');
|
|
5
|
+
require('./chunk-LGSLDHM4.cjs');
|
|
6
|
+
require('./chunk-EES2DAYR.cjs');
|
|
7
|
+
require('./chunk-5RCA5OSO.cjs');
|
|
8
|
+
require('./chunk-OP52W2X6.cjs');
|
|
9
|
+
require('./chunk-425BMCFI.cjs');
|
|
10
|
+
require('./chunk-DWREBCC4.cjs');
|
|
11
|
+
require('./chunk-6G4AZLTO.cjs');
|
|
12
|
+
require('./chunk-BGYQAVKQ.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.build = _chunkV3TNL7N7cjs.build;
|
package/dist/build.d.cts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UnbuildOptions } from './types.cjs';
|
|
2
|
+
import '@storm-software/build-tools';
|
|
3
|
+
import 'unbuild';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Execution pipeline that applies a set of actions
|
|
7
|
+
*
|
|
8
|
+
* @param options - the build options
|
|
9
|
+
* @returns the build result
|
|
10
|
+
*/
|
|
11
|
+
declare function build(options: UnbuildOptions): Promise<void>;
|
|
12
|
+
|
|
13
|
+
export { build };
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UnbuildOptions } from './types.js';
|
|
2
|
+
import '@storm-software/build-tools';
|
|
3
|
+
import 'unbuild';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Execution pipeline that applies a set of actions
|
|
7
|
+
*
|
|
8
|
+
* @param options - the build options
|
|
9
|
+
* @returns the build result
|
|
10
|
+
*/
|
|
11
|
+
declare function build(options: UnbuildOptions): Promise<void>;
|
|
12
|
+
|
|
13
|
+
export { build };
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
build
|
|
3
|
+
} from "./chunk-D7L56O4W.js";
|
|
4
|
+
import "./chunk-FYSN6ZVI.js";
|
|
5
|
+
import "./chunk-KVVGB74V.js";
|
|
6
|
+
import "./chunk-3VV4SMHK.js";
|
|
7
|
+
import "./chunk-X42DGJLB.js";
|
|
8
|
+
import "./chunk-C2GKE7R5.js";
|
|
9
|
+
import "./chunk-REG7YZIZ.js";
|
|
10
|
+
import "./chunk-P5CSSAMQ.js";
|
|
11
|
+
import "./chunk-VN5I7Q45.js";
|
|
12
|
+
import "./chunk-3GQAWCBQ.js";
|
|
13
|
+
export {
|
|
14
|
+
build
|
|
15
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
__name,
|
|
12
|
+
__require
|
|
13
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeTrace
|
|
3
|
+
} from "./chunk-P5CSSAMQ.js";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-3GQAWCBQ.js";
|
|
7
|
+
|
|
8
|
+
// src/plugins/tsc.ts
|
|
9
|
+
import { createProjectGraphAsync } from "@nx/devkit";
|
|
10
|
+
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
11
|
+
import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
|
|
12
|
+
import ts2Plugin from "rollup-plugin-typescript2";
|
|
13
|
+
|
|
14
|
+
// src/utilities/helpers.ts
|
|
15
|
+
import { joinPathFragments } from "@nx/devkit";
|
|
16
|
+
import { computeCompilerOptionsPaths } from "@nx/js/src/utils/buildable-libs-utils";
|
|
17
|
+
import { dirname, extname } from "node:path";
|
|
18
|
+
import { pathToFileURL } from "node:url";
|
|
19
|
+
import ts from "typescript";
|
|
20
|
+
async function loadConfig(configPath) {
|
|
21
|
+
if (!/\.(js|mjs)$/.test(extname(configPath))) {
|
|
22
|
+
throw new Error("Unsupported config file format");
|
|
23
|
+
}
|
|
24
|
+
return import(pathToFileURL(configPath).toString()).then((config) => config.default);
|
|
25
|
+
}
|
|
26
|
+
__name(loadConfig, "loadConfig");
|
|
27
|
+
async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
|
|
28
|
+
const tsConfigFile = ts.readConfigFile(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath), ts.sys.readFile);
|
|
29
|
+
const tsConfig = ts.parseJsonConfigFileContent(tsConfigFile.config, ts.sys, dirname(joinPathFragments(config.workspaceRoot, projectRoot, tsConfigPath)));
|
|
30
|
+
const compilerOptions = {
|
|
31
|
+
rootDir: projectRoot,
|
|
32
|
+
declaration: true,
|
|
33
|
+
paths: computeCompilerOptionsPaths(tsConfig, dependencies ?? [])
|
|
34
|
+
};
|
|
35
|
+
writeTrace(compilerOptions, config);
|
|
36
|
+
return compilerOptions;
|
|
37
|
+
}
|
|
38
|
+
__name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
39
|
+
|
|
40
|
+
// src/plugins/tsc.ts
|
|
41
|
+
var tscPlugin = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
|
|
42
|
+
const projectGraph = await createProjectGraphAsync({
|
|
43
|
+
exitOnError: true
|
|
44
|
+
});
|
|
45
|
+
const result = calculateProjectBuildableDependencies(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
46
|
+
let dependencies = result.dependencies;
|
|
47
|
+
const tsLibDependency = getHelperDependency(HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
|
|
48
|
+
if (tsLibDependency) {
|
|
49
|
+
dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
|
|
50
|
+
dependencies.push(tsLibDependency);
|
|
51
|
+
}
|
|
52
|
+
return ts2Plugin({
|
|
53
|
+
check: options.emitTypes !== false,
|
|
54
|
+
tsconfig: resolvedOptions.tsconfig,
|
|
55
|
+
tsconfigOverride: {
|
|
56
|
+
compilerOptions: await createTsCompilerOptions(resolvedOptions.config, resolvedOptions.tsconfig, resolvedOptions.projectRoot, dependencies)
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}, "tscPlugin");
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
loadConfig,
|
|
63
|
+
createTsCompilerOptions,
|
|
64
|
+
tscPlugin
|
|
65
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkDWREBCC4cjs = require('./chunk-DWREBCC4.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
7
|
+
|
|
8
|
+
// src/plugins/on-error.ts
|
|
9
|
+
var onErrorPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options, resolvedOptions) => ({
|
|
10
|
+
name: "storm:on-error",
|
|
11
|
+
buildEnd(error) {
|
|
12
|
+
if (error) {
|
|
13
|
+
_chunkDWREBCC4cjs.writeError.call(void 0, `The following errors occurred during the build:
|
|
14
|
+
${error ? error.message : "Unknown build error"}
|
|
15
|
+
|
|
16
|
+
`, resolvedOptions.config);
|
|
17
|
+
throw new Error("Storm unbuild process failed with errors.");
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
renderError(error) {
|
|
21
|
+
_chunkDWREBCC4cjs.writeError.call(void 0, `The following errors occurred during the build:
|
|
22
|
+
${error ? error.message : "Unknown build error"}
|
|
23
|
+
|
|
24
|
+
`, resolvedOptions.config);
|
|
25
|
+
throw new Error("Storm unbuild process failed with errors.");
|
|
26
|
+
}
|
|
27
|
+
}), "onErrorPlugin");
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
exports.onErrorPlugin = onErrorPlugin;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkDWREBCC4cjs = require('./chunk-DWREBCC4.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
8
|
+
|
|
9
|
+
// src/clean.ts
|
|
10
|
+
var _node = require('@humanfs/node');
|
|
11
|
+
async function clean(name = "Unbuild", directory, config) {
|
|
12
|
+
_chunkDWREBCC4cjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
|
|
13
|
+
const stopwatch = _chunkDWREBCC4cjs.getStopwatch.call(void 0, `${name} output clean`);
|
|
14
|
+
await _node.hfs.deleteAll(directory);
|
|
15
|
+
stopwatch();
|
|
16
|
+
}
|
|
17
|
+
_chunkBGYQAVKQcjs.__name.call(void 0, clean, "clean");
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.clean = clean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
4
|
+
|
|
5
|
+
// src/plugins/type-definitions.ts
|
|
6
|
+
var _path = require('path');
|
|
7
|
+
var typeDefinitions = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options, resolvedOptions) => ({
|
|
8
|
+
name: "storm:dts-bundle",
|
|
9
|
+
async generateBundle(_opts, bundle) {
|
|
10
|
+
for (const file of Object.values(bundle)) {
|
|
11
|
+
if (file.type === "asset" || !file.isEntry || file.facadeModuleId == null) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const hasDefaultExport = file.exports.includes("default");
|
|
15
|
+
const entrySourceFileName = _path.relative.call(void 0, options.projectRoot, file.facadeModuleId);
|
|
16
|
+
const entrySourceDtsName = entrySourceFileName.replace(/\.[cm]?[jt]sx?$/, "");
|
|
17
|
+
const dtsFileName = file.fileName.replace(/\.[cm]?js$/, ".d.ts");
|
|
18
|
+
const relativeSourceDtsName = JSON.stringify("./" + entrySourceDtsName);
|
|
19
|
+
const dtsFileSource = hasDefaultExport ? `
|
|
20
|
+
export * from ${relativeSourceDtsName};
|
|
21
|
+
export { default } from ${relativeSourceDtsName};
|
|
22
|
+
` : `export * from ${relativeSourceDtsName};
|
|
23
|
+
`;
|
|
24
|
+
this.emitFile({
|
|
25
|
+
type: "asset",
|
|
26
|
+
fileName: dtsFileName,
|
|
27
|
+
source: dtsFileSource
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}), "typeDefinitions");
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
exports.typeDefinitions = typeDefinitions;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
5
|
+
|
|
6
|
+
// src/plugins/swc.ts
|
|
7
|
+
var swcPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (options, resolvedOptions) => {
|
|
8
|
+
const { transform } = _chunkBGYQAVKQcjs.__require.call(void 0, "@swc/core");
|
|
9
|
+
return {
|
|
10
|
+
name: "storm:swc",
|
|
11
|
+
transform(code, filename) {
|
|
12
|
+
return transform(code, {
|
|
13
|
+
filename,
|
|
14
|
+
jsc: {
|
|
15
|
+
transform: {
|
|
16
|
+
react: {
|
|
17
|
+
runtime: "automatic"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, "swcPlugin");
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.swcPlugin = swcPlugin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.__name = __name; exports.__require = __require;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeInfo
|
|
3
|
+
} from "./chunk-P5CSSAMQ.js";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-3GQAWCBQ.js";
|
|
7
|
+
|
|
8
|
+
// src/plugins/analyze.ts
|
|
9
|
+
var formatBytes = /* @__PURE__ */ __name((bytes) => {
|
|
10
|
+
if (bytes === 0) return "0 Byte";
|
|
11
|
+
const k = 1e3;
|
|
12
|
+
const dm = 3;
|
|
13
|
+
const sizes = [
|
|
14
|
+
"Bytes",
|
|
15
|
+
"KB",
|
|
16
|
+
"MB",
|
|
17
|
+
"GB"
|
|
18
|
+
];
|
|
19
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
20
|
+
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
|
|
21
|
+
}, "formatBytes");
|
|
22
|
+
var analyzePlugin = /* @__PURE__ */ __name((options, resolvedOptions) => {
|
|
23
|
+
return {
|
|
24
|
+
name: "storm:analyzer",
|
|
25
|
+
renderChunk(source, chunk) {
|
|
26
|
+
const sourceBytes = formatBytes(source.length);
|
|
27
|
+
const fileName = chunk.fileName;
|
|
28
|
+
writeInfo(` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}, "analyzePlugin");
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
analyzePlugin
|
|
35
|
+
};
|