@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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
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_UPLOAD_BYTES, S as SNIPPET_LINE_KEY, U as UploadItem, d as UploadOptions, e as UploadSummary, f as findBundles, g as formatUploadSummary, i as injectBundle, h as injectDir, m as mapPathFor, p as processBuildOutput, r as readSourceMappingUrl, j as resolveEndpoint, s as servedFilename, k as shiftMappings, l as snippetLine, n as storedMapJson, o as stripSourceMappingUrl, u as uploadDir } from './build-BXFh_jbP.cjs';
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
2
 
3
3
  /** 8-4-4-4-12 hex: the debug id shape shared with Rollup, Turbopack, esbuild
4
4
  * and Sentry tooling, and what the ingester accepts. */
@@ -28,6 +28,61 @@ declare function debugIdSnippet(id: string): string;
28
28
  * contains it too.) */
29
29
  declare function hasDebugIdSnippet(code: string): boolean;
30
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
+
31
86
  /** What the ingester accepts as a release. */
32
87
  declare const RELEASE_RE: RegExp;
33
88
  /** CI variables that carry the commit being built, in the order they are tried. */
@@ -47,4 +102,4 @@ declare function gitHead(cwd?: string): string | null;
47
102
  */
48
103
  declare function resolveRelease(explicit?: string | null, env?: NodeJS.ProcessEnv, cwd?: string): ResolvedRelease;
49
104
 
50
- export { DEBUG_ID_RE, DEBUG_ID_REGISTRY, RELEASE_ENV_VARS, RELEASE_RE, type ResolvedRelease, debugIdFor, debugIdSnippet, gitHead, hasDebugIdSnippet, normalizeDebugId, readDebugIdComment, resolveRelease };
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.d.ts CHANGED
@@ -1,4 +1,4 @@
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_UPLOAD_BYTES, S as SNIPPET_LINE_KEY, U as UploadItem, d as UploadOptions, e as UploadSummary, f as findBundles, g as formatUploadSummary, i as injectBundle, h as injectDir, m as mapPathFor, p as processBuildOutput, r as readSourceMappingUrl, j as resolveEndpoint, s as servedFilename, k as shiftMappings, l as snippetLine, n as storedMapJson, o as stripSourceMappingUrl, u as uploadDir } from './build-BXFh_jbP.js';
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
2
 
3
3
  /** 8-4-4-4-12 hex: the debug id shape shared with Rollup, Turbopack, esbuild
4
4
  * and Sentry tooling, and what the ingester accepts. */
@@ -28,6 +28,61 @@ declare function debugIdSnippet(id: string): string;
28
28
  * contains it too.) */
29
29
  declare function hasDebugIdSnippet(code: string): boolean;
30
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
+
31
86
  /** What the ingester accepts as a release. */
32
87
  declare const RELEASE_RE: RegExp;
33
88
  /** CI variables that carry the commit being built, in the order they are tried. */
@@ -47,4 +102,4 @@ declare function gitHead(cwd?: string): string | null;
47
102
  */
48
103
  declare function resolveRelease(explicit?: string | null, env?: NodeJS.ProcessEnv, cwd?: string): ResolvedRelease;
49
104
 
50
- export { DEBUG_ID_RE, DEBUG_ID_REGISTRY, RELEASE_ENV_VARS, RELEASE_RE, type ResolvedRelease, debugIdFor, debugIdSnippet, gitHead, hasDebugIdSnippet, normalizeDebugId, readDebugIdComment, resolveRelease };
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 CHANGED
@@ -4,10 +4,14 @@ import {
4
4
  DEBUG_ID_REGISTRY,
5
5
  DEFAULT_ENDPOINT,
6
6
  FatalUploadError,
7
+ MAX_MAP_CHARS,
7
8
  MAX_UPLOAD_BYTES,
8
9
  RELEASE_ENV_VARS,
9
10
  RELEASE_RE,
11
+ SCOPES_KEY,
12
+ SCOPES_VERSION,
10
13
  SNIPPET_LINE_KEY,
14
+ computeScopes,
11
15
  debugIdFor,
12
16
  debugIdSnippet,
13
17
  findBundles,
@@ -29,17 +33,21 @@ import {
29
33
  storedMapJson,
30
34
  stripSourceMappingUrl,
31
35
  uploadDir
32
- } from "./chunk-SIRFO2QU.js";
36
+ } from "./chunk-DQLLM2NT.js";
33
37
  export {
34
38
  BUNDLE_RE,
35
39
  DEBUG_ID_RE,
36
40
  DEBUG_ID_REGISTRY,
37
41
  DEFAULT_ENDPOINT,
38
42
  FatalUploadError,
43
+ MAX_MAP_CHARS,
39
44
  MAX_UPLOAD_BYTES,
40
45
  RELEASE_ENV_VARS,
41
46
  RELEASE_RE,
47
+ SCOPES_KEY,
48
+ SCOPES_VERSION,
42
49
  SNIPPET_LINE_KEY,
50
+ computeScopes,
43
51
  debugIdFor,
44
52
  debugIdSnippet,
45
53
  findBundles,