@dunx/transform 2.4.0 → 3.0.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/ast.d.ts CHANGED
@@ -47,16 +47,30 @@ export interface ImportDeclaration extends Node {
47
47
  readonly specifiers: readonly Node[];
48
48
  readonly importKind: 'value' | 'type';
49
49
  }
50
+ /**
51
+ * `ImportSpecifier`, `ImportDefaultSpecifier` and `ImportNamespaceSpecifier`.
52
+ * Only the first carries its own `importKind`; all three carry `local`, which is
53
+ * the name the file binds and the only field the erasure map needs.
54
+ */
50
55
  export interface ImportSpecifier extends Node {
51
- readonly type: 'ImportSpecifier';
52
56
  readonly local: Identifier;
53
- readonly importKind: 'value' | 'type';
57
+ readonly importKind?: 'value' | 'type';
58
+ }
59
+ export interface TSQualifiedName extends Node {
60
+ readonly type: 'TSQualifiedName';
61
+ readonly left: Node;
62
+ readonly right: Identifier;
63
+ }
64
+ export interface AssignmentPattern extends Node {
65
+ readonly type: 'AssignmentPattern';
66
+ readonly left: Node;
54
67
  }
55
68
  export declare const isIdentifier: (node: Node | null | undefined) => node is Identifier;
56
69
  export declare const isMethodDefinition: (node: Node | null | undefined) => node is MethodDefinition;
57
70
  export declare const isTypeReference: (node: Node | null | undefined) => node is TSTypeReference;
58
71
  export declare const isImportDeclaration: (node: Node | null | undefined) => node is ImportDeclaration;
59
- export declare const isImportSpecifier: (node: Node | null | undefined) => node is ImportSpecifier;
72
+ export declare const isQualifiedName: (node: Node | null | undefined) => node is TSQualifiedName;
73
+ export declare const isAssignmentPattern: (node: Node | null | undefined) => node is AssignmentPattern;
60
74
  export declare const isParameterProperty: (node: Node | null | undefined) => node is TSParameterProperty;
61
75
  /**
62
76
  * Declarations only. A `ClassExpression`'s own name is bound inside the class
@@ -71,3 +85,8 @@ export declare const isClassDeclaration: (node: Node) => node is ClassNode;
71
85
  */
72
86
  export declare const walk: (root: unknown, visit: (node: Node) => void) => void;
73
87
  export declare const nameOf: (node: Node | null | undefined) => string | undefined;
88
+ /**
89
+ * The leftmost identifier of a type name. In `a.b.C` only `a` has to exist at
90
+ * runtime, so it is the only part the erasure map can answer for.
91
+ */
92
+ export declare const rootOfTypeName: (node: Node) => Node;
@@ -23,7 +23,8 @@ var isIdentifier = guard("Identifier");
23
23
  var isMethodDefinition = guard("MethodDefinition");
24
24
  var isTypeReference = guard("TSTypeReference");
25
25
  var isImportDeclaration = guard("ImportDeclaration");
26
- var isImportSpecifier = guard("ImportSpecifier");
26
+ var isQualifiedName = guard("TSQualifiedName");
27
+ var isAssignmentPattern = guard("AssignmentPattern");
27
28
  var isParameterProperty = guard("TSParameterProperty");
28
29
  var isClassDeclaration = (node) => node.type === "ClassDeclaration";
