@dunx/transform 3.2.1 → 3.3.1
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/edits.ts
|
|
3
|
-
var
|
|
3
|
+
var applyEdits2 = (source, edits) => {
|
|
4
4
|
const sorted = [...edits].sort((left, right) => left.start - right.start || left.end - right.end);
|
|
5
5
|
let out = "";
|
|
6
6
|
let cursor = 0;
|
|
@@ -133,7 +133,7 @@ var entryFor = (source, param, erased) => {
|
|
|
133
133
|
return slice(source, annotation.typeName);
|
|
134
134
|
return cause === "import-type" ? `{ unresolved: ${text}${optional}, typeOnly: ${JSON.stringify(root)} }` : unresolved;
|
|
135
135
|
};
|
|
136
|
-
var
|
|
136
|
+
var transform2 = (source, filename = "input.ts") => {
|
|
137
137
|
const parsed = parseSync(filename, source);
|
|
138
138
|
if (parsed.errors.length > 0) {
|
|
139
139
|
const detail = parsed.errors.slice(0, 3).map((error) => error.message).join("; ");
|
|
@@ -161,7 +161,7 @@ var transform = (source, filename = "input.ts") => {
|
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
const code =
|
|
164
|
+
const code = applyEdits2(source, edits);
|
|
165
165
|
return { code, changed: code !== source, annotated };
|
|
166
166
|
};
|
|
167
167
|
|
|
@@ -170,7 +170,7 @@ var read = async (path) => {
|
|
|
170
170
|
const module = await import(`${path}?`, { with: { type: "text" } });
|
|
171
171
|
return module.default;
|
|
172
172
|
};
|
|
173
|
-
var
|
|
173
|
+
var depsPlugin2 = {
|
|
174
174
|
name: "dunx-deps",
|
|
175
175
|
setup(build) {
|
|
176
176
|
build.onLoad({ filter: /\.tsx?$/ }, async ({ path }) => {
|
|
@@ -180,9 +180,9 @@ var depsPlugin = {
|
|
|
180
180
|
return { contents: source, loader };
|
|
181
181
|
if (!source.includes("class"))
|
|
182
182
|
return { contents: source, loader };
|
|
183
|
-
return { contents:
|
|
183
|
+
return { contents: transform2(source, path).code, loader };
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
export {
|
|
188
|
+
export { applyEdits2, transform2, depsPlugin2 };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
applyEdits2,
|
|
4
|
+
transform2,
|
|
5
|
+
depsPlugin2
|
|
6
|
+
} from "./chunk-x4mcmdwj.js";
|
|
7
7
|
export {
|
|
8
|
-
applyEdits,
|
|
9
|
-
depsPlugin,
|
|
10
|
-
transform
|
|
8
|
+
applyEdits2 as applyEdits,
|
|
9
|
+
depsPlugin2 as depsPlugin,
|
|
10
|
+
transform2 as transform
|
|
11
11
|
};
|
package/dist/preload.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dunx/transform",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Load-time transform that records constructor dependencies for the dunx container",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"oxc-parser": "0.142.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@types/bun": ">=1.
|
|
55
|
+
"@types/bun": ">=1.4.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@types/bun": {
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
|
-
"bun": ">=1.4.
|
|
63
|
+
"bun": ">=1.4.1"
|
|
64
64
|
}
|
|
65
65
|
}
|