rbxts-transformer-commit-migrations 1.3.0 → 1.4.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.
- package/index.d.ts +4 -4
- package/out/util/macro.js +4 -2
- package/package.json +1 -1
- package/out/test.js +0 -20
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type
|
|
1
|
+
export type Migration = [order: number, path: string[]] & { readonly __migrationKind: "migrate" };
|
|
2
|
+
export type TransformMigration = [order: number, path: string[]] & { readonly __migrationKind: "transform" };
|
|
3
3
|
|
|
4
|
-
export declare function $migrate(order: number | "__resolved"):
|
|
5
|
-
export declare function $transform(order: number | "__resolved"):
|
|
4
|
+
export declare function $migrate(order: number | "__resolved"): Migration;
|
|
5
|
+
export declare function $transform(order: number | "__resolved"): TransformMigration;
|
package/out/util/macro.js
CHANGED
|
@@ -19,8 +19,10 @@ export function replaceMacroCall(node, order, path) {
|
|
|
19
19
|
let changed = false;
|
|
20
20
|
for (const arg of node.arguments) {
|
|
21
21
|
if (ts.isCallExpression(arg) && ts.isIdentifier(arg.expression) && MACRO_REGEX.test(arg.expression.text)) {
|
|
22
|
-
newArgs.push(ts.factory.
|
|
23
|
-
|
|
22
|
+
newArgs.push(ts.factory.createArrayLiteralExpression([
|
|
23
|
+
ts.factory.createNumericLiteral(order),
|
|
24
|
+
ts.factory.createArrayLiteralExpression(path.map(p => ts.factory.createStringLiteral(p)), false),
|
|
25
|
+
], false));
|
|
24
26
|
changed = true;
|
|
25
27
|
}
|
|
26
28
|
else {
|
package/package.json
CHANGED
package/out/test.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { $migrate, $transform } from "../index.js";
|
|
2
|
-
function abc(test) {
|
|
3
|
-
// hello
|
|
4
|
-
}
|
|
5
|
-
function addMigration() {
|
|
6
|
-
return {
|
|
7
|
-
test: (order, fn) => undefined
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
abc({
|
|
11
|
-
hello: addMigration().test($migrate(0), () => {
|
|
12
|
-
// abvcdsc
|
|
13
|
-
}),
|
|
14
|
-
test: addMigration().test($migrate(1), () => {
|
|
15
|
-
// abvcdsc
|
|
16
|
-
}),
|
|
17
|
-
transform: addMigration().test($transform(2), () => {
|
|
18
|
-
// abvcdsc
|
|
19
|
-
}),
|
|
20
|
-
});
|