@autter/runtime-cli 1.1.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 +127 -26
- package/dist/{build-CPXR9Xd3.d.cts → build-DGeoDkTh.d.cts} +57 -7
- package/dist/{build-CPXR9Xd3.d.ts → build-DGeoDkTh.d.ts} +57 -7
- package/dist/{chunk-DQLLM2NT.js → chunk-Q23FB5X3.js} +81 -16
- package/dist/{chunk-I2743JCN.js → chunk-V66S2YHN.js} +13 -3
- package/dist/cli.js +1949 -48
- package/dist/index.cjs +348 -22
- package/dist/index.d.cts +68 -5
- package/dist/index.d.ts +68 -5
- package/dist/index.js +267 -2
- package/dist/next.cjs +120 -19
- package/dist/next.d.cts +6 -3
- package/dist/next.d.ts +6 -3
- package/dist/next.js +41 -4
- package/dist/vite.cjs +92 -18
- package/dist/vite.d.cts +5 -1
- package/dist/vite.d.ts +5 -1
- package/dist/vite.js +22 -4
- package/dist/webpack.cjs +86 -19
- package/dist/webpack.d.cts +18 -4
- package/dist/webpack.d.ts +18 -4
- package/dist/webpack.js +5 -3
- package/package.json +2 -1
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");
|
|
@@ -699,6 +700,9 @@ var DEFAULT_ENDPOINT = "https://otlp.autter.dev";
|
|
|
699
700
|
var MAX_MAP_CHARS = 32 * 1024 * 1024;
|
|
700
701
|
var MAX_UPLOAD_BYTES = MAX_MAP_CHARS + 1024 * 1024;
|
|
701
702
|
var LEGACY_MAX_BYTES = 5 * 1024 * 1024;
|
|
703
|
+
var UPLOAD_KEY_PREFIX = "autter_rtu_";
|
|
704
|
+
var CLIENT_KEY_PREFIX = "autter_rtc_";
|
|
705
|
+
var KEY_ADVICE = "set AUTTER_RUNTIME_KEY to an upload-only key (autter_rtu_\u2026, recommended for CI: it can only upload source maps) or the full server key (autter_rt_\u2026, also works)";
|
|
702
706
|
var gzip = (0, import_node_util.promisify)(import_node_zlib.gzip);
|
|
703
707
|
var CHECK_BATCH = 500;
|
|
704
708
|
var MAX_ATTEMPTS = 3;
|
|
@@ -712,9 +716,56 @@ function servedFilename(urlPrefix, path) {
|
|
|
712
716
|
if (!/^[a-z][\w+.-]*:\/\//i.test(prefix) && !prefix.startsWith("/")) prefix = `/${prefix}`;
|
|
713
717
|
return `${prefix.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
714
718
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
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;
|
|
718
769
|
}
|
|
719
770
|
function bytesOf(buffer) {
|
|
720
771
|
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
@@ -725,7 +776,7 @@ function fits(json, body) {
|
|
|
725
776
|
function uploadBody(release, filename, debugId, json) {
|
|
726
777
|
return `{"release":${JSON.stringify(release)},"filename":${JSON.stringify(filename)},${debugId ? `"debugId":${JSON.stringify(debugId)},` : ""}"map":${json}}`;
|
|
727
778
|
}
|
|
728
|
-
async function prepare(bundle, urlPrefix, release, log, compress) {
|
|
779
|
+
async function prepare(bundle, urlPrefix, release, log, compress, sourcesContent) {
|
|
729
780
|
let map;
|
|
730
781
|
try {
|
|
731
782
|
map = JSON.parse(await (0, import_promises3.readFile)(bundle.map, "utf8"));
|
|
@@ -740,9 +791,10 @@ async function prepare(bundle, urlPrefix, release, log, compress) {
|
|
|
740
791
|
const filename = servedFilename(urlPrefix, bundle.path);
|
|
741
792
|
const { [SCOPES_KEY]: _stale, ...plain } = map;
|
|
742
793
|
const scopes = computeScopes(code, map);
|
|
743
|
-
|
|
794
|
+
const stored = { sourcesContent };
|
|
795
|
+
let json = storedMapJson(plain, stored);
|
|
744
796
|
if ("scopes" in scopes) {
|
|
745
|
-
const scoped = storedMapJson({ ...plain, [SCOPES_KEY]: scopes.scopes });
|
|
797
|
+
const scoped = storedMapJson({ ...plain, [SCOPES_KEY]: scopes.scopes }, stored);
|
|
746
798
|
if (fits(scoped, uploadBody(release, filename, debugId, scoped))) json = scoped;
|
|
747
799
|
else if (fits(json, uploadBody(release, filename, debugId, json))) {
|
|
748
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)`);
|
|
@@ -789,7 +841,7 @@ async function uploadDir(dir, options = {}) {
|
|
|
789
841
|
};
|
|
790
842
|
const items = [];
|
|
791
843
|
for (const bundle of await findBundles(dir, options.files)) {
|
|
792
|
-
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);
|
|
793
845
|
if ("error" in prepared) {
|
|
794
846
|
summary.failed.push({ path: bundle.path, filename: servedFilename(options.urlPrefix, bundle.path), error: prepared.error });
|
|
795
847
|
} else if (prepared.mapChars > MAX_MAP_CHARS || prepared.bytes > MAX_UPLOAD_BYTES) {
|
|
@@ -807,10 +859,13 @@ async function uploadDir(dir, options = {}) {
|
|
|
807
859
|
return summary;
|
|
808
860
|
}
|
|
809
861
|
const key = (options.key ?? env.AUTTER_RUNTIME_KEY ?? "").trim();
|
|
810
|
-
if (!key) throw new FatalUploadError(
|
|
811
|
-
if (key.startsWith(
|
|
812
|
-
throw new FatalUploadError(
|
|
862
|
+
if (!key) throw new FatalUploadError(`no ingest key: ${KEY_ADVICE}`);
|
|
863
|
+
if (key.startsWith(CLIENT_KEY_PREFIX)) {
|
|
864
|
+
throw new FatalUploadError(`AUTTER_RUNTIME_KEY is a publishable client key (autter_rtc_\u2026), which cannot upload source maps: ${KEY_ADVICE}`);
|
|
813
865
|
}
|
|
866
|
+
const rejected = (status, detail) => new FatalUploadError(
|
|
867
|
+
`the ingester rejected the key (${status}): ${detail}` + (key.startsWith(UPLOAD_KEY_PREFIX) ? " (upload keys, autter_rtu_\u2026, need ingester 1.7.0 or later; the server key works with any)" : "")
|
|
868
|
+
);
|
|
814
869
|
const headers = { "content-type": "application/json", authorization: `Bearer ${key}` };
|
|
815
870
|
const uploadHeaders = { ...headers, "content-encoding": "gzip" };
|
|
816
871
|
const skipped = /* @__PURE__ */ new Set();
|
|
@@ -832,9 +887,7 @@ async function uploadDir(dir, options = {}) {
|
|
|
832
887
|
);
|
|
833
888
|
break;
|
|
834
889
|
}
|
|
835
|
-
if (res.status === 401 || res.status === 403)
|
|
836
|
-
throw new FatalUploadError(`the ingester rejected the key (${res.status}): ${(await res.text()).slice(0, 300)}`);
|
|
837
|
-
}
|
|
890
|
+
if (res.status === 401 || res.status === 403) throw rejected(res.status, (await res.text()).slice(0, 300));
|
|
838
891
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
839
892
|
const body = await res.json();
|
|
840
893
|
const present = new Set(Array.isArray(body.present) ? body.present : []);
|
|
@@ -865,7 +918,7 @@ async function uploadDir(dir, options = {}) {
|
|
|
865
918
|
detail = err.message;
|
|
866
919
|
}
|
|
867
920
|
if (status === 401 || status === 403) {
|
|
868
|
-
fatal =
|
|
921
|
+
fatal = rejected(status, detail);
|
|
869
922
|
return;
|
|
870
923
|
}
|
|
871
924
|
const retryable = status === 0 || status === 429 || status >= 500;
|
|
@@ -907,6 +960,10 @@ function strip(item) {
|
|
|
907
960
|
}
|
|
908
961
|
|
|
909
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
|
+
}
|
|
910
967
|
function buildKey(options) {
|
|
911
968
|
const key = (options.key ?? process.env.AUTTER_RUNTIME_KEY ?? "").trim();
|
|
912
969
|
return key || null;
|
|
@@ -969,12 +1026,13 @@ async function processBuildOutput(input) {
|
|
|
969
1026
|
result.upload = await uploadDir(input.dir, {
|
|
970
1027
|
files: input.files,
|
|
971
1028
|
release: options.release,
|
|
972
|
-
urlPrefix: options.urlPrefix ?? input.urlPrefix,
|
|
1029
|
+
urlPrefix: input.server ? input.urlPrefix : options.urlPrefix ?? input.urlPrefix,
|
|
973
1030
|
endpoint: options.endpoint,
|
|
974
1031
|
key: key ?? void 0,
|
|
975
1032
|
dryRun: options.dryRun,
|
|
976
1033
|
concurrency: options.concurrency,
|
|
977
1034
|
deleteAfterUpload: options.deleteAfterUpload ?? input.deleteAfterUpload,
|
|
1035
|
+
...options.sourcesContent === false ? { sourcesContent: false } : {},
|
|
978
1036
|
log
|
|
979
1037
|
});
|
|
980
1038
|
for (const line of formatUploadSummary(result.upload)) log(line);
|
|
@@ -1025,6 +1083,11 @@ async function processBuildOutput(input) {
|
|
|
1025
1083
|
|
|
1026
1084
|
// src/webpack.ts
|
|
1027
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
|
+
}
|
|
1028
1091
|
var AutterSourceMapsWebpackPlugin = class {
|
|
1029
1092
|
constructor(options = {}, internal = {}) {
|
|
1030
1093
|
this.options = options;
|
|
@@ -1035,6 +1098,8 @@ var AutterSourceMapsWebpackPlugin = class {
|
|
|
1035
1098
|
apply(compiler) {
|
|
1036
1099
|
const mode = compiler.options.mode ?? (process.env.NODE_ENV === "development" ? "development" : void 0);
|
|
1037
1100
|
if (mode === "development") return;
|
|
1101
|
+
const server = this.internal.server ?? isServerTarget(compiler.options.target);
|
|
1102
|
+
if (server && this.options.serverBundles === false) return;
|
|
1038
1103
|
let enabledMaps = this.internal.ownMaps ?? false;
|
|
1039
1104
|
if (!compiler.options.devtool) {
|
|
1040
1105
|
if (shouldGenerateMaps(this.options)) {
|
|
@@ -1048,7 +1113,7 @@ var AutterSourceMapsWebpackPlugin = class {
|
|
|
1048
1113
|
const dir = compilation.outputOptions.path ?? compiler.outputPath;
|
|
1049
1114
|
if (!dir) return;
|
|
1050
1115
|
const publicPath = compilation.outputOptions.publicPath;
|
|
1051
|
-
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 : "/";
|
|
1052
1117
|
const assets = compilation.getAssets().map((asset) => asset.name);
|
|
1053
1118
|
const files = assets.filter((name) => BUNDLE_RE.test(name)).map((name) => (0, import_node_path3.resolve)(dir, name));
|
|
1054
1119
|
const maps = assets.filter((name) => name.endsWith(".map")).map((name) => (0, import_node_path3.resolve)(dir, name));
|
|
@@ -1059,7 +1124,8 @@ var AutterSourceMapsWebpackPlugin = class {
|
|
|
1059
1124
|
urlPrefix,
|
|
1060
1125
|
options: this.options,
|
|
1061
1126
|
deleteAfterUpload: enabledMaps,
|
|
1062
|
-
ownMaps: enabledMaps
|
|
1127
|
+
ownMaps: enabledMaps,
|
|
1128
|
+
...server ? { server: true } : {}
|
|
1063
1129
|
});
|
|
1064
1130
|
});
|
|
1065
1131
|
}
|
|
@@ -1071,5 +1137,6 @@ var webpack_default = AutterSourceMapsWebpackPlugin;
|
|
|
1071
1137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1072
1138
|
0 && (module.exports = {
|
|
1073
1139
|
AutterSourceMapsWebpackPlugin,
|
|
1074
|
-
autterSourceMapsWebpack
|
|
1140
|
+
autterSourceMapsWebpack,
|
|
1141
|
+
isServerTarget
|
|
1075
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",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"test": "npm run build -w @autter/otlp-ingester && npm run build && node --test test/*.test.mjs"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
+
"@sveltejs/acorn-typescript": "^1.0.13",
|
|
54
55
|
"acorn": "^8.17.0"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|