29
30
  var walk = (root, visit) => {
@@ -42,18 +43,33 @@ var walk = (root, visit) => {
42
43
  walk(child, visit);
43
44
  };
44
45
  var nameOf = (node) => isIdentifier(node) ? node.name : undefined;
46
+ var rootOfTypeName = (node) => isQualifiedName(node) ? rootOfTypeName(node.left) : node;
45
47
 
46
48
  // src/erased.ts
49
+ var mergedClassNames = (program) => {
50
+ const body = program.body ?? [];
51
+ const names = new Set;
52
+ for (const statement of body) {
53
+ const declaration = statement.declaration ?? statement;
54
+ if (!isClassDeclaration(declaration))
55
+ continue;
56
+ const name = declaration.id?.name;
57
+ if (name !== undefined)
58
+ names.add(name);
59
+ }
60
+ return names;
61
+ };
47
62
  var collectTypeOnlyNames = (program) => {
48
63
  const names = new Map;
49
64
  walk(program, (node) => {
50
65
  if (isImportDeclaration(node)) {
51
66
  for (const specifier of node.specifiers) {
52
- if (!isImportSpecifier(specifier))
67
+ const { local, importKind } = specifier;
68
+ if (node.importKind !== "type" && importKind !== "type")
53
69
  continue;
54
- if (node.importKind === "type" || specifier.importKind === "type") {
55
- names.set(specifier.local.name, "import-type");
56
- }
70
+ const name = nameOf(local);
71
+ if (name !== undefined)
72
+ names.set(name, "import-type");
57
73
  }
58
74
  return;
59
75
  }
@@ -64,6 +80,8 @@ var collectTypeOnlyNames = (program) => {
64
80
  names.set(name, "declared-type");
65
81
  }
66
82
  });
83
+ for (const name of mergedClassNames(program))
84
+ names.delete(name);
67
85
  return names;
68
86
  };
69
87
  var collectTypeParameters = (klass) => {
@@ -91,23 +109,29 @@ var constructorParams = (klass) => {
91
109
  const found = klass.body.body.find((member) => isMethodDefinition(member) && nameOf(member.key) === "constructor");
92
110
  return isMethodDefinition(found) ? found.value.params : [];
93
111
  };
112
+ var bindingOf = (param) => {
113
+ const named = isParameterProperty(param) ? param.parameter : param;
114
+ return isAssignmentPattern(named) ? named.left : named;
115
+ };
94
116
  var annotationOf = (param) => {
95
- const inner = isParameterProperty(param) ? param.parameter : param;
117
+ const inner = bindingOf(param);
96
118
  if (!isIdentifier(inner))
97
119
  return;
98
120
  return inner.typeAnnotation?.typeAnnotation;
99
121
  };
122
+ var hasDefault = (param) => isAssignmentPattern(isParameterProperty(param) ? param.parameter : param);
100
123
  var entryFor = (source, param, erased) => {
101
124
  const text = JSON.stringify(slice(source, param));
102
- const unresolved = `{ unresolved: ${text} }`;
125
+ const optional = hasDefault(param) ? ", optional: true" : "";
126
+ const unresolved = `{ unresolved: ${text}${optional} }`;
103
127
  const annotation = annotationOf(param);
104
128
  if (!annotation || !isTypeReference(annotation))
105
129
  return unresolved;
106
- const token = slice(source, annotation.typeName);
107
- const cause = erased.get(token);
130
+ const root = nameOf(rootOfTypeName(annotation.typeName));
131
+ const cause = root === undefined ? undefined : erased.get(root);
108
132
  if (cause === undefined)
109
- return token;
110
- return cause === "import-type" ? `{ unresolved: ${text}, typeOnly: ${JSON.stringify(token)} }` : unresolved;
133
+ return slice(source, annotation.typeName);
134
+ return cause === "import-type" ? `{ unresolved: ${text}${optional}, typeOnly: ${JSON.stringify(root)} }` : unresolved;
111
135
  };
112
136
  var transform = (source, filename = "input.ts") => {
113
137
  const parsed = parseSync(filename, source);
@@ -133,10 +157,7 @@ var transform = (source, filename = "input.ts") => {
133
157
  edits.push({
134
158
  start: node.end,
135
159
  end: node.end,
136
- text: `
137
- Object.defineProperty(${name}, ${DEPS_KEY}, {
138
- ` + ` value: () => [${entries.join(", ")}],
139
- });`
160
+ text: `;Object.defineProperty(${name}, ${DEPS_KEY}, ` + `{ value: () => [${entries.join(", ")}] });`
140
161
  });
141
162
  }
142
163
  });
@@ -165,6 +186,3 @@ var depsPlugin = {
165
186
  };
166
187
 
167
188
  export { applyEdits, transform, depsPlugin };
168
-
169
- //# debugId=DAAF98240D22D75F64756E2164756E21
170
- //# sourceMappingURL=chunk-41at0m5d.js.map
package/dist/edits.d.ts CHANGED
@@ -5,7 +5,8 @@ export interface Edit {
5
5
  }
6
6
  /**
7
7
  * Splices edits into the original text rather than reprinting the AST, so
8
- * everything untouched keeps its exact bytes - comments, formatting, and the
9
- * line numbers stack traces point at.
8
+ * everything untouched keeps its exact bytes. Line numbers survive too, but only
9
+ * because every edit this transform makes is a single line appended to one that
10
+ * already exists - splicing alone does not guarantee it.
10
11
  */
11
12
  export declare const applyEdits: (source: string, edits: readonly Edit[]) => string;
package/dist/index.js CHANGED
@@ -3,12 +3,9 @@ import {
3
3
  applyEdits,
4
4
  depsPlugin,
5
5
  transform
6
- } from "./chunk-41at0m5d.js";
6
+ } from "./chunk-cfmpj4s2.js";
7
7
  export {
8
8
  applyEdits,
9
9
  depsPlugin,
10
10
  transform
11
11
  };
