@autter/runtime-cli 1.2.0 → 1.3.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 +47 -18
- package/dist/{build-BqjqqeLg.d.cts → build-DGeoDkTh.d.cts} +48 -5
- package/dist/{build-BqjqqeLg.d.ts → build-DGeoDkTh.d.ts} +48 -5
- package/dist/{chunk-KIQRQY3X.js → chunk-Q23FB5X3.js} +65 -9
- package/dist/{chunk-SIL3WZZ3.js → chunk-V66S2YHN.js} +13 -3
- package/dist/cli.js +92 -22
- package/dist/index.cjs +80 -13
- package/dist/index.d.cts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +20 -6
- package/dist/next.cjs +109 -12
- package/dist/next.d.cts +6 -3
- package/dist/next.d.ts +6 -3
- package/dist/next.js +41 -4
- package/dist/vite.cjs +81 -11
- package/dist/vite.d.cts +5 -1
- package/dist/vite.d.ts +5 -1
- package/dist/vite.js +22 -4
- package/dist/webpack.cjs +75 -12
- package/dist/webpack.d.cts +18 -4
- package/dist/webpack.d.ts +18 -4
- package/dist/webpack.js +5 -3
- package/package.json +1 -1
package/dist/vite.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AutterSourceMapsOptions } from './build-
|
|
1
|
+
import { A as AutterSourceMapsOptions } from './build-DGeoDkTh.cjs';
|
|
2
2
|
|
|
3
3
|
type SourcemapSetting = boolean | "inline" | "hidden";
|
|
4
4
|
/** The parts of Vite's / Rollup's types this plugin touches (structural, so
|
|
@@ -11,6 +11,7 @@ interface UserConfigLike {
|
|
|
11
11
|
}
|
|
12
12
|
interface ResolvedConfigLike {
|
|
13
13
|
base?: string;
|
|
14
|
+
root?: string;
|
|
14
15
|
build?: {
|
|
15
16
|
sourcemap?: SourcemapSetting;
|
|
16
17
|
ssr?: boolean | string;
|
|
@@ -43,6 +44,9 @@ interface AutterSourceMapsPlugin {
|
|
|
43
44
|
* chunk a debug id after the bundle is written, and uploads the maps when
|
|
44
45
|
* AUTTER_RUNTIME_KEY (or `key`) is set. Maps it turned on are deleted after
|
|
45
46
|
* the upload step whatever its outcome; without a key it turns none on.
|
|
47
|
+
* SSR builds and Vite 6 server environments are uploaded too (RF-05), under
|
|
48
|
+
* their output directory's path in the project (`/dist/server/`), unless
|
|
49
|
+
* `serverBundles: false`.
|
|
46
50
|
*
|
|
47
51
|
* ```ts
|
|
48
52
|
* // vite.config.ts
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AutterSourceMapsOptions } from './build-
|
|
1
|
+
import { A as AutterSourceMapsOptions } from './build-DGeoDkTh.js';
|
|
2
2
|
|
|
3
3
|
type SourcemapSetting = boolean | "inline" | "hidden";
|
|
4
4
|
/** The parts of Vite's / Rollup's types this plugin touches (structural, so
|
|
@@ -11,6 +11,7 @@ interface UserConfigLike {
|
|
|
11
11
|
}
|
|
12
12
|
interface ResolvedConfigLike {
|
|
13
13
|
base?: string;
|
|
14
|
+
root?: string;
|
|
14
15
|
build?: {
|
|
15
16
|
sourcemap?: SourcemapSetting;
|
|
16
17
|
ssr?: boolean | string;
|
|
@@ -43,6 +44,9 @@ interface AutterSourceMapsPlugin {
|
|
|
43
44
|
* chunk a debug id after the bundle is written, and uploads the maps when
|
|
44
45
|
* AUTTER_RUNTIME_KEY (or `key`) is set. Maps it turned on are deleted after
|
|
45
46
|
* the upload step whatever its outcome; without a key it turns none on.
|
|
47
|
+
* SSR builds and Vite 6 server environments are uploaded too (RF-05), under
|
|
48
|
+
* their output directory's path in the project (`/dist/server/`), unless
|
|
49
|
+
* `serverBundles: false`.
|
|
46
50
|
*
|
|
47
51
|
* ```ts
|
|
48
52
|
* // vite.config.ts
|
package/dist/vite.js
CHANGED
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
logMapsNotGenerated,
|
|
3
3
|
processBuildOutput,
|
|
4
4
|
removeSourceMaps,
|
|
5
|
+
serverUrlPrefix,
|
|
5
6
|
shouldGenerateMaps
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Q23FB5X3.js";
|
|
7
8
|
|
|
8
9
|
// src/vite.ts
|
|
9
10
|
import { dirname, resolve } from "path";
|
|
@@ -12,6 +13,8 @@ function autterSourceMaps(options = {}) {
|
|
|
12
13
|
let enabledMaps = false;
|
|
13
14
|
let ssr = false;
|
|
14
15
|
let base = "/";
|
|
16
|
+
let root = process.cwd();
|
|
17
|
+
const serverBundles = options.serverBundles !== false;
|
|
15
18
|
return {
|
|
16
19
|
name: "autter-runtime-sourcemaps",
|
|
17
20
|
apply: "build",
|
|
@@ -19,7 +22,7 @@ function autterSourceMaps(options = {}) {
|
|
|
19
22
|
config(config) {
|
|
20
23
|
isVite = true;
|
|
21
24
|
const current = config.build?.sourcemap;
|
|
22
|
-
if ((current === void 0 || current === false) && !config.build?.ssr) {
|
|
25
|
+
if ((current === void 0 || current === false) && (serverBundles || !config.build?.ssr)) {
|
|
23
26
|
if (!shouldGenerateMaps(options)) {
|
|
24
27
|
logMapsNotGenerated(options);
|
|
25
28
|
return void 0;
|
|
@@ -31,6 +34,7 @@ function autterSourceMaps(options = {}) {
|
|
|
31
34
|
},
|
|
32
35
|
configResolved(config) {
|
|
33
36
|
ssr = Boolean(config.build?.ssr);
|
|
37
|
+
if (config.root) root = config.root;
|
|
34
38
|
if (config.base && /^(\/|[a-z][\w+.-]*:\/\/)/i.test(config.base)) base = config.base;
|
|
35
39
|
if (config.build?.sourcemap === "inline" && !options.silent) {
|
|
36
40
|
console.warn('[autter-runtime] build.sourcemap is "inline": there are no map files to upload; use "hidden"');
|
|
@@ -49,8 +53,23 @@ function autterSourceMaps(options = {}) {
|
|
|
49
53
|
const dir = output.dir ?? (output.file ? dirname(output.file) : void 0);
|
|
50
54
|
if (!dir) return;
|
|
51
55
|
const maps = Object.values(bundle).filter((file) => file.fileName.endsWith(".map")).map((file) => resolve(dir, file.fileName));
|
|
56
|
+
const files = Object.values(bundle).filter((file) => file.type === "chunk").map((file) => resolve(dir, file.fileName));
|
|
52
57
|
const environment = this?.environment;
|
|
53
|
-
|
|
58
|
+
const server = ssr || environment?.config?.consumer === "server";
|
|
59
|
+
if (server && serverBundles) {
|
|
60
|
+
await processBuildOutput({
|
|
61
|
+
dir,
|
|
62
|
+
files,
|
|
63
|
+
maps,
|
|
64
|
+
urlPrefix: serverUrlPrefix(root, dir),
|
|
65
|
+
options,
|
|
66
|
+
deleteAfterUpload: enabledMaps,
|
|
67
|
+
ownMaps: enabledMaps,
|
|
68
|
+
server: true
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (server) {
|
|
54
73
|
if (enabledMaps && options.deleteAfterUpload !== false) {
|
|
55
74
|
try {
|
|
56
75
|
const removed = await removeSourceMaps(maps);
|
|
@@ -63,7 +82,6 @@ function autterSourceMaps(options = {}) {
|
|
|
63
82
|
}
|
|
64
83
|
return;
|
|
65
84
|
}
|
|
66
|
-
const files = Object.values(bundle).filter((file) => file.type === "chunk").map((file) => resolve(dir, file.fileName));
|
|
67
85
|
await processBuildOutput({
|
|
68
86
|
dir,
|
|
69
87
|
files,
|
package/dist/webpack.cjs
CHANGED
|
@@ -22,7 +22,8 @@ var webpack_exports = {};
|
|
|
22
22
|
__export(webpack_exports, {
|
|
23
23
|
AutterSourceMapsWebpackPlugin: () => AutterSourceMapsWebpackPlugin,
|
|
24
24
|
autterSourceMapsWebpack: () => autterSourceMapsWebpack,
|
|
25
|
-
default: () => webpack_default
|
|
25
|
+
default: () => webpack_default,
|
|
26
|
+
isServerTarget: () => isServerTarget
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(webpack_exports);
|
|
28
29
|
var import_node_path3 = require("path");
|
|
@@ -715,9 +716,56 @@ function servedFilename(urlPrefix, path) {
|
|
|
715
716
|
if (!/^[a-z][\w+.-]*:\/\//i.test(prefix) && !prefix.startsWith("/")) prefix = `/${prefix}`;
|
|
716
717
|
return `${prefix.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
717
718
|
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
719
|
+
var NOT_IN_APP_PATH_PARTS = ["node_modules/", "/site-packages/", "/dist-packages/", "/vendor/", "/.pnpm/"];
|
|
720
|
+
var NOT_IN_APP_PATH_PREFIXES = ["node:", "internal/"];
|
|
721
|
+
var EXTENSION_SCHEMES = ["chrome-extension:", "moz-extension:", "safari-extension:", "safari-web-extension:", "webkit-masked-url:"];
|
|
722
|
+
function isInAppSource(path) {
|
|
723
|
+
if (!path) return true;
|
|
724
|
+
const normalized = path.replace(/\\/g, "/");
|
|
725
|
+
if (NOT_IN_APP_PATH_PARTS.some((part) => normalized.includes(part))) return false;
|
|
726
|
+
if (NOT_IN_APP_PATH_PREFIXES.some((prefix) => normalized.startsWith(prefix))) return false;
|
|
727
|
+
const lower = normalized.toLowerCase();
|
|
728
|
+
return !EXTENSION_SCHEMES.some((scheme) => lower.startsWith(scheme));
|
|
729
|
+
}
|
|
730
|
+
var SOURCES_CONTENT_WRAPPER_BYTES = Buffer.byteLength(',"sourcesContent":[]');
|
|
731
|
+
var NULL_ENTRY_BYTES = 4;
|
|
732
|
+
function storedSourcesContent(fields, baseBytes, limit = MAX_MAP_CHARS) {
|
|
733
|
+
const { sources, sourcesContent } = fields;
|
|
734
|
+
if (!Array.isArray(sources) || !Array.isArray(sourcesContent) || sources.length === 0) return null;
|
|
735
|
+
const ignored = /* @__PURE__ */ new Set();
|
|
736
|
+
for (const list of [fields.ignoreList, fields.x_google_ignoreList]) {
|
|
737
|
+
if (!Array.isArray(list)) continue;
|
|
738
|
+
for (const index of list) if (Number.isInteger(index)) ignored.add(index);
|
|
739
|
+
}
|
|
740
|
+
const count = sources.length;
|
|
741
|
+
const candidates = [];
|
|
742
|
+
for (let index = 0; index < count; index++) {
|
|
743
|
+
const source = sources[index];
|
|
744
|
+
const content = sourcesContent[index];
|
|
745
|
+
if (typeof source !== "string" || typeof content !== "string") continue;
|
|
746
|
+
if (ignored.has(index) || !isInAppSource(source)) continue;
|
|
747
|
+
candidates.push({ index, content, bytes: Buffer.byteLength(JSON.stringify(content)) });
|
|
748
|
+
}
|
|
749
|
+
if (candidates.length === 0) return null;
|
|
750
|
+
candidates.sort((a, b) => a.bytes - b.bytes || a.index - b.index);
|
|
751
|
+
let remaining = limit - baseBytes - SOURCES_CONTENT_WRAPPER_BYTES - NULL_ENTRY_BYTES * count - (count - 1);
|
|
752
|
+
const kept = new Array(count).fill(null);
|
|
753
|
+
let any = false;
|
|
754
|
+
for (const candidate of candidates) {
|
|
755
|
+
const extra = candidate.bytes - NULL_ENTRY_BYTES;
|
|
756
|
+
if (extra > remaining) break;
|
|
757
|
+
remaining -= extra;
|
|
758
|
+
kept[candidate.index] = candidate.content;
|
|
759
|
+
any = true;
|
|
760
|
+
}
|
|
761
|
+
return any ? kept : null;
|
|
762
|
+
}
|
|
763
|
+
function storedMapJson(map, options = {}) {
|
|
764
|
+
const { sourcesContent: _content, ...rest } = map;
|
|
765
|
+
const base = JSON.stringify(rest);
|
|
766
|
+
if (options.sourcesContent === false) return base;
|
|
767
|
+
const content = storedSourcesContent(map, Buffer.byteLength(base));
|
|
768
|
+
return content ? JSON.stringify({ ...rest, sourcesContent: content }) : base;
|
|
721
769
|
}
|
|
722
770
|
function bytesOf(buffer) {
|
|
723
771
|
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
@@ -728,7 +776,7 @@ function fits(json, body) {
|
|
|
728
776
|
function uploadBody(release, filename, debugId, json) {
|
|
729
777
|
return `{"release":${JSON.stringify(release)},"filename":${JSON.stringify(filename)},${debugId ? `"debugId":${JSON.stringify(debugId)},` : ""}"map":${json}}`;
|
|
730
778
|
}
|
|
731
|
-
async function prepare(bundle, urlPrefix, release, log, compress) {
|
|
779
|
+
async function prepare(bundle, urlPrefix, release, log, compress, sourcesContent) {
|
|
732
780
|
let map;
|
|
733
781
|
try {
|
|
734
782
|
map = JSON.parse(await (0, import_promises3.readFile)(bundle.map, "utf8"));
|
|
@@ -743,9 +791,10 @@ async function prepare(bundle, urlPrefix, release, log, compress) {
|
|
|
743
791
|
const filename = servedFilename(urlPrefix, bundle.path);
|
|
744
792
|
const { [SCOPES_KEY]: _stale, ...plain } = map;
|
|
745
793
|
const scopes = computeScopes(code, map);
|
|
746
|
-
|
|
794
|
+
const stored = { sourcesContent };
|
|
795
|
+
let json = storedMapJson(plain, stored);
|
|
747
796
|
if ("scopes" in scopes) {
|
|
748
|
-
const scoped = storedMapJson({ ...plain, [SCOPES_KEY]: scopes.scopes });
|
|
797
|
+
const scoped = storedMapJson({ ...plain, [SCOPES_KEY]: scopes.scopes }, stored);
|
|
749
798
|
if (fits(scoped, uploadBody(release, filename, debugId, scoped))) json = scoped;
|
|
750
799
|
else if (fits(json, uploadBody(release, filename, debugId, json))) {
|
|
751
800
|
log(`warning: ${bundle.path}: its map is over 32 MB with function scopes, so it is uploaded without them (frames keep call-site names)`);
|
|
@@ -792,7 +841,7 @@ async function uploadDir(dir, options = {}) {
|
|
|
792
841
|
};
|
|
793
842
|
const items = [];
|
|
794
843
|
for (const bundle of await findBundles(dir, options.files)) {
|
|
795
|
-
const prepared = await prepare(bundle, options.urlPrefix, release, log, !options.dryRun);
|
|
844
|
+
const prepared = await prepare(bundle, options.urlPrefix, release, log, !options.dryRun, options.sourcesContent !== false);
|
|
796
845
|
if ("error" in prepared) {
|
|
797
846
|
summary.failed.push({ path: bundle.path, filename: servedFilename(options.urlPrefix, bundle.path), error: prepared.error });
|
|
798
847
|
} else if (prepared.mapChars > MAX_MAP_CHARS || prepared.bytes > MAX_UPLOAD_BYTES) {
|
|
@@ -911,6 +960,10 @@ function strip(item) {
|
|
|
911
960
|
}
|
|
912
961
|
|
|
913
962
|
// src/build.ts
|
|
963
|
+
function serverUrlPrefix(projectRoot, dir) {
|
|
964
|
+
const rel = (0, import_node_path2.relative)(projectRoot, dir).split(import_node_path2.sep).join("/");
|
|
965
|
+
return !rel || rel.startsWith("..") || (0, import_node_path2.isAbsolute)(rel) ? "/" : `/${rel.replace(/\/+$/, "")}/`;
|
|
966
|
+
}
|
|
914
967
|
function buildKey(options) {
|
|
915
968
|
const key = (options.key ?? process.env.AUTTER_RUNTIME_KEY ?? "").trim();
|
|
916
969
|
return key || null;
|
|
@@ -973,12 +1026,13 @@ async function processBuildOutput(input) {
|
|
|
973
1026
|
result.upload = await uploadDir(input.dir, {
|
|
974
1027
|
files: input.files,
|
|
975
1028
|
release: options.release,
|
|
976
|
-
urlPrefix: options.urlPrefix ?? input.urlPrefix,
|
|
1029
|
+
urlPrefix: input.server ? input.urlPrefix : options.urlPrefix ?? input.urlPrefix,
|
|
977
1030
|
endpoint: options.endpoint,
|
|
978
1031
|
key: key ?? void 0,
|
|
979
1032
|
dryRun: options.dryRun,
|
|
980
1033
|
concurrency: options.concurrency,
|
|
981
1034
|
deleteAfterUpload: options.deleteAfterUpload ?? input.deleteAfterUpload,
|
|
1035
|
+
...options.sourcesContent === false ? { sourcesContent: false } : {},
|
|
982
1036
|
log
|
|
983
1037
|
});
|
|
984
1038
|
for (const line of formatUploadSummary(result.upload)) log(line);
|
|
@@ -1029,6 +1083,11 @@ async function processBuildOutput(input) {
|
|
|
1029
1083
|
|
|
1030
1084
|
// src/webpack.ts
|
|
1031
1085
|
var PLUGIN_NAME = "AutterSourceMapsWebpackPlugin";
|
|
1086
|
+
var SERVER_TARGET_RE = /^(?:async-)?node|^electron-(?:main|preload)/;
|
|
1087
|
+
function isServerTarget(target) {
|
|
1088
|
+
const targets = Array.isArray(target) ? target : [target];
|
|
1089
|
+
return targets.some((value) => typeof value === "string" && SERVER_TARGET_RE.test(value));
|
|
1090
|
+
}
|
|
1032
1091
|
var AutterSourceMapsWebpackPlugin = class {
|
|
1033
1092
|
constructor(options = {}, internal = {}) {
|
|
1034
1093
|
this.options = options;
|
|
@@ -1039,6 +1098,8 @@ var AutterSourceMapsWebpackPlugin = class {
|
|
|
1039
1098
|
apply(compiler) {
|
|
1040
1099
|
const mode = compiler.options.mode ?? (process.env.NODE_ENV === "development" ? "development" : void 0);
|
|
1041
1100
|
if (mode === "development") return;
|
|
1101
|
+
const server = this.internal.server ?? isServerTarget(compiler.options.target);
|
|
1102
|
+
if (server && this.options.serverBundles === false) return;
|
|
1042
1103
|
let enabledMaps = this.internal.ownMaps ?? false;
|
|
1043
1104
|
if (!compiler.options.devtool) {
|
|
1044
1105
|
if (shouldGenerateMaps(this.options)) {
|
|
@@ -1052,7 +1113,7 @@ var AutterSourceMapsWebpackPlugin = class {
|
|
|
1052
1113
|
const dir = compilation.outputOptions.path ?? compiler.outputPath;
|
|
1053
1114
|
if (!dir) return;
|
|
1054
1115
|
const publicPath = compilation.outputOptions.publicPath;
|
|
1055
|
-
const urlPrefix = typeof publicPath === "string" && publicPath !== "auto" && publicPath !== "" ? publicPath : "/";
|
|
1116
|
+
const urlPrefix = server ? serverUrlPrefix(compiler.context ?? process.cwd(), dir) : typeof publicPath === "string" && publicPath !== "auto" && publicPath !== "" ? publicPath : "/";
|
|
1056
1117
|
const assets = compilation.getAssets().map((asset) => asset.name);
|
|
1057
1118
|
const files = assets.filter((name) => BUNDLE_RE.test(name)).map((name) => (0, import_node_path3.resolve)(dir, name));
|
|
1058
1119
|
const maps = assets.filter((name) => name.endsWith(".map")).map((name) => (0, import_node_path3.resolve)(dir, name));
|
|
@@ -1063,7 +1124,8 @@ var AutterSourceMapsWebpackPlugin = class {
|
|
|
1063
1124
|
urlPrefix,
|
|
1064
1125
|
options: this.options,
|
|
1065
1126
|
deleteAfterUpload: enabledMaps,
|
|
1066
|
-
ownMaps: enabledMaps
|
|
1127
|
+
ownMaps: enabledMaps,
|
|
1128
|
+
...server ? { server: true } : {}
|
|
1067
1129
|
});
|
|
1068
1130
|
});
|
|
1069
1131
|
}
|
|
@@ -1075,5 +1137,6 @@ var webpack_default = AutterSourceMapsWebpackPlugin;
|
|
|
1075
1137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1076
1138
|
0 && (module.exports = {
|
|
1077
1139
|
AutterSourceMapsWebpackPlugin,
|
|
1078
|
-
autterSourceMapsWebpack
|
|
1140
|
+
autterSourceMapsWebpack,
|
|
1141
|
+
isServerTarget
|
|
1079
1142
|
});
|
package/dist/webpack.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AutterSourceMapsOptions } from './build-
|
|
1
|
+
import { A as AutterSourceMapsOptions } from './build-DGeoDkTh.cjs';
|
|
2
2
|
|
|
3
3
|
/** The parts of webpack's types this plugin touches (structural, so webpack
|
|
4
4
|
* is not a dependency). */
|
|
@@ -15,7 +15,10 @@ interface CompilerLike {
|
|
|
15
15
|
options: {
|
|
16
16
|
mode?: string;
|
|
17
17
|
devtool?: string | false;
|
|
18
|
+
target?: unknown;
|
|
18
19
|
};
|
|
20
|
+
/** The project directory webpack resolves from (`context`). */
|
|
21
|
+
context?: string;
|
|
19
22
|
outputPath?: string;
|
|
20
23
|
hooks: {
|
|
21
24
|
afterEmit: {
|
|
@@ -23,6 +26,8 @@ interface CompilerLike {
|
|
|
23
26
|
};
|
|
24
27
|
};
|
|
25
28
|
}
|
|
29
|
+
/** Whether a webpack `target` (string, list or false) builds server code. */
|
|
30
|
+
declare function isServerTarget(target: unknown): boolean;
|
|
26
31
|
/**
|
|
27
32
|
* webpack 5 plugin: turns on `hidden-source-map` in production builds that
|
|
28
33
|
* have no `devtool`, gives every emitted JS asset a debug id after emit, and
|
|
@@ -30,6 +35,12 @@ interface CompilerLike {
|
|
|
30
35
|
* on are deleted after the upload step whatever its outcome; without a key
|
|
31
36
|
* it turns none on. Development builds are left alone.
|
|
32
37
|
*
|
|
38
|
+
* Builds for a Node target (`target: "node"`, `"async-node"`,
|
|
39
|
+
* `"electron-main"`) are server bundles (RF-05): their maps are stored under
|
|
40
|
+
* the output directory's path in the project (`/dist/`), which the ingester
|
|
41
|
+
* matches against the path Node runs them from, not under
|
|
42
|
+
* `output.publicPath`. `serverBundles: false` leaves them alone.
|
|
43
|
+
*
|
|
33
44
|
* ```js
|
|
34
45
|
* // webpack.config.js
|
|
35
46
|
* const { AutterSourceMapsWebpackPlugin } = require("@autter/runtime-cli/webpack");
|
|
@@ -38,16 +49,19 @@ interface CompilerLike {
|
|
|
38
49
|
*/
|
|
39
50
|
declare class AutterSourceMapsWebpackPlugin {
|
|
40
51
|
private readonly options;
|
|
41
|
-
/** Set by withAutterSourceMaps, which chooses the devtool itself
|
|
52
|
+
/** Set by withAutterSourceMaps, which chooses the devtool itself and
|
|
53
|
+
* knows which compilations are Next's server ones. */
|
|
42
54
|
private readonly internal;
|
|
43
55
|
constructor(options?: AutterSourceMapsOptions,
|
|
44
|
-
/** Set by withAutterSourceMaps, which chooses the devtool itself
|
|
56
|
+
/** Set by withAutterSourceMaps, which chooses the devtool itself and
|
|
57
|
+
* knows which compilations are Next's server ones. */
|
|
45
58
|
internal?: {
|
|
46
59
|
ownMaps?: boolean;
|
|
60
|
+
server?: boolean;
|
|
47
61
|
});
|
|
48
62
|
apply(compiler: CompilerLike): void;
|
|
49
63
|
}
|
|
50
64
|
/** Functional form: `plugins: [autterSourceMapsWebpack()]`. */
|
|
51
65
|
declare function autterSourceMapsWebpack(options?: AutterSourceMapsOptions): AutterSourceMapsWebpackPlugin;
|
|
52
66
|
|
|
53
|
-
export { AutterSourceMapsOptions, AutterSourceMapsWebpackPlugin, autterSourceMapsWebpack, AutterSourceMapsWebpackPlugin as default };
|
|
67
|
+
export { AutterSourceMapsOptions, AutterSourceMapsWebpackPlugin, autterSourceMapsWebpack, AutterSourceMapsWebpackPlugin as default, isServerTarget };
|
package/dist/webpack.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AutterSourceMapsOptions } from './build-
|
|
1
|
+
import { A as AutterSourceMapsOptions } from './build-DGeoDkTh.js';
|
|
2
2
|
|
|
3
3
|
/** The parts of webpack's types this plugin touches (structural, so webpack
|
|
4
4
|
* is not a dependency). */
|
|
@@ -15,7 +15,10 @@ interface CompilerLike {
|
|
|
15
15
|
options: {
|
|
16
16
|
mode?: string;
|
|
17
17
|
devtool?: string | false;
|
|
18
|
+
target?: unknown;
|
|
18
19
|
};
|
|
20
|
+
/** The project directory webpack resolves from (`context`). */
|
|
21
|
+
context?: string;
|
|
19
22
|
outputPath?: string;
|
|
20
23
|
hooks: {
|
|
21
24
|
afterEmit: {
|
|
@@ -23,6 +26,8 @@ interface CompilerLike {
|
|
|
23
26
|
};
|
|
24
27
|
};
|
|
25
28
|
}
|
|
29
|
+
/** Whether a webpack `target` (string, list or false) builds server code. */
|
|
30
|
+
declare function isServerTarget(target: unknown): boolean;
|
|
26
31
|
/**
|
|
27
32
|
* webpack 5 plugin: turns on `hidden-source-map` in production builds that
|
|
28
33
|
* have no `devtool`, gives every emitted JS asset a debug id after emit, and
|
|
@@ -30,6 +35,12 @@ interface CompilerLike {
|
|
|
30
35
|
* on are deleted after the upload step whatever its outcome; without a key
|
|
31
36
|
* it turns none on. Development builds are left alone.
|
|
32
37
|
*
|
|
38
|
+
* Builds for a Node target (`target: "node"`, `"async-node"`,
|
|
39
|
+
* `"electron-main"`) are server bundles (RF-05): their maps are stored under
|
|
40
|
+
* the output directory's path in the project (`/dist/`), which the ingester
|
|
41
|
+
* matches against the path Node runs them from, not under
|
|
42
|
+
* `output.publicPath`. `serverBundles: false` leaves them alone.
|
|
43
|
+
*
|
|
33
44
|
* ```js
|
|
34
45
|
* // webpack.config.js
|
|
35
46
|
* const { AutterSourceMapsWebpackPlugin } = require("@autter/runtime-cli/webpack");
|
|
@@ -38,16 +49,19 @@ interface CompilerLike {
|
|
|
38
49
|
*/
|
|
39
50
|
declare class AutterSourceMapsWebpackPlugin {
|
|
40
51
|
private readonly options;
|
|
41
|
-
/** Set by withAutterSourceMaps, which chooses the devtool itself
|
|
52
|
+
/** Set by withAutterSourceMaps, which chooses the devtool itself and
|
|
53
|
+
* knows which compilations are Next's server ones. */
|
|
42
54
|
private readonly internal;
|
|
43
55
|
constructor(options?: AutterSourceMapsOptions,
|
|
44
|
-
/** Set by withAutterSourceMaps, which chooses the devtool itself
|
|
56
|
+
/** Set by withAutterSourceMaps, which chooses the devtool itself and
|
|
57
|
+
* knows which compilations are Next's server ones. */
|
|
45
58
|
internal?: {
|
|
46
59
|
ownMaps?: boolean;
|
|
60
|
+
server?: boolean;
|
|
47
61
|
});
|
|
48
62
|
apply(compiler: CompilerLike): void;
|
|
49
63
|
}
|
|
50
64
|
/** Functional form: `plugins: [autterSourceMapsWebpack()]`. */
|
|
51
65
|
declare function autterSourceMapsWebpack(options?: AutterSourceMapsOptions): AutterSourceMapsWebpackPlugin;
|
|
52
66
|
|
|
53
|
-
export { AutterSourceMapsOptions, AutterSourceMapsWebpackPlugin, autterSourceMapsWebpack, AutterSourceMapsWebpackPlugin as default };
|
|
67
|
+
export { AutterSourceMapsOptions, AutterSourceMapsWebpackPlugin, autterSourceMapsWebpack, AutterSourceMapsWebpackPlugin as default, isServerTarget };
|
package/dist/webpack.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutterSourceMapsWebpackPlugin,
|
|
3
3
|
autterSourceMapsWebpack,
|
|
4
|
+
isServerTarget,
|
|
4
5
|
webpack_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-V66S2YHN.js";
|
|
7
|
+
import "./chunk-Q23FB5X3.js";
|
|
7
8
|
export {
|
|
8
9
|
AutterSourceMapsWebpackPlugin,
|
|
9
10
|
autterSourceMapsWebpack,
|
|
10
|
-
webpack_default as default
|
|
11
|
+
webpack_default as default,
|
|
12
|
+
isServerTarget
|
|
11
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autter/runtime-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Readable stack traces for Autter Runtime: inject debug ids into JS bundles and upload their source maps (CLI, Vite/Rollup, webpack and Next.js plugins)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|