@autter/runtime-cli 1.0.0 → 1.1.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/README.md +13 -7
- package/dist/{build-BXFh_jbP.d.cts → build-CPXR9Xd3.d.cts} +27 -8
- package/dist/{build-BXFh_jbP.d.ts → build-CPXR9Xd3.d.ts} +27 -8
- package/dist/chunk-DQLLM2NT.js +1035 -0
- package/dist/{chunk-GGHHEUPQ.js → chunk-I2743JCN.js} +26 -8
- package/dist/cli.js +468 -59
- package/dist/index.cjs +547 -49
- package/dist/index.d.cts +57 -2
- package/dist/index.d.ts +57 -2
- package/dist/index.js +9 -1
- package/dist/next.cjs +634 -97
- package/dist/next.d.cts +3 -2
- package/dist/next.d.ts +3 -2
- package/dist/next.js +27 -8
- package/dist/vite.cjs +611 -88
- package/dist/vite.d.cts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.js +32 -6
- package/dist/webpack.cjs +604 -88
- package/dist/webpack.d.cts +11 -4
- package/dist/webpack.d.ts +11 -4
- package/dist/webpack.js +2 -2
- package/package.json +5 -1
- package/dist/chunk-SIRFO2QU.js +0 -524
|
@@ -1,31 +1,49 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUNDLE_RE,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
logMapsNotGenerated,
|
|
4
|
+
processBuildOutput,
|
|
5
|
+
shouldGenerateMaps
|
|
6
|
+
} from "./chunk-DQLLM2NT.js";
|
|
5
7
|
|
|
6
8
|
// src/webpack.ts
|
|
7
9
|
import { resolve } from "path";
|
|
8
10
|
var PLUGIN_NAME = "AutterSourceMapsWebpackPlugin";
|
|
9
11
|
var AutterSourceMapsWebpackPlugin = class {
|
|
10
|
-
constructor(options = {}) {
|
|
12
|
+
constructor(options = {}, internal = {}) {
|
|
11
13
|
this.options = options;
|
|
14
|
+
this.internal = internal;
|
|
12
15
|
}
|
|
13
16
|
options;
|
|
17
|
+
internal;
|
|
14
18
|
apply(compiler) {
|
|
15
19
|
const mode = compiler.options.mode ?? (process.env.NODE_ENV === "development" ? "development" : void 0);
|
|
16
20
|
if (mode === "development") return;
|
|
17
|
-
let enabledMaps = false;
|
|
21
|
+
let enabledMaps = this.internal.ownMaps ?? false;
|
|
18
22
|
if (!compiler.options.devtool) {
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
if (shouldGenerateMaps(this.options)) {
|
|
24
|
+
compiler.options.devtool = "hidden-source-map";
|
|
25
|
+
enabledMaps = true;
|
|
26
|
+
} else {
|
|
27
|
+
logMapsNotGenerated(this.options);
|
|
28
|
+
}
|
|
21
29
|
}
|
|
22
30
|
compiler.hooks.afterEmit.tapPromise(PLUGIN_NAME, async (compilation) => {
|
|
23
31
|
const dir = compilation.outputOptions.path ?? compiler.outputPath;
|
|
24
32
|
if (!dir) return;
|
|
25
33
|
const publicPath = compilation.outputOptions.publicPath;
|
|
26
34
|
const urlPrefix = typeof publicPath === "string" && publicPath !== "auto" && publicPath !== "" ? publicPath : "/";
|
|
27
|
-
const
|
|
28
|
-
|
|
35
|
+
const assets = compilation.getAssets().map((asset) => asset.name);
|
|
36
|
+
const files = assets.filter((name) => BUNDLE_RE.test(name)).map((name) => resolve(dir, name));
|
|
37
|
+
const maps = assets.filter((name) => name.endsWith(".map")).map((name) => resolve(dir, name));
|
|
38
|
+
await processBuildOutput({
|
|
39
|
+
dir,
|
|
40
|
+
files,
|
|
41
|
+
maps,
|
|
42
|
+
urlPrefix,
|
|
43
|
+
options: this.options,
|
|
44
|
+
deleteAfterUpload: enabledMaps,
|
|
45
|
+
ownMaps: enabledMaps
|
|
46
|
+
});
|
|
29
47
|
});
|
|
30
48
|
}
|
|
31
49
|
};
|