@autter/runtime-cli 0.0.0-stage → 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.
@@ -0,0 +1,105 @@
1
+ export { A as AutterSourceMapsOptions, B as BUNDLE_RE, a as BuildOutputResult, b as BundleWithMap, D as DEFAULT_ENDPOINT, F as FatalUploadError, I as InjectOptions, c as InjectResult, M as MAX_MAP_CHARS, d as MAX_UPLOAD_BYTES, S as SNIPPET_LINE_KEY, U as UploadItem, e as UploadOptions, f as UploadSummary, g as findBundles, h as formatUploadSummary, i as injectBundle, j as injectDir, m as mapPathFor, p as processBuildOutput, r as readSourceMappingUrl, k as resolveEndpoint, s as servedFilename, l as shiftMappings, n as snippetLine, o as storedMapJson, q as stripSourceMappingUrl, u as uploadDir } from './build-CPXR9Xd3.cjs';
2
+
3
+ /** 8-4-4-4-12 hex: the debug id shape shared with Rollup, Turbopack, esbuild
4
+ * and Sentry tooling, and what the ingester accepts. */
5
+ declare const DEBUG_ID_RE: RegExp;
6
+ /** Lowercased debug id, or null when the value isn't one. */
7
+ declare function normalizeDebugId(value: unknown): string | null;
8
+ /**
9
+ * The content-addressed debug id of a bundle: the first 16 bytes of
10
+ * sha256(bytes), shaped as a version-4 UUID. The same bytes always get the
11
+ * same id, so rebuilding identical output never produces a new one.
12
+ */
13
+ declare function debugIdFor(bytes: Uint8Array | string): string;
14
+ /** The id in the bundle's last `//# debugId=` comment, if any (ours, or one
15
+ * a bundler wrote natively). */
16
+ declare function readDebugIdComment(code: string): string | null;
17
+ /** Property the browser SDK reads: `globalThis._autterDebugIds[stack] = id`. */
18
+ declare const DEBUG_ID_REGISTRY = "_autterDebugIds";
19
+ /**
20
+ * One line of ES5 that records this bundle's id under the stack of an Error
21
+ * created inside it — the stack's first frame names the script URL the
22
+ * browser actually loaded, which the SDK maps back to the id. `g.Error` keeps
23
+ * working when the bundle shadows `Error` at top level. Never throws.
24
+ */
25
+ declare function debugIdSnippet(id: string): string;
26
+ /** Whether the bundle already carries our registration snippet. (The
27
+ * registry name alone is not enough: a bundle that includes the browser SDK
28
+ * contains it too.) */
29
+ declare function hasDebugIdSnippet(code: string): boolean;
30
+
31
+ /**
32
+ * Function scopes for scope-based frame names (like Sentry's
33
+ * js-source-scopes and PostHog cymbal's `token.scope()`).
34
+ *
35
+ * The ingester used to name a resolved frame with the name the source map
36
+ * holds at its CALLER's position. That is right for `computeTotal()`, and
37
+ * wrong whenever the call goes through a variable: `const run =
38
+ * actions.captured; run()` reported `run`, and handlers a framework calls
39
+ * got the framework's identifier (`func`, `listener`, `fn`). So `upload`
40
+ * parses each bundle (the final file the browser loads, after `inject`),
41
+ * collects every function's generated range and the token that names it,
42
+ * maps that token to its ORIGINAL identifier, and sends the result with the
43
+ * map as `x_autter_scopes`. The ingester names a frame after the innermost
44
+ * function that contains it.
45
+ */
46
+ /** Source map extension field that carries the bundle's function scopes. */
47
+ declare const SCOPES_KEY = "x_autter_scopes";
48
+ declare const SCOPES_VERSION = 1;
49
+ /**
50
+ * The `x_autter_scopes` value. `scopes` is encoded like `mappings`: base64
51
+ * VLQ, `;` between generated lines (the line each scope starts on), `,`
52
+ * between the scopes that start on one line, in start order (outer first on
53
+ * a tie). Each scope is 3 or 4 values, 0-based, in UTF-16 columns:
54
+ *
55
+ * 1. start column, relative to the previous scope's start on the same
56
+ * line (absolute for a line's first scope);
57
+ * 2. end line, relative to the start line;
58
+ * 3. end column (exclusive), relative to the start column when the scope
59
+ * ends on its start line, else absolute;
60
+ * 4. the name, when the function has one: an index into the map's own
61
+ * `names` followed by these `names`, relative to the last name index
62
+ * written (starting from 0).
63
+ *
64
+ * A 3-value scope is anonymous. `names` holds only names the map's own
65
+ * `names` lacks; a `null` entry stands for a minified name that could not
66
+ * be mapped back (the ingester then keeps the frame's call-site name).
67
+ */
68
+ interface SourceMapScopes {
69
+ version: typeof SCOPES_VERSION;
70
+ names: Array<string | null>;
71
+ scopes: string;
72
+ }
73
+ type ScopesResult = {
74
+ scopes: SourceMapScopes;
75
+ } | {
76
+ error: string;
77
+ };
78
+ /**
79
+ * The function scopes of `code` (the bundle exactly as served), named
80
+ * through its source map. Never throws: a bundle that does not parse, or a
81
+ * map without string `mappings`, gives `{ error }` (an upload then goes
82
+ * ahead without scopes).
83
+ */
84
+ declare function computeScopes(code: string, map: Record<string, unknown>): ScopesResult;
85
+
86
+ /** What the ingester accepts as a release. */
87
+ declare const RELEASE_RE: RegExp;
88
+ /** CI variables that carry the commit being built, in the order they are tried. */
89
+ declare const RELEASE_ENV_VARS: readonly ["GITHUB_SHA", "VERCEL_GIT_COMMIT_SHA", "CF_PAGES_COMMIT_SHA", "GIT_SHA"];
90
+ interface ResolvedRelease {
91
+ release: string;
92
+ /** Where it came from: "--release", an env var name, or "git". */
93
+ source: string;
94
+ }
95
+ /** The commit at `cwd`, or null outside a git checkout / without git. */
96
+ declare function gitHead(cwd?: string): string | null;
97
+ /**
98
+ * The release to upload under: the explicit value, else the first CI commit
99
+ * variable that is set (GITHUB_SHA, VERCEL_GIT_COMMIT_SHA, CF_PAGES_COMMIT_SHA,
100
+ * GIT_SHA), else `git rev-parse HEAD`. Throws with a usable message when none
101
+ * is available or the value has characters the ingester rejects.
102
+ */
103
+ declare function resolveRelease(explicit?: string | null, env?: NodeJS.ProcessEnv, cwd?: string): ResolvedRelease;
104
+
105
+ export { DEBUG_ID_RE, DEBUG_ID_REGISTRY, RELEASE_ENV_VARS, RELEASE_RE, type ResolvedRelease, SCOPES_KEY, SCOPES_VERSION, type ScopesResult, type SourceMapScopes, computeScopes, debugIdFor, debugIdSnippet, gitHead, hasDebugIdSnippet, normalizeDebugId, readDebugIdComment, resolveRelease };
@@ -0,0 +1,105 @@
1
+ export { A as AutterSourceMapsOptions, B as BUNDLE_RE, a as BuildOutputResult, b as BundleWithMap, D as DEFAULT_ENDPOINT, F as FatalUploadError, I as InjectOptions, c as InjectResult, M as MAX_MAP_CHARS, d as MAX_UPLOAD_BYTES, S as SNIPPET_LINE_KEY, U as UploadItem, e as UploadOptions, f as UploadSummary, g as findBundles, h as formatUploadSummary, i as injectBundle, j as injectDir, m as mapPathFor, p as processBuildOutput, r as readSourceMappingUrl, k as resolveEndpoint, s as servedFilename, l as shiftMappings, n as snippetLine, o as storedMapJson, q as stripSourceMappingUrl, u as uploadDir } from './build-CPXR9Xd3.js';
2
+
3
+ /** 8-4-4-4-12 hex: the debug id shape shared with Rollup, Turbopack, esbuild
4
+ * and Sentry tooling, and what the ingester accepts. */
5
+ declare const DEBUG_ID_RE: RegExp;
6
+ /** Lowercased debug id, or null when the value isn't one. */
7
+ declare function normalizeDebugId(value: unknown): string | null;
8
+ /**
9
+ * The content-addressed debug id of a bundle: the first 16 bytes of
10
+ * sha256(bytes), shaped as a version-4 UUID. The same bytes always get the
11
+ * same id, so rebuilding identical output never produces a new one.
12
+ */
13
+ declare function debugIdFor(bytes: Uint8Array | string): string;
14
+ /** The id in the bundle's last `//# debugId=` comment, if any (ours, or one
15
+ * a bundler wrote natively). */
16
+ declare function readDebugIdComment(code: string): string | null;
17
+ /** Property the browser SDK reads: `globalThis._autterDebugIds[stack] = id`. */
18
+ declare const DEBUG_ID_REGISTRY = "_autterDebugIds";
19
+ /**
20
+ * One line of ES5 that records this bundle's id under the stack of an Error
21
+ * created inside it — the stack's first frame names the script URL the
22
+ * browser actually loaded, which the SDK maps back to the id. `g.Error` keeps
23
+ * working when the bundle shadows `Error` at top level. Never throws.
24
+ */
25
+ declare function debugIdSnippet(id: string): string;
26
+ /** Whether the bundle already carries our registration snippet. (The
27
+ * registry name alone is not enough: a bundle that includes the browser SDK
28
+ * contains it too.) */
29
+ declare function hasDebugIdSnippet(code: string): boolean;
30
+
31
+ /**
32
+ * Function scopes for scope-based frame names (like Sentry's
33
+ * js-source-scopes and PostHog cymbal's `token.scope()`).
34
+ *
35
+ * The ingester used to name a resolved frame with the name the source map
36
+ * holds at its CALLER's position. That is right for `computeTotal()`, and
37
+ * wrong whenever the call goes through a variable: `const run =
38
+ * actions.captured; run()` reported `run`, and handlers a framework calls
39
+ * got the framework's identifier (`func`, `listener`, `fn`). So `upload`
40
+ * parses each bundle (the final file the browser loads, after `inject`),
41
+ * collects every function's generated range and the token that names it,
42
+ * maps that token to its ORIGINAL identifier, and sends the result with the
43
+ * map as `x_autter_scopes`. The ingester names a frame after the innermost
44
+ * function that contains it.
45
+ */
46
+ /** Source map extension field that carries the bundle's function scopes. */
47
+ declare const SCOPES_KEY = "x_autter_scopes";
48
+ declare const SCOPES_VERSION = 1;
49
+ /**
50
+ * The `x_autter_scopes` value. `scopes` is encoded like `mappings`: base64
51
+ * VLQ, `;` between generated lines (the line each scope starts on), `,`
52
+ * between the scopes that start on one line, in start order (outer first on
53
+ * a tie). Each scope is 3 or 4 values, 0-based, in UTF-16 columns:
54
+ *
55
+ * 1. start column, relative to the previous scope's start on the same
56
+ * line (absolute for a line's first scope);
57
+ * 2. end line, relative to the start line;
58
+ * 3. end column (exclusive), relative to the start column when the scope
59
+ * ends on its start line, else absolute;
60
+ * 4. the name, when the function has one: an index into the map's own
61
+ * `names` followed by these `names`, relative to the last name index
62
+ * written (starting from 0).
63
+ *
64
+ * A 3-value scope is anonymous. `names` holds only names the map's own
65
+ * `names` lacks; a `null` entry stands for a minified name that could not
66
+ * be mapped back (the ingester then keeps the frame's call-site name).
67
+ */
68
+ interface SourceMapScopes {
69
+ version: typeof SCOPES_VERSION;
70
+ names: Array<string | null>;
71
+ scopes: string;
72
+ }
73
+ type ScopesResult = {
74
+ scopes: SourceMapScopes;
75
+ } | {
76
+ error: string;
77
+ };
78
+ /**
79
+ * The function scopes of `code` (the bundle exactly as served), named
80
+ * through its source map. Never throws: a bundle that does not parse, or a
81
+ * map without string `mappings`, gives `{ error }` (an upload then goes
82
+ * ahead without scopes).
83
+ */
84
+ declare function computeScopes(code: string, map: Record<string, unknown>): ScopesResult;
85
+
86
+ /** What the ingester accepts as a release. */
87
+ declare const RELEASE_RE: RegExp;
88
+ /** CI variables that carry the commit being built, in the order they are tried. */
89
+ declare const RELEASE_ENV_VARS: readonly ["GITHUB_SHA", "VERCEL_GIT_COMMIT_SHA", "CF_PAGES_COMMIT_SHA", "GIT_SHA"];
90
+ interface ResolvedRelease {
91
+ release: string;
92
+ /** Where it came from: "--release", an env var name, or "git". */
93
+ source: string;
94
+ }
95
+ /** The commit at `cwd`, or null outside a git checkout / without git. */
96
+ declare function gitHead(cwd?: string): string | null;
97
+ /**
98
+ * The release to upload under: the explicit value, else the first CI commit
99
+ * variable that is set (GITHUB_SHA, VERCEL_GIT_COMMIT_SHA, CF_PAGES_COMMIT_SHA,
100
+ * GIT_SHA), else `git rev-parse HEAD`. Throws with a usable message when none
101
+ * is available or the value has characters the ingester rejects.
102
+ */
103
+ declare function resolveRelease(explicit?: string | null, env?: NodeJS.ProcessEnv, cwd?: string): ResolvedRelease;
104
+
105
+ export { DEBUG_ID_RE, DEBUG_ID_REGISTRY, RELEASE_ENV_VARS, RELEASE_RE, type ResolvedRelease, SCOPES_KEY, SCOPES_VERSION, type ScopesResult, type SourceMapScopes, computeScopes, debugIdFor, debugIdSnippet, gitHead, hasDebugIdSnippet, normalizeDebugId, readDebugIdComment, resolveRelease };
package/dist/index.js ADDED
@@ -0,0 +1,72 @@
1
+ import {
2
+ BUNDLE_RE,
3
+ DEBUG_ID_RE,
4
+ DEBUG_ID_REGISTRY,
5
+ DEFAULT_ENDPOINT,
6
+ FatalUploadError,
7
+ MAX_MAP_CHARS,
8
+ MAX_UPLOAD_BYTES,
9
+ RELEASE_ENV_VARS,
10
+ RELEASE_RE,
11
+ SCOPES_KEY,
12
+ SCOPES_VERSION,
13
+ SNIPPET_LINE_KEY,
14
+ computeScopes,
15
+ debugIdFor,
16
+ debugIdSnippet,
17
+ findBundles,
18
+ formatUploadSummary,
19
+ gitHead,
20
+ hasDebugIdSnippet,
21
+ injectBundle,
22
+ injectDir,
23
+ mapPathFor,
24
+ normalizeDebugId,
25
+ processBuildOutput,
26
+ readDebugIdComment,
27
+ readSourceMappingUrl,
28
+ resolveEndpoint,
29
+ resolveRelease,
30
+ servedFilename,
31
+ shiftMappings,
32
+ snippetLine,
33
+ storedMapJson,
34
+ stripSourceMappingUrl,
35
+ uploadDir
36
+ } from "./chunk-DQLLM2NT.js";
37
+ export {
38
+ BUNDLE_RE,
39
+ DEBUG_ID_RE,
40
+ DEBUG_ID_REGISTRY,
41
+ DEFAULT_ENDPOINT,
42
+ FatalUploadError,
43
+ MAX_MAP_CHARS,
44
+ MAX_UPLOAD_BYTES,
45
+ RELEASE_ENV_VARS,
46
+ RELEASE_RE,
47
+ SCOPES_KEY,
48
+ SCOPES_VERSION,
49
+ SNIPPET_LINE_KEY,
50
+ computeScopes,
51
+ debugIdFor,
52
+ debugIdSnippet,
53
+ findBundles,
54
+ formatUploadSummary,
55
+ gitHead,
56
+ hasDebugIdSnippet,
57
+ injectBundle,
58
+ injectDir,
59
+ mapPathFor,
60
+ normalizeDebugId,
61
+ processBuildOutput,
62
+ readDebugIdComment,
63
+ readSourceMappingUrl,
64
+ resolveEndpoint,
65
+ resolveRelease,
66
+ servedFilename,
67
+ shiftMappings,
68
+ snippetLine,
69
+ storedMapJson,
70
+ stripSourceMappingUrl,
71
+ uploadDir
72
+ };