@vibe-agent-toolkit/utils 0.2.0-rc.2 → 0.2.0-rc.4
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 +26 -15
- package/dist/compare-code-units.d.ts +28 -0
- package/dist/compare-code-units.d.ts.map +1 -0
- package/dist/compare-code-units.js +33 -0
- package/dist/compare-code-units.js.map +1 -0
- package/dist/crawl-timing.d.ts +657 -0
- package/dist/crawl-timing.d.ts.map +1 -0
- package/dist/crawl-timing.js +765 -0
- package/dist/crawl-timing.js.map +1 -0
- package/dist/crawl.d.ts +2 -4
- package/dist/crawl.d.ts.map +1 -1
- package/dist/crawl.js +2 -4
- package/dist/crawl.js.map +1 -1
- package/dist/file-crawler.d.ts +22 -0
- package/dist/file-crawler.d.ts.map +1 -1
- package/dist/file-crawler.js +31 -7
- package/dist/file-crawler.js.map +1 -1
- package/dist/fs-utils.d.ts +17 -0
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/fs-utils.js +69 -0
- package/dist/fs-utils.js.map +1 -1
- package/dist/fs.d.ts +3 -1
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +5 -1
- package/dist/fs.js.map +1 -1
- package/dist/git-run.d.ts +167 -0
- package/dist/git-run.d.ts.map +1 -0
- package/dist/git-run.js +154 -0
- package/dist/git-run.js.map +1 -0
- package/dist/git-snapshot.d.ts +181 -0
- package/dist/git-snapshot.d.ts.map +1 -0
- package/dist/git-snapshot.js +232 -0
- package/dist/git-snapshot.js.map +1 -0
- package/dist/git-tracker.d.ts +94 -1
- package/dist/git-tracker.d.ts.map +1 -1
- package/dist/git-tracker.js +135 -3
- package/dist/git-tracker.js.map +1 -1
- package/dist/git-utils.d.ts +38 -0
- package/dist/git-utils.d.ts.map +1 -1
- package/dist/git-utils.js +103 -80
- package/dist/git-utils.js.map +1 -1
- package/dist/git.d.ts +12 -4
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +12 -4
- package/dist/git.js.map +1 -1
- package/dist/gitignore-checker.d.ts.map +1 -1
- package/dist/gitignore-checker.js +6 -3
- package/dist/gitignore-checker.js.map +1 -1
- package/dist/index.d.ts +24 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -30
- package/dist/index.js.map +1 -1
- package/dist/path-core.d.ts +1 -1
- package/dist/path-core.js +1 -1
- package/dist/project-utils.d.ts.map +1 -1
- package/dist/project-utils.js +6 -3
- package/dist/project-utils.js.map +1 -1
- package/dist/project.d.ts +7 -5
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +7 -5
- package/dist/project.js.map +1 -1
- package/dist/safe-exec.d.ts +38 -10
- package/dist/safe-exec.d.ts.map +1 -1
- package/dist/safe-exec.js +88 -19
- package/dist/safe-exec.js.map +1 -1
- package/dist/skill-test/index.d.ts +1 -1
- package/dist/skill-test/index.d.ts.map +1 -1
- package/dist/skill-test/index.js +1 -1
- package/dist/skill-test/index.js.map +1 -1
- package/dist/skill-test/spawn-claude.d.ts +28 -0
- package/dist/skill-test/spawn-claude.d.ts.map +1 -1
- package/dist/skill-test/spawn-claude.js +51 -2
- package/dist/skill-test/spawn-claude.js.map +1 -1
- package/dist/skill-test/transcript.d.ts +41 -2
- package/dist/skill-test/transcript.d.ts.map +1 -1
- package/dist/skill-test/transcript.js +47 -3
- package/dist/skill-test/transcript.js.map +1 -1
- package/dist/test-helpers.d.ts +185 -13
- package/dist/test-helpers.d.ts.map +1 -1
- package/dist/test-helpers.js +274 -27
- package/dist/test-helpers.js.map +1 -1
- package/dist/testing.d.ts +73 -3
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +93 -3
- package/dist/testing.js.map +1 -1
- package/dist/text-content.d.ts +197 -0
- package/dist/text-content.d.ts.map +1 -0
- package/dist/text-content.js +348 -0
- package/dist/text-content.js.map +1 -0
- package/dist/text-file.d.ts +45 -0
- package/dist/text-file.d.ts.map +1 -0
- package/dist/text-file.js +53 -0
- package/dist/text-file.js.map +1 -0
- package/dist/text.d.ts +16 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +16 -0
- package/dist/text.js.map +1 -0
- package/dist/timing-dump.d.ts +136 -0
- package/dist/timing-dump.d.ts.map +1 -0
- package/dist/timing-dump.js +230 -0
- package/dist/timing-dump.js.map +1 -0
- package/eslint/README.md +105 -3
- package/eslint/index.cjs +50 -0
- package/eslint/index.d.cts +14 -4
- package/eslint/rules/no-bare-symlink-in-tests.cjs +200 -0
- package/eslint/rules/no-process-exit-in-phase.cjs +117 -0
- package/eslint/rules/no-raw-text-decode.cjs +296 -0
- package/eslint/rules/no-self-package-import.cjs +157 -0
- package/package.json +13 -8
- package/dist/link-auth/build-headers.d.ts +0 -34
- package/dist/link-auth/build-headers.d.ts.map +0 -1
- package/dist/link-auth/build-headers.js +0 -58
- package/dist/link-auth/build-headers.js.map +0 -1
- package/dist/link-auth/expand-macro.d.ts +0 -38
- package/dist/link-auth/expand-macro.d.ts.map +0 -1
- package/dist/link-auth/expand-macro.js +0 -133
- package/dist/link-auth/expand-macro.js.map +0 -1
- package/dist/link-auth/macros.yaml +0 -50
- package/dist/link-auth/resolve-token.d.ts +0 -83
- package/dist/link-auth/resolve-token.d.ts.map +0 -1
- package/dist/link-auth/resolve-token.js +0 -101
- package/dist/link-auth/resolve-token.js.map +0 -1
- package/dist/link-auth/resolve.d.ts +0 -102
- package/dist/link-auth/resolve.d.ts.map +0 -1
- package/dist/link-auth/resolve.js +0 -66
- package/dist/link-auth/resolve.js.map +0 -1
- package/dist/link-auth/rewrite.d.ts +0 -52
- package/dist/link-auth/rewrite.d.ts.map +0 -1
- package/dist/link-auth/rewrite.js +0 -102
- package/dist/link-auth/rewrite.js.map +0 -1
- package/dist/link-auth/select-provider.d.ts +0 -30
- package/dist/link-auth/select-provider.d.ts.map +0 -1
- package/dist/link-auth/select-provider.js +0 -55
- package/dist/link-auth/select-provider.js.map +0 -1
- package/dist/link-auth/template.d.ts +0 -40
- package/dist/link-auth/template.d.ts.map +0 -1
- package/dist/link-auth/template.js +0 -89
- package/dist/link-auth/template.js.map +0 -1
- package/dist/link-auth/transforms.d.ts +0 -46
- package/dist/link-auth/transforms.d.ts.map +0 -1
- package/dist/link-auth/transforms.js +0 -52
- package/dist/link-auth/transforms.js.map +0 -1
- package/dist/template-entry.d.ts +0 -10
- package/dist/template-entry.d.ts.map +0 -1
- package/dist/template-entry.js +0 -10
- package/dist/template-entry.js.map +0 -1
- package/dist/template.d.ts +0 -7
- package/dist/template.d.ts.map +0 -1
- package/dist/template.js +0 -18
- package/dist/template.js.map +0 -1
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tiny template renderer for linkAuth rewrite + header templates.
|
|
3
|
-
*
|
|
4
|
-
* Syntax (strict, no escapes, no nesting):
|
|
5
|
-
* - `${name}` → context[name]
|
|
6
|
-
* - `${transform(name)}` → applyTransform(transform, context[name])
|
|
7
|
-
*
|
|
8
|
-
* Anything else inside `${...}` throws `TemplateSyntaxError`. Missing context
|
|
9
|
-
* keys throw `TemplateMissingVarError`. Unknown transform names propagate
|
|
10
|
-
* `UnknownTransformError` from the transforms allowlist.
|
|
11
|
-
*
|
|
12
|
-
* This is NOT the project's general-purpose Handlebars renderer
|
|
13
|
-
* (`utils/template.ts`) — that one is `{{...}}` and consumed widely. linkAuth
|
|
14
|
-
* needs different syntax and a closed transform set; the two coexist by
|
|
15
|
-
* namespace (`link-auth/template.ts`).
|
|
16
|
-
*/
|
|
17
|
-
import { applyTransform } from './transforms.js';
|
|
18
|
-
const IDENTIFIER = /^[a-zA-Z_]\w*$/;
|
|
19
|
-
const TRANSFORM_CALL = /^(?<fn>[a-zA-Z_]\w*)\((?<arg>[a-zA-Z_]\w*)\)$/;
|
|
20
|
-
/**
|
|
21
|
-
* Thrown when a template references a variable not present in the context.
|
|
22
|
-
* Message names the missing variable and includes the full template for
|
|
23
|
-
* caller-side debugging.
|
|
24
|
-
*/
|
|
25
|
-
export class TemplateMissingVarError extends Error {
|
|
26
|
-
constructor(varName, template) {
|
|
27
|
-
super(`Template variable "${varName}" not in context. Template: ${template}`);
|
|
28
|
-
this.name = 'TemplateMissingVarError';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Thrown when a template contains syntactically invalid content inside `${...}`
|
|
33
|
-
* (empty expression, whitespace, unrecognized form) or an unterminated `${`.
|
|
34
|
-
*/
|
|
35
|
-
export class TemplateSyntaxError extends Error {
|
|
36
|
-
constructor(detail, template) {
|
|
37
|
-
super(`Invalid template syntax — ${detail}. Template: ${template}`);
|
|
38
|
-
this.name = 'TemplateSyntaxError';
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Render a template by substituting `${...}` expressions from a context map.
|
|
43
|
-
*
|
|
44
|
-
* @throws {TemplateMissingVarError} if a referenced variable is absent
|
|
45
|
-
* @throws {TemplateSyntaxError} for invalid expressions or unterminated `${`
|
|
46
|
-
* @throws {UnknownTransformError} from a `${transform(name)}` call
|
|
47
|
-
*/
|
|
48
|
-
export function renderTemplate(template, context) {
|
|
49
|
-
const rendered = template.replaceAll(/\$\{([^}]*)\}/g, (_match, body) => resolveExpression(body, template, context));
|
|
50
|
-
if (rendered.includes('${')) {
|
|
51
|
-
throw new TemplateSyntaxError('unterminated "${" with no matching "}"', template);
|
|
52
|
-
}
|
|
53
|
-
return rendered;
|
|
54
|
-
}
|
|
55
|
-
function resolveExpression(body, template, context) {
|
|
56
|
-
if (body !== body.trim()) {
|
|
57
|
-
throw new TemplateSyntaxError(`whitespace in "${body}"`, template);
|
|
58
|
-
}
|
|
59
|
-
if (IDENTIFIER.test(body)) {
|
|
60
|
-
return lookupContextVar(context, body, template);
|
|
61
|
-
}
|
|
62
|
-
const callMatch = TRANSFORM_CALL.exec(body);
|
|
63
|
-
if (callMatch?.groups !== undefined) {
|
|
64
|
-
const { fn, arg } = callMatch.groups;
|
|
65
|
-
if (fn === undefined || arg === undefined) {
|
|
66
|
-
throw new TemplateSyntaxError(`unexpected regex result for "${body}"`, template);
|
|
67
|
-
}
|
|
68
|
-
return applyTransform(fn, lookupContextVar(context, arg, template));
|
|
69
|
-
}
|
|
70
|
-
throw new TemplateSyntaxError(`unrecognized expression "${body}"`, template);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Fetch a variable from the context map, blocking prototype-chain bypass.
|
|
74
|
-
*
|
|
75
|
-
* Without `Object.hasOwn`, `context["__proto__"]` would return `Object.prototype`
|
|
76
|
-
* (a non-undefined object) and the renderer would substitute `[object Object]`
|
|
77
|
-
* into the output. Mirrors the closed-allowlist discipline in `transforms.ts`.
|
|
78
|
-
*/
|
|
79
|
-
function lookupContextVar(context, key, template) {
|
|
80
|
-
if (!Object.hasOwn(context, key)) {
|
|
81
|
-
throw new TemplateMissingVarError(key, template);
|
|
82
|
-
}
|
|
83
|
-
const value = context[key];
|
|
84
|
-
if (value === undefined) {
|
|
85
|
-
throw new TemplateMissingVarError(key, template);
|
|
86
|
-
}
|
|
87
|
-
return value;
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/link-auth/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,UAAU,GAAG,gBAAgB,CAAC;AACpC,MAAM,cAAc,GAAG,+CAA+C,CAAC;AAEvE;;;;GAIG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,YAAY,OAAe,EAAE,QAAgB;QAC3C,KAAK,CAAC,sBAAsB,OAAO,+BAA+B,QAAQ,EAAE,CAAC,CAAC;QAC9E,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,MAAc,EAAE,QAAgB;QAC1C,KAAK,CAAC,6BAA6B,MAAM,eAAe,QAAQ,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,OAA+B;IAC9E,MAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE,CAC9E,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAC3C,CAAC;IAEF,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,mBAAmB,CAAC,wCAAwC,EAAE,QAAQ,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAY,EACZ,QAAgB,EAChB,OAA+B;IAE/B,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACzB,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,IAAI,GAAG,EAAE,QAAQ,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,SAAS,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC;QACrC,IAAI,EAAE,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YAC1C,MAAM,IAAI,mBAAmB,CAAC,gCAAgC,IAAI,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,cAAc,CAAC,EAAE,EAAE,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,IAAI,mBAAmB,CAAC,4BAA4B,IAAI,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CACvB,OAA+B,EAC/B,GAAW,EACX,QAAgB;IAEhB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,uBAAuB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,uBAAuB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform allowlist for linkAuth rewrite templates.
|
|
3
|
-
*
|
|
4
|
-
* Rewrite `to:` templates may call transforms over named regex captures —
|
|
5
|
-
* e.g. `${base64url(u)}` for Microsoft Graph share-ids. The allowed set is
|
|
6
|
-
* frozen in this file: adding a transform requires a VAT PR (see issue #113
|
|
7
|
-
* design §4.1). There is no arbitrary-evaluation path.
|
|
8
|
-
*
|
|
9
|
-
* v1 inputs are assumed to be ASCII URL host/path captures. Non-ASCII edge
|
|
10
|
-
* cases (lone surrogates) are pinned by tests so future regressions surface.
|
|
11
|
-
*/
|
|
12
|
-
declare const TRANSFORMS: {
|
|
13
|
-
readonly base64url: (s: string) => string;
|
|
14
|
-
readonly urlencode: (s: string) => string;
|
|
15
|
-
readonly lower: (s: string) => string;
|
|
16
|
-
};
|
|
17
|
-
export type TransformName = keyof typeof TRANSFORMS;
|
|
18
|
-
/**
|
|
19
|
-
* The closed allowlist of transform names. Callers parsing rewrite templates
|
|
20
|
-
* can validate transform calls (e.g. `${base64url(u)}`) against this list at
|
|
21
|
-
* config-load time, surfacing typos before any URL is rewritten.
|
|
22
|
-
*/
|
|
23
|
-
export declare const ALLOWED_TRANSFORMS: readonly TransformName[];
|
|
24
|
-
/**
|
|
25
|
-
* Thrown by `applyTransform` when called with a name not in the closed
|
|
26
|
-
* allowlist. The message names the bad transform and the full allowlist so
|
|
27
|
-
* a misconfigured macro surfaces a clear error at load time.
|
|
28
|
-
*/
|
|
29
|
-
export declare class UnknownTransformError extends Error {
|
|
30
|
-
constructor(name: string);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Dispatch a transform by name on a string input.
|
|
34
|
-
*
|
|
35
|
-
* Security claim: only the names in `ALLOWED_TRANSFORMS` resolve; any other
|
|
36
|
-
* input throws `UnknownTransformError`. Lookup uses `Object.hasOwn` to block
|
|
37
|
-
* prototype-chain keys (`toString`, `__proto__`, `constructor`, …) that a
|
|
38
|
-
* `name in TRANSFORMS` check would let through.
|
|
39
|
-
*
|
|
40
|
-
* @throws {UnknownTransformError} if `name` is not in the allowlist
|
|
41
|
-
* @throws {URIError} from `urlencode` on lone-surrogate inputs — deliberate;
|
|
42
|
-
* v1 callers pass URL-derived captures that cannot legally contain these
|
|
43
|
-
*/
|
|
44
|
-
export declare function applyTransform(name: string, input: string): string;
|
|
45
|
-
export {};
|
|
46
|
-
//# sourceMappingURL=transforms.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/link-auth/transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,QAAA,MAAM,UAAU;4BACC,MAAM;4BACN,MAAM;wBACV,MAAM;CAC6B,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,UAAU,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,aAAa,EAEtD,CAAC;AAEF;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,IAAI,EAAE,MAAM;CAIzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlE"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform allowlist for linkAuth rewrite templates.
|
|
3
|
-
*
|
|
4
|
-
* Rewrite `to:` templates may call transforms over named regex captures —
|
|
5
|
-
* e.g. `${base64url(u)}` for Microsoft Graph share-ids. The allowed set is
|
|
6
|
-
* frozen in this file: adding a transform requires a VAT PR (see issue #113
|
|
7
|
-
* design §4.1). There is no arbitrary-evaluation path.
|
|
8
|
-
*
|
|
9
|
-
* v1 inputs are assumed to be ASCII URL host/path captures. Non-ASCII edge
|
|
10
|
-
* cases (lone surrogates) are pinned by tests so future regressions surface.
|
|
11
|
-
*/
|
|
12
|
-
const TRANSFORMS = {
|
|
13
|
-
base64url: (s) => Buffer.from(s, 'utf8').toString('base64url'),
|
|
14
|
-
urlencode: (s) => encodeURIComponent(s),
|
|
15
|
-
lower: (s) => s.toLowerCase(),
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* The closed allowlist of transform names. Callers parsing rewrite templates
|
|
19
|
-
* can validate transform calls (e.g. `${base64url(u)}`) against this list at
|
|
20
|
-
* config-load time, surfacing typos before any URL is rewritten.
|
|
21
|
-
*/
|
|
22
|
-
export const ALLOWED_TRANSFORMS = Object.freeze(Object.keys(TRANSFORMS));
|
|
23
|
-
/**
|
|
24
|
-
* Thrown by `applyTransform` when called with a name not in the closed
|
|
25
|
-
* allowlist. The message names the bad transform and the full allowlist so
|
|
26
|
-
* a misconfigured macro surfaces a clear error at load time.
|
|
27
|
-
*/
|
|
28
|
-
export class UnknownTransformError extends Error {
|
|
29
|
-
constructor(name) {
|
|
30
|
-
super(`Unknown transform "${name}". Allowed: ${ALLOWED_TRANSFORMS.join(', ')}.`);
|
|
31
|
-
this.name = 'UnknownTransformError';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Dispatch a transform by name on a string input.
|
|
36
|
-
*
|
|
37
|
-
* Security claim: only the names in `ALLOWED_TRANSFORMS` resolve; any other
|
|
38
|
-
* input throws `UnknownTransformError`. Lookup uses `Object.hasOwn` to block
|
|
39
|
-
* prototype-chain keys (`toString`, `__proto__`, `constructor`, …) that a
|
|
40
|
-
* `name in TRANSFORMS` check would let through.
|
|
41
|
-
*
|
|
42
|
-
* @throws {UnknownTransformError} if `name` is not in the allowlist
|
|
43
|
-
* @throws {URIError} from `urlencode` on lone-surrogate inputs — deliberate;
|
|
44
|
-
* v1 callers pass URL-derived captures that cannot legally contain these
|
|
45
|
-
*/
|
|
46
|
-
export function applyTransform(name, input) {
|
|
47
|
-
if (!Object.hasOwn(TRANSFORMS, name)) {
|
|
48
|
-
throw new UnknownTransformError(name);
|
|
49
|
-
}
|
|
50
|
-
return TRANSFORMS[name](input);
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=transforms.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transforms.js","sourceRoot":"","sources":["../../src/link-auth/transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,MAAM,UAAU,GAAG;IACjB,SAAS,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;IACtE,SAAS,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;CACS,CAAC;AAIjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA6B,MAAM,CAAC,MAAM,CACvE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAoB,CAC3C,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,IAAY;QACtB,KAAK,CAAC,sBAAsB,IAAI,eAAe,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAa;IACxD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,UAAU,CAAC,IAAqB,CAAC,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/template-entry.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @vibe-agent-toolkit/utils/template
|
|
3
|
-
*
|
|
4
|
-
* Cached Handlebars rendering with HTML escaping disabled. Pure with respect
|
|
5
|
-
* to Node builtins, but it pulls in `handlebars` (and transitively
|
|
6
|
-
* `source-map`) — roughly 239KB bundled. Quarantined behind its own subpath
|
|
7
|
-
* so importing a path helper never pays for it.
|
|
8
|
-
*/
|
|
9
|
-
export * from './template.js';
|
|
10
|
-
//# sourceMappingURL=template-entry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template-entry.d.ts","sourceRoot":"","sources":["../src/template-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC"}
|
package/dist/template-entry.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @vibe-agent-toolkit/utils/template
|
|
3
|
-
*
|
|
4
|
-
* Cached Handlebars rendering with HTML escaping disabled. Pure with respect
|
|
5
|
-
* to Node builtins, but it pulls in `handlebars` (and transitively
|
|
6
|
-
* `source-map`) — roughly 239KB bundled. Quarantined behind its own subpath
|
|
7
|
-
* so importing a path helper never pays for it.
|
|
8
|
-
*/
|
|
9
|
-
export * from './template.js';
|
|
10
|
-
//# sourceMappingURL=template-entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template-entry.js","sourceRoot":"","sources":["../src/template-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC"}
|
package/dist/template.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render a Handlebars template with the given context.
|
|
3
|
-
* Uses noEscape since this is for markdown content, not HTML.
|
|
4
|
-
* Compiled templates are cached by template string.
|
|
5
|
-
*/
|
|
6
|
-
export declare function renderTemplate(template: string, context: Record<string, unknown>): string;
|
|
7
|
-
//# sourceMappingURL=template.d.ts.map
|
package/dist/template.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CASzF"}
|
package/dist/template.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import Handlebars from 'handlebars';
|
|
2
|
-
const templateCache = new Map();
|
|
3
|
-
/**
|
|
4
|
-
* Render a Handlebars template with the given context.
|
|
5
|
-
* Uses noEscape since this is for markdown content, not HTML.
|
|
6
|
-
* Compiled templates are cached by template string.
|
|
7
|
-
*/
|
|
8
|
-
export function renderTemplate(template, context) {
|
|
9
|
-
let compiled = templateCache.get(template);
|
|
10
|
-
if (!compiled) {
|
|
11
|
-
// Safe: templates render markdown/plaintext, not HTML. No XSS risk.
|
|
12
|
-
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
|
13
|
-
compiled = Handlebars.compile(template, { noEscape: true });
|
|
14
|
-
templateCache.set(template, compiled);
|
|
15
|
-
}
|
|
16
|
-
return compiled(context);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=template.js.map
|
package/dist/template.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAsC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,OAAgC;IAC/E,IAAI,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,oEAAoE;QACpE,0DAA0D;QAC1D,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
|