crumbtrail 0.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/chunk-UFJ2BODB.js +7401 -0
- package/dist/cli.cjs +9412 -0
- package/dist/cli.d.cts +358 -0
- package/dist/cli.d.ts +358 -0
- package/dist/cli.js +2048 -0
- package/dist/executor-DKDrkhxM.d.cts +279 -0
- package/dist/executor-DKDrkhxM.d.ts +279 -0
- package/dist/index.cjs +7436 -0
- package/dist/index.d.cts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +64 -0
- package/package.json +55 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export { B as BuildPlanInput, a as BuildPlanOptions, c as DENO_UNSUPPORTED_REASON, d as DOCKER_COMING_SOON_NOTE, D as DetectResult, E as EnvAction, f as ExecuteOptions, g as ExecuteResult, h as ExecutorIO, G as GitTargetStatus, I as InjectIO, P as PackageManager, i as Plan, j as PlanKind, R as Recipe, W as WorkspacePackage, b as buildPlan, k as defaultExecutorIO, l as defaultInjectIO, m as detect, n as detectPackageManager, e as executePlan, o as matchRecipe, p as parseNodeInvocation, q as parsePnpmWorkspace, r as projectAlreadyWired, s as resolveAngularEntry, t as resolveNestEntry, u as resolveOtlpStack, v as resolveReactNativeEntry, w as resolveRemixEntry, x as resolveViteEntry, y as supportsInstrumentationClient } from './executor-DKDrkhxM.cjs';
|
|
2
|
+
import 'crumbtrail-design-system';
|
|
3
|
+
|
|
4
|
+
interface SourceShape {
|
|
5
|
+
/** "" or the UTF-8 BOM if the source started with one. */
|
|
6
|
+
bom: string;
|
|
7
|
+
/** The line terminator the source uses (defaults to LF for empty input). */
|
|
8
|
+
eol: "\n" | "\r\n";
|
|
9
|
+
/** Body lines with the BOM stripped and split on either EOL. */
|
|
10
|
+
lines: string[];
|
|
11
|
+
}
|
|
12
|
+
/** Split source into BOM + EOL style + lines, preserving what we detect. */
|
|
13
|
+
declare function analyzeSource(text: string): SourceShape;
|
|
14
|
+
/**
|
|
15
|
+
* Number of leading lines that form the un-touchable prologue: an optional
|
|
16
|
+
* shebang followed by any directive-prologue lines ("use client"/"use strict"/
|
|
17
|
+
* "use server"), including blank lines interleaved between them. Injection is
|
|
18
|
+
* inserted immediately after this prologue.
|
|
19
|
+
*/
|
|
20
|
+
declare function prologueEnd(lines: string[]): number;
|
|
21
|
+
/** True when the source already references either Crumbtrail SDK package. */
|
|
22
|
+
declare function referencesCrumbtrail(text: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Strictly prepend `block` into `existing`, after any shebang / directive
|
|
25
|
+
* prologue, preserving the source's BOM and CRLF/LF style. `block` is authored
|
|
26
|
+
* with LF newlines and is re-terminated to match the source.
|
|
27
|
+
*/
|
|
28
|
+
declare function prependIntoSource(existing: string, block: string): string;
|
|
29
|
+
/** Ensure a create-file body ends in exactly one trailing newline. */
|
|
30
|
+
declare function withTrailingNewline(text: string): string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Client init block (Next / SvelteKit / Vite). Matches the README exactly:
|
|
34
|
+
* import { Crumbtrail, PRESET_PASSIVE } from "crumbtrail-core";
|
|
35
|
+
* Crumbtrail.init({ ...PRESET_PASSIVE, httpEndpoint, httpAuthToken });
|
|
36
|
+
* The ingest key is inlined — it ships in the client bundle anyway (ingest-only,
|
|
37
|
+
* same posture as a Sentry DSN).
|
|
38
|
+
*/
|
|
39
|
+
declare function clientInitSnippet(endpoint: string, apiKey: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Nuxt client plugin. Wraps the same init in `defineNuxtPlugin` (auto-imported
|
|
42
|
+
* by Nuxt) so it runs client-side on startup.
|
|
43
|
+
*/
|
|
44
|
+
declare function nuxtPluginSnippet(endpoint: string, apiKey: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Node server init. Uses crumbtrail-node's `autoCapture`, which installs
|
|
47
|
+
* best-effort backend crash + console.error capture (uncaught exceptions,
|
|
48
|
+
* unhandled rejections, console.error) around a headless ingest session. It is
|
|
49
|
+
* dynamically imported so the block is valid whether the entry file is ESM,
|
|
50
|
+
* CommonJS, or TypeScript, and it is a plain expression (no top-level await) so
|
|
51
|
+
* it is safe to prepend at the very top of an entry file. The ingest key is read
|
|
52
|
+
* from process.env.CRUMBTRAIL_KEY, which autoCapture loads from `.env` (written by
|
|
53
|
+
* the CLI) itself — never inlined server-side. Express apps can additionally add
|
|
54
|
+
* `createCrumbtrailExpressMiddleware` for per-request capture (see
|
|
55
|
+
* crumbtrail-node's README).
|
|
56
|
+
*/
|
|
57
|
+
declare function nodeInitSnippet(endpoint: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* React Native / Expo init block. Imperative + prepend-safe: it calls
|
|
60
|
+
* `createReactNativeCrumbtrail` (which runs `Crumbtrail.init` and installs the
|
|
61
|
+
* global ErrorUtils crash handler) — the same posture as the node recipe. We do
|
|
62
|
+
* NOT wrap a `<CrumbtrailReactNativeProvider>`, because the injection engine only
|
|
63
|
+
* prepends a block or creates a file; it cannot transform JSX. The ingest key is
|
|
64
|
+
* inlined — it ships in the app bundle anyway (ingest-only, same posture as a
|
|
65
|
+
* Sentry DSN).
|
|
66
|
+
*/
|
|
67
|
+
declare function reactNativeInitSnippet(endpoint: string, apiKey: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Tauri init block. Prepended into the frontend entry. Uses the core
|
|
70
|
+
* `transportInstance` override (NOT the `transport` string-mode field) with a
|
|
71
|
+
* `TauriTransport`, which routes bug reports to the local Rust store via the
|
|
72
|
+
* Tauri plugin — so no httpEndpoint / apiKey is needed in the block.
|
|
73
|
+
*/
|
|
74
|
+
declare function tauriInitSnippet(): string;
|
|
75
|
+
/** The single line the CLI writes into `.env` for the Node recipe. */
|
|
76
|
+
declare function envKeyLine(apiKey: string): string;
|
|
77
|
+
|
|
78
|
+
export { type SourceShape, analyzeSource, clientInitSnippet, envKeyLine, nodeInitSnippet, nuxtPluginSnippet, prependIntoSource, prologueEnd, reactNativeInitSnippet, referencesCrumbtrail, tauriInitSnippet, withTrailingNewline };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export { B as BuildPlanInput, a as BuildPlanOptions, c as DENO_UNSUPPORTED_REASON, d as DOCKER_COMING_SOON_NOTE, D as DetectResult, E as EnvAction, f as ExecuteOptions, g as ExecuteResult, h as ExecutorIO, G as GitTargetStatus, I as InjectIO, P as PackageManager, i as Plan, j as PlanKind, R as Recipe, W as WorkspacePackage, b as buildPlan, k as defaultExecutorIO, l as defaultInjectIO, m as detect, n as detectPackageManager, e as executePlan, o as matchRecipe, p as parseNodeInvocation, q as parsePnpmWorkspace, r as projectAlreadyWired, s as resolveAngularEntry, t as resolveNestEntry, u as resolveOtlpStack, v as resolveReactNativeEntry, w as resolveRemixEntry, x as resolveViteEntry, y as supportsInstrumentationClient } from './executor-DKDrkhxM.js';
|
|
2
|
+
import 'crumbtrail-design-system';
|
|
3
|
+
|
|
4
|
+
interface SourceShape {
|
|
5
|
+
/** "" or the UTF-8 BOM if the source started with one. */
|
|
6
|
+
bom: string;
|
|
7
|
+
/** The line terminator the source uses (defaults to LF for empty input). */
|
|
8
|
+
eol: "\n" | "\r\n";
|
|
9
|
+
/** Body lines with the BOM stripped and split on either EOL. */
|
|
10
|
+
lines: string[];
|
|
11
|
+
}
|
|
12
|
+
/** Split source into BOM + EOL style + lines, preserving what we detect. */
|
|
13
|
+
declare function analyzeSource(text: string): SourceShape;
|
|
14
|
+
/**
|
|
15
|
+
* Number of leading lines that form the un-touchable prologue: an optional
|
|
16
|
+
* shebang followed by any directive-prologue lines ("use client"/"use strict"/
|
|
17
|
+
* "use server"), including blank lines interleaved between them. Injection is
|
|
18
|
+
* inserted immediately after this prologue.
|
|
19
|
+
*/
|
|
20
|
+
declare function prologueEnd(lines: string[]): number;
|
|
21
|
+
/** True when the source already references either Crumbtrail SDK package. */
|
|
22
|
+
declare function referencesCrumbtrail(text: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Strictly prepend `block` into `existing`, after any shebang / directive
|
|
25
|
+
* prologue, preserving the source's BOM and CRLF/LF style. `block` is authored
|
|
26
|
+
* with LF newlines and is re-terminated to match the source.
|
|
27
|
+
*/
|
|
28
|
+
declare function prependIntoSource(existing: string, block: string): string;
|
|
29
|
+
/** Ensure a create-file body ends in exactly one trailing newline. */
|
|
30
|
+
declare function withTrailingNewline(text: string): string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Client init block (Next / SvelteKit / Vite). Matches the README exactly:
|
|
34
|
+
* import { Crumbtrail, PRESET_PASSIVE } from "crumbtrail-core";
|
|
35
|
+
* Crumbtrail.init({ ...PRESET_PASSIVE, httpEndpoint, httpAuthToken });
|
|
36
|
+
* The ingest key is inlined — it ships in the client bundle anyway (ingest-only,
|
|
37
|
+
* same posture as a Sentry DSN).
|
|
38
|
+
*/
|
|
39
|
+
declare function clientInitSnippet(endpoint: string, apiKey: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Nuxt client plugin. Wraps the same init in `defineNuxtPlugin` (auto-imported
|
|
42
|
+
* by Nuxt) so it runs client-side on startup.
|
|
43
|
+
*/
|
|
44
|
+
declare function nuxtPluginSnippet(endpoint: string, apiKey: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Node server init. Uses crumbtrail-node's `autoCapture`, which installs
|
|
47
|
+
* best-effort backend crash + console.error capture (uncaught exceptions,
|
|
48
|
+
* unhandled rejections, console.error) around a headless ingest session. It is
|
|
49
|
+
* dynamically imported so the block is valid whether the entry file is ESM,
|
|
50
|
+
* CommonJS, or TypeScript, and it is a plain expression (no top-level await) so
|
|
51
|
+
* it is safe to prepend at the very top of an entry file. The ingest key is read
|
|
52
|
+
* from process.env.CRUMBTRAIL_KEY, which autoCapture loads from `.env` (written by
|
|
53
|
+
* the CLI) itself — never inlined server-side. Express apps can additionally add
|
|
54
|
+
* `createCrumbtrailExpressMiddleware` for per-request capture (see
|
|
55
|
+
* crumbtrail-node's README).
|
|
56
|
+
*/
|
|
57
|
+
declare function nodeInitSnippet(endpoint: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* React Native / Expo init block. Imperative + prepend-safe: it calls
|
|
60
|
+
* `createReactNativeCrumbtrail` (which runs `Crumbtrail.init` and installs the
|
|
61
|
+
* global ErrorUtils crash handler) — the same posture as the node recipe. We do
|
|
62
|
+
* NOT wrap a `<CrumbtrailReactNativeProvider>`, because the injection engine only
|
|
63
|
+
* prepends a block or creates a file; it cannot transform JSX. The ingest key is
|
|
64
|
+
* inlined — it ships in the app bundle anyway (ingest-only, same posture as a
|
|
65
|
+
* Sentry DSN).
|
|
66
|
+
*/
|
|
67
|
+
declare function reactNativeInitSnippet(endpoint: string, apiKey: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Tauri init block. Prepended into the frontend entry. Uses the core
|
|
70
|
+
* `transportInstance` override (NOT the `transport` string-mode field) with a
|
|
71
|
+
* `TauriTransport`, which routes bug reports to the local Rust store via the
|
|
72
|
+
* Tauri plugin — so no httpEndpoint / apiKey is needed in the block.
|
|
73
|
+
*/
|
|
74
|
+
declare function tauriInitSnippet(): string;
|
|
75
|
+
/** The single line the CLI writes into `.env` for the Node recipe. */
|
|
76
|
+
declare function envKeyLine(apiKey: string): string;
|
|
77
|
+
|
|
78
|
+
export { type SourceShape, analyzeSource, clientInitSnippet, envKeyLine, nodeInitSnippet, nuxtPluginSnippet, prependIntoSource, prologueEnd, reactNativeInitSnippet, referencesCrumbtrail, tauriInitSnippet, withTrailingNewline };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DENO_UNSUPPORTED_REASON,
|
|
3
|
+
DOCKER_COMING_SOON_NOTE,
|
|
4
|
+
analyzeSource,
|
|
5
|
+
buildPlan,
|
|
6
|
+
clientInitSnippet,
|
|
7
|
+
defaultExecutorIO,
|
|
8
|
+
defaultInjectIO,
|
|
9
|
+
detect,
|
|
10
|
+
detectPackageManager,
|
|
11
|
+
envKeyLine,
|
|
12
|
+
executePlan,
|
|
13
|
+
matchRecipe,
|
|
14
|
+
nodeInitSnippet,
|
|
15
|
+
nuxtPluginSnippet,
|
|
16
|
+
parseNodeInvocation,
|
|
17
|
+
parsePnpmWorkspace,
|
|
18
|
+
prependIntoSource,
|
|
19
|
+
projectAlreadyWired,
|
|
20
|
+
prologueEnd,
|
|
21
|
+
reactNativeInitSnippet,
|
|
22
|
+
referencesCrumbtrail,
|
|
23
|
+
resolveAngularEntry,
|
|
24
|
+
resolveNestEntry,
|
|
25
|
+
resolveOtlpStack,
|
|
26
|
+
resolveReactNativeEntry,
|
|
27
|
+
resolveRemixEntry,
|
|
28
|
+
resolveViteEntry,
|
|
29
|
+
supportsInstrumentationClient,
|
|
30
|
+
tauriInitSnippet,
|
|
31
|
+
withTrailingNewline
|
|
32
|
+
} from "./chunk-UFJ2BODB.js";
|
|
33
|
+
export {
|
|
34
|
+
DENO_UNSUPPORTED_REASON,
|
|
35
|
+
DOCKER_COMING_SOON_NOTE,
|
|
36
|
+
analyzeSource,
|
|
37
|
+
buildPlan,
|
|
38
|
+
clientInitSnippet,
|
|
39
|
+
defaultExecutorIO,
|
|
40
|
+
defaultInjectIO,
|
|
41
|
+
detect,
|
|
42
|
+
detectPackageManager,
|
|
43
|
+
envKeyLine,
|
|
44
|
+
executePlan,
|
|
45
|
+
matchRecipe,
|
|
46
|
+
nodeInitSnippet,
|
|
47
|
+
nuxtPluginSnippet,
|
|
48
|
+
parseNodeInvocation,
|
|
49
|
+
parsePnpmWorkspace,
|
|
50
|
+
prependIntoSource,
|
|
51
|
+
projectAlreadyWired,
|
|
52
|
+
prologueEnd,
|
|
53
|
+
reactNativeInitSnippet,
|
|
54
|
+
referencesCrumbtrail,
|
|
55
|
+
resolveAngularEntry,
|
|
56
|
+
resolveNestEntry,
|
|
57
|
+
resolveOtlpStack,
|
|
58
|
+
resolveReactNativeEntry,
|
|
59
|
+
resolveRemixEntry,
|
|
60
|
+
resolveViteEntry,
|
|
61
|
+
supportsInstrumentationClient,
|
|
62
|
+
tauriInitSnippet,
|
|
63
|
+
withTrailingNewline
|
|
64
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "crumbtrail",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Crumbtrail setup CLI — detect your framework and wire the SDK into your app in one step.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/oshabana/crumbtrail.git",
|
|
9
|
+
"directory": "packages/cli"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"crumbtrail",
|
|
13
|
+
"cli",
|
|
14
|
+
"setup",
|
|
15
|
+
"wizard",
|
|
16
|
+
"install"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "./dist/index.cjs",
|
|
20
|
+
"module": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"bin": {
|
|
23
|
+
"crumbtrail": "./dist/cli.cjs"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.15.0"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"require": "./dist/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"test:coverage": "vitest run --coverage",
|
|
46
|
+
"test:watch": "vitest",
|
|
47
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
48
|
+
"clean": "rm -rf dist"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^25.5.0",
|
|
52
|
+
"crumbtrail-design-system": "workspace:*",
|
|
53
|
+
"crumbtrail-install-shared": "workspace:*"
|
|
54
|
+
}
|
|
55
|
+
}
|