12
-
13
- //# debugId=65A4CA6728FEECA064756E2164756E21
14
- //# sourceMappingURL=index.js.map
package/dist/preload.js CHANGED
@@ -1,11 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  depsPlugin
4
- } from "./chunk-41at0m5d.js";
4
+ } from "./chunk-cfmpj4s2.js";
5
5
 
6
6
  // src/preload.ts
7
7
  var {plugin } = globalThis.Bun;
8
8
  await plugin(depsPlugin);
9
-
10
- //# debugId=3E4DE15278F056A464756E2164756E21
11
- //# sourceMappingURL=preload.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dunx/transform",
3
- "version": "2.4.0",
3
+ "version": "3.0.0",
4
4
  "description": "Load-time transform that records constructor dependencies for the dunx container",
5
5
  "keywords": [
6
6
  "bun",
@@ -60,6 +60,6 @@
60
60
  }
61
61
  },
62
62
  "engines": {
63
- "bun": ">=1.3.0"
63
+ "bun": ">=1.4.0"
64
64
  }
65
65
  }
@@ -1,14 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/edits.ts", "../src/deps.ts", "../src/ast.ts", "../src/erased.ts", "../src/plugin.ts"],
4
- "sourcesContent": [
5
- "export interface Edit {\n readonly start: number;\n readonly end: number;\n readonly text: string;\n}\n\n/**\n * Splices edits into the original text rather than reprinting the AST, so\n * everything untouched keeps its exact bytes - comments, formatting, and the\n * line numbers stack traces point at.\n */\nexport const applyEdits = (source: string, edits: readonly Edit[]): string => {\n const sorted = [...edits].sort(\n (left, right) => left.start - right.start || left.end - right.end,\n );\n\n let out = '';\n let cursor = 0;\n\n for (const edit of sorted) {\n if (edit.start < cursor) {\n throw new Error(\n `Overlapping edit at ${edit.start}..${edit.end}; the previous edit ended ` +\n `at ${cursor}.`,\n );\n }\n out += source.slice(cursor, edit.start) + edit.text;\n cursor = edit.end;\n }\n\n return out + source.slice(cursor);\n};\n",
6
- "import { parseSync } from 'oxc-parser';\nimport {\n isClassDeclaration,\n isIdentifier,\n isMethodDefinition,\n isParameterProperty,\n isTypeReference,\n nameOf,\n walk,\n type ClassNode,\n type Node,\n} from './ast.js';\nimport { applyEdits, type Edit } from './edits.js';\nimport {\n collectTypeOnlyNames,\n erasedNames,\n type ErasureCause,\n} from './erased.js';\n\n/**\n * `Symbol.for`, not `Symbol`: two copies of `@dunx/core` in one dependency tree\n * still agree on the key. Same technique as module and route markers.\n */\nconst DEPS_KEY = \"Symbol.for('dunx.deps')\";\n\nexport interface TransformResult {\n readonly code: string;\n readonly changed: boolean;\n /** Classes that received dependency metadata, in source order. */\n readonly annotated: readonly string[];\n}\n\nconst slice = (source: string, node: Node): string =>\n source.slice(node.start, node.end);\n\nconst constructorParams = (klass: ClassNode): readonly Node[] => {\n const found = klass.body.body.find(\n (member) =>\n isMethodDefinition(member) && nameOf(member.key) === 'constructor',\n );\n return isMethodDefinition(found) ? found.value.params : [];\n};\n\n/** The declared type of a parameter, unwrapping `private readonly x: X`. */\nconst annotationOf = (param: Node): Node | undefined => {\n const inner = isParameterProperty(param) ? param.parameter : param;\n if (!isIdentifier(inner)) return undefined;\n return inner.typeAnnotation?.typeAnnotation;\n};\n\n/**\n * One entry per constructor parameter. A parameter whose type names something\n * that exists at runtime becomes that expression; anything else becomes an\n * `unresolved` descriptor so the container can name it precisely at boot instead\n * of constructing a broken object.\n */\nconst entryFor = (\n source: string,\n param: Node,\n erased: ReadonlyMap<string, ErasureCause>,\n): string => {\n const text = JSON.stringify(slice(source, param));\n const unresolved = `{ unresolved: ${text} }`;\n const annotation = annotationOf(param);\n\n if (!annotation || !isTypeReference(annotation)) return unresolved;\n\n const token = slice(source, annotation.typeName);\n // A qualified name (`ns.Thing`) is a runtime value; a bare erased name is not.\n const cause = erased.get(token);\n if (cause === undefined) return token;\n\n // The annotation reads the same whether the name was imported with\n // `import type` or declared as an interface, so the one case with a one-line\n // fix carries the identifier for the boot error to name.\n return cause === 'import-type'\n ? `{ unresolved: ${text}, typeOnly: ${JSON.stringify(token)} }`\n : unresolved;\n};\n\n/**\n * Records each class's constructor dependencies, and each decorated field's\n * declared type, as thunks on the class itself.\n *\n * A thunk, not a literal: the body is evaluated when the record is read rather\n * than when the module is defined, so a dependency declared later in the file -\n * or in a circular import - is not a temporal-dead-zone crash. That is what\n * removes the need for a `forwardRef` escape hatch, and it is also why a class decorator\n * cannot read the field record while it runs: the statement is appended after the\n * class, which is after decoration.\n */\nexport const transform = (\n source: string,\n filename = 'input.ts',\n): TransformResult => {\n const parsed = parseSync(filename, source);\n\n if (parsed.errors.length > 0) {\n const detail = parsed.errors\n .slice(0, 3)\n .map((error) => error.message)\n .join('; ');\n throw new Error(`${filename}: could not parse - ${detail}`);\n }\n\n const program = parsed.program;\n const typeOnly = collectTypeOnlyNames(program);\n const edits: Edit[] = [];\n const annotated: string[] = [];\n\n walk(program, (node) => {\n if (!isClassDeclaration(node)) return;\n\n const name = node.id?.name;\n if (name === undefined) return;\n\n const erased = erasedNames(typeOnly, node);\n const params = constructorParams(node);\n\n if (params.length > 0) {\n const entries = params.map((param) => entryFor(source, param, erased));\n annotated.push(name);\n edits.push({\n start: node.end,\n end: node.end,\n text:\n `\\nObject.defineProperty(${name}, ${DEPS_KEY}, {\\n` +\n ` value: () => [${entries.join(', ')}],\\n});`,\n });\n }\n });\n\n const code = applyEdits(source, edits);\n return { code, changed: code !== source, annotated };\n};\n",
7
- "/**\n * Minimal structural views over oxc's ESTree output - only the node shapes the\n * dependency transform reads. Verified against real `oxc-parser` output.\n */\nexport interface Node {\n readonly type: string;\n readonly start: number;\n readonly end: number;\n}\n\nexport interface Identifier extends Node {\n readonly type: 'Identifier';\n readonly name: string;\n readonly typeAnnotation?: TSTypeAnnotation | null;\n}\n\nexport interface ClassBody extends Node {\n readonly type: 'ClassBody';\n readonly body: readonly Node[];\n}\n\n/** `ClassDeclaration` and `ClassExpression` share every field read here. */\nexport interface ClassNode extends Node {\n readonly id: Identifier | null;\n readonly typeParameters: Node | null;\n readonly body: ClassBody;\n}\n\nexport interface FunctionExpression extends Node {\n readonly params: readonly Node[];\n}\n\nexport interface MethodDefinition extends Node {\n readonly type: 'MethodDefinition';\n readonly key: Node;\n readonly value: FunctionExpression;\n}\n\nexport interface TSParameterProperty extends Node {\n readonly type: 'TSParameterProperty';\n readonly parameter: Node;\n}\n\nexport interface TSTypeAnnotation extends Node {\n readonly type: 'TSTypeAnnotation';\n readonly typeAnnotation: Node;\n}\n\nexport interface TSTypeReference extends Node {\n readonly type: 'TSTypeReference';\n readonly typeName: Node;\n}\n\nexport interface ImportDeclaration extends Node {\n readonly type: 'ImportDeclaration';\n readonly specifiers: readonly Node[];\n readonly importKind: 'value' | 'type';\n}\n\nexport interface ImportSpecifier extends Node {\n readonly type: 'ImportSpecifier';\n readonly local: Identifier;\n readonly importKind: 'value' | 'type';\n}\n\nconst guard =\n <T extends Node>(type: T['type']) =>\n (node: Node | null | undefined): node is T =>\n node?.type === type;\n\nexport const isIdentifier = guard<Identifier>('Identifier');\nexport const isMethodDefinition = guard<MethodDefinition>('MethodDefinition');\nexport const isTypeReference = guard<TSTypeReference>('TSTypeReference');\nexport const isImportDeclaration =\n guard<ImportDeclaration>('ImportDeclaration');\nexport const isImportSpecifier = guard<ImportSpecifier>('ImportSpecifier');\nexport const isParameterProperty = guard<TSParameterProperty>(\n 'TSParameterProperty',\n);\n\n/**\n * Declarations only. A `ClassExpression`'s own name is bound inside the class\n * body, not outside it, so a statement appended after `const X = class Foo {}`\n * could not reference `Foo` - it would be a ReferenceError at load.\n */\nexport const isClassDeclaration = (node: Node): node is ClassNode =>\n node.type === 'ClassDeclaration';\n\n/**\n * Depth-first over every object in the tree. oxc's ESTree output is a plain\n * object graph with no parent links, so recursing every own value is safe and\n * needs no visitor-key table.\n */\nexport const walk = (root: unknown, visit: (node: Node) => void): void => {\n if (Array.isArray(root)) {\n for (const child of root) walk(child, visit);\n return;\n }\n if (root === null || typeof root !== 'object') return;\n\n const candidate = root as Partial<Node>;\n if (\n typeof candidate.type === 'string' &&\n typeof candidate.start === 'number' &&\n typeof candidate.end === 'number'\n ) {\n visit(root as Node);\n }\n\n for (const child of Object.values(root)) walk(child, visit);\n};\n\nexport const nameOf = (node: Node | null | undefined): string | undefined =>\n isIdentifier(node) ? node.name : undefined;\n",
8
- "import {\n isImportDeclaration,\n isImportSpecifier,\n nameOf,\n walk,\n type ClassNode,\n type Node,\n} from './ast.js';\n\n/**\n * Why a name cannot be used in a value position. Kept apart because only one of\n * these has a one-line fix: an `import type` becomes a value import, whereas an\n * interface has no runtime counterpart to import at all. The boot error quotes\n * the annotation, which reads identically either way, so without this the\n * message points at a line that is already correct.\n */\nexport type ErasureCause = 'import-type' | 'declared-type';\n\n/**\n * Names that exist only in the type system, so emitting them in a value position\n * would be a `ReferenceError` at runtime. Collected per file: type-only imports,\n * inline `type` specifiers, local interfaces and type aliases.\n */\nexport const collectTypeOnlyNames = (\n program: Node,\n): ReadonlyMap<string, ErasureCause> => {\n const names = new Map<string, ErasureCause>();\n\n walk(program, (node) => {\n if (isImportDeclaration(node)) {\n for (const specifier of node.specifiers) {\n if (!isImportSpecifier(specifier)) continue;\n if (node.importKind === 'type' || specifier.importKind === 'type') {\n names.set(specifier.local.name, 'import-type');\n }\n }\n return;\n }\n\n if (\n node.type === 'TSInterfaceDeclaration' ||\n node.type === 'TSTypeAliasDeclaration'\n ) {\n const declared = (node as { id?: Node }).id;\n const name = nameOf(declared);\n if (name !== undefined) names.set(name, 'declared-type');\n }\n });\n\n return names;\n};\n\n/** A class's own type parameters are erased, so `T` is never a usable token. */\nexport const collectTypeParameters = (\n klass: ClassNode,\n): ReadonlySet<string> => {\n const names = new Set<string>();\n if (klass.typeParameters === null) return names;\n\n walk(klass.typeParameters, (node) => {\n if (node.type !== 'TSTypeParameter') return;\n const name = nameOf((node as { name?: Node }).name);\n if (name !== undefined) names.add(name);\n });\n\n return names;\n};\n\n/** Every name in this file that a value position cannot use. */\nexport const erasedNames = (\n typeOnly: ReadonlyMap<string, ErasureCause>,\n klass: ClassNode,\n): ReadonlyMap<string, ErasureCause> =>\n new Map<string, ErasureCause>([\n ...typeOnly,\n // A type parameter is erased for the same reason an interface is: there is\n // nothing to import.\n ...[...collectTypeParameters(klass)].map(\n (name) => [name, 'declared-type'] as const,\n ),\n ]);\n",
9
- "import type { BunPlugin } from 'bun';\nimport { transform } from './deps.js';\n\n/**\n * The source, read **through Bun's own loader** rather than with `Bun.file`.\n *\n * This is what keeps `bun --watch` and `bun --hot` working. A file that a runtime\n * `onLoad` reads behind Bun's back never enters the module graph, so it is never\n * watched: with `Bun.file` here, editing any imported file did nothing and only the\n * entrypoint still restarted. Measured both ways, and the transform was never the\n * cause - a plugin handing the source back byte for byte broke it identically.\n *\n * The three obvious repairs are all unavailable: `onLoad` may not decline (returning\n * `undefined` is a `TypeError`), `watchFiles` on the result is accepted and ignored,\n * and `filter` is a path regex so it cannot skip files whose contents decide.\n * Reading through `import` is the one that works, and it comes from\n * https://github.com/oven-sh/bun/issues/4689.\n *\n * The `?` matters: without it the specifier ends in `.ts` and re-enters this very\n * plugin. With it, the filter does not match and Bun loads the bytes itself.\n *\n * Everything in docs/bun-apis.md, \"A runtime `onLoad` plugin drops the file it\n * loads from `--watch`\".\n */\nconst read = async (path: string): Promise<string> => {\n const module = (await import(`${path}?`, { with: { type: 'text' } })) as {\n default: string;\n };\n return module.default;\n};\n\n/**\n * Rewrites TypeScript as it is loaded so the container can read constructor\n * dependencies. Usable in three places, all the same object:\n *\n * - `bunfig.toml` -> `preload = [\"@dunx/transform/preload\"]` for `bun run`\n * - `Bun.build({ plugins: [depsPlugin] })` for a production build\n * - `Bun.plugin(depsPlugin)` from a test preload\n *\n * Dependencies are skipped: a published package was already transformed by its\n * own build, and re-parsing `node_modules` on every load is pure cost.\n */\nexport const depsPlugin: BunPlugin = {\n name: 'dunx-deps',\n setup(build) {\n // A runtime plugin's onLoad must always return a result - there is no\n // \"decline and fall through\", so untransformed files are handed back as-is.\n build.onLoad({ filter: /\\.tsx?$/ }, async ({ path }) => {\n const source = await read(path);\n const loader = path.endsWith('.tsx') ? 'tsx' : 'ts';\n\n if (path.includes('/node_modules/')) return { contents: source, loader };\n\n /**\n * A file with no `class` substring cannot contain a class declaration, so\n * the transform cannot change it - and parsing it is the whole cost. The\n * check is a native string scan against an `oxc-parser` pass, which is why\n * it is worth doing before deciding.\n *\n * Sound rather than heuristic: the transform only ever appends a statement\n * after a class *declaration*, and `class Foo`, `export class Foo`,\n * `export default class`, `abstract class` all contain it. Verified across\n * every tracked file in this repo - 200 class-free files, none of which the\n * transform altered. A false positive (`className` in a `.tsx`, the word in\n * a comment) just falls through to the parse, which is the current\n * behaviour.\n *\n * Measured on `examples/full` plus core and http: 117 loaded files, 29 of\n * them class-free, 8.3 ms of 33.8 ms of parse time saved. The check itself\n * costs 0.03 ms across all 117.\n */\n if (!source.includes('class')) return { contents: source, loader };\n\n return { contents: transform(source, path).code, loader };\n });\n },\n};\n"
10
- ],
11
- "mappings": ";;AAWO,IAAM,aAAa,CAAC,QAAgB,UAAmC;AAAA,EAC5E,MAAM,SAAS,CAAC,GAAG,KAAK,EAAE,KACxB,CAAC,MAAM,UAAU,KAAK,QAAQ,MAAM,SAAS,KAAK,MAAM,MAAM,GAChE;AAAA,EAEA,IAAI,MAAM;AAAA,EACV,IAAI,SAAS;AAAA,EAEb,WAAW,QAAQ,QAAQ;AAAA,IACzB,IAAI,KAAK,QAAQ,QAAQ;AAAA,MACvB,MAAM,IAAI,MACR,uBAAuB,KAAK,UAAU,KAAK,kCACzC,MAAM,SACV;AAAA,IACF;AAAA,IACA,OAAO,OAAO,MAAM,QAAQ,KAAK,KAAK,IAAI,KAAK;AAAA,IAC/C,SAAS,KAAK;AAAA,EAChB;AAAA,EAEA,OAAO,MAAM,OAAO,MAAM,MAAM;AAAA;;;AC9BlC;;;ACiEA,IAAM,QACJ,CAAiB,SACjB,CAAC,SACC,MAAM,SAAS;AAEZ,IAAM,eAAe,MAAkB,YAAY;AACnD,IAAM,qBAAqB,MAAwB,kBAAkB;AACrE,IAAM,kBAAkB,MAAuB,iBAAiB;AAChE,IAAM,sBACX,MAAyB,mBAAmB;AACvC,IAAM,oBAAoB,MAAuB,iBAAiB;AAClE,IAAM,sBAAsB,MACjC,qBACF;AAOO,IAAM,qBAAqB,CAAC,SACjC,KAAK,SAAS;AAOT,IAAM,OAAO,CAAC,MAAe,UAAsC;AAAA,EACxE,IAAI,MAAM,QAAQ,IAAI,GAAG;AAAA,IACvB,WAAW,SAAS;AAAA,MAAM,KAAK,OAAO,KAAK;AAAA,IAC3C;AAAA,EACF;AAAA,EACA,IAAI,SAAS,QAAQ,OAAO,SAAS;AAAA,IAAU;AAAA,EAE/C,MAAM,YA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AAQ,UAAU,GAAG,SAAS,WAAW;AAAA,MACtD,MAAM,SAAS,MAAM,KAAK,IAAI;AAAA,MAC9B,MAAM,SAAS,KAAK,SAAS,MAAM,IAAI,QAAQ;AAAA,MAE/C,IAAI,KAAK,SAAS,gBAAgB;AAAA,QAAG,OAAO,EAAE,UAAU,QAAQ,OAAO;AAAA,MAoBvE,IAAI,CAAC,OAAO,SAAS,OAAO;AAAA,QAAG,OAAO,EAAE,UAAU,QAAQ,OAAO;AAAA,MAEjE,OAAO,EAAE,UAAU,UAAU,QAAQ,IAAI,EAAE,MAAM,OAAO;AAAA,KACzD;AAAA;AAEL;",
12
- "debugId": "DAAF98240D22D75F64756E2164756E21",
13
- "names": []
14
- }
package/dist/index.js.map DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [
5
- ],
6
- "mappings": "",
7
- "debugId": "65A4CA6728FEECA064756E2164756E21",
8
- "names": []
9
- }
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/preload.ts"],
4
- "sourcesContent": [
5
- "import { plugin } from 'bun';\nimport { depsPlugin } from './plugin.js';\n\n// Side-effect entrypoint for `bunfig.toml`:\n// preload = [\"@dunx/transform/preload\"]\n//\n// Awaited, not fire-and-forget: registration has to finish before the entrypoint\n// is loaded, or the first modules through would miss the transform.\nawait plugin(depsPlugin);\n"
6
- ],
7
- "mappings": ";;;;;;AAAA;AAQA,MAAM,OAAO,UAAU;",
8
- "debugId": "3E4DE15278F056A464756E2164756E21",
9
- "names": []
10
- }