@vxrn/vite-flow 1.25.16 → 1.26.0-1788990885077
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/cjs/index.cjs +4 -1
- package/dist/cjs/index.native.js +4 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/transformFlowBabel.cjs +21 -25
- package/dist/cjs/transformFlowBabel.native.js +21 -26
- package/dist/cjs/transformFlowBabel.native.js.map +1 -1
- package/dist/esm/index.js +6 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +6 -4
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +6 -4
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/transformFlowBabel.mjs +21 -26
- package/dist/esm/transformFlowBabel.mjs.map +1 -1
- package/dist/esm/transformFlowBabel.native.js +21 -27
- package/dist/esm/transformFlowBabel.native.js.map +1 -1
- package/package.json +3 -5
- package/src/index.ts +3 -3
- package/src/transformFlowBabel.ts +30 -33
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/transformFlowBabel.d.ts +10 -1
- package/types/transformFlowBabel.d.ts.map +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
23
23
|
var index_exports = {};
|
|
24
24
|
__export(index_exports, {
|
|
25
25
|
default: () => createFlowPlugin,
|
|
26
|
+
transformFlow: () => import_transformFlowBabel2.transformFlow,
|
|
26
27
|
transformFlowBabel: () => import_transformFlowBabel2.transformFlowBabel
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -39,7 +40,9 @@ function createFlowPlugin(opts) {
|
|
|
39
40
|
enforce: "pre",
|
|
40
41
|
transform(code, id) {
|
|
41
42
|
if (filter(id)) {
|
|
42
|
-
return (0, import_transformFlowBabel.
|
|
43
|
+
return (0, import_transformFlowBabel.transformFlow)(code, {
|
|
44
|
+
path: id
|
|
45
|
+
});
|
|
43
46
|
}
|
|
44
47
|
return null;
|
|
45
48
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -25,6 +25,7 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
25
25
|
var index_exports = {};
|
|
26
26
|
__export(index_exports, {
|
|
27
27
|
default: () => createFlowPlugin,
|
|
28
|
+
transformFlow: () => import_transformFlowBabel2.transformFlow,
|
|
28
29
|
transformFlowBabel: () => import_transformFlowBabel2.transformFlowBabel
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -41,7 +42,9 @@ function createFlowPlugin(opts) {
|
|
|
41
42
|
enforce: "pre",
|
|
42
43
|
transform(code, id) {
|
|
43
44
|
if (filter(id)) {
|
|
44
|
-
return (0, import_transformFlowBabel.
|
|
45
|
+
return (0, import_transformFlowBabel.transformFlow)(code, {
|
|
46
|
+
path: id
|
|
47
|
+
});
|
|
45
48
|
}
|
|
46
49
|
return null;
|
|
47
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","default","createFlowPlugin","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","default","createFlowPlugin","transformFlow","import_transformFlowBabel2","transformFlowBabel","module","exports","import_vite","require","import_transformFlowBabel","opts","include","Array","isArray","length","filter","createFilter","exclude","name","enforce","transform","code","id","path"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAC,gBAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAC,0BAAA,CAAAD,aAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAD,0BAAA,CAAAC;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAb,YAA6B,CAAAK,aAAA;AAC7B,IAAAS,WAAA,GAAAC,OAAA,OAAkD;AAElD,IAAAC,yBAAA,GAAAD,OAAkD;AAOnC,IAAAL,0BAA0B,GAA8BK,OAAA;AACrE,SAAKP,gBAAkBA,CAAAS,IAAM;EAC3B,MAAAA,IAAA,aAAAA,IAAA,uBAAAA,IAAA,CAAAC,OAAA,KAAAC,KAAA,CAAAC,OAAA,CAAAH,IAAA,CAAAC,OAAA,KAAAD,IAAA,CAAAC,OAAA,CAAAG,MAAA;IACF;EAEA;EAEA,IAAAC,MAAO,OAAAR,WAAA,CAAAS,YAAA,EAAAN,IAAA,aAAAA,IAAA,uBAAAA,IAAA,CAAAC,OAAA,EAAAD,IAAA,aAAAA,IAAA,uBAAAA,IAAA,CAAAO,OAAA;EAAA,OACL;IACAC,IAAA,mBAAS;IACTC,OAAA,OAAU;IACRC,SAAIA,CAAAC,IAAO,EAAEC,EAAG;MACd,IAAAP,MAAA,CAAAO,EAAO;QACT,WAAAb,yBAAA,CAAAP,aAAA,EAAAmB,IAAA;UACAE,IAAO,EAAAD;QACT;MACF;MACF","ignoreList":[]}
|
|
@@ -33,33 +33,29 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
33
33
|
}), mod);
|
|
34
34
|
var transformFlowBabel_exports = {};
|
|
35
35
|
__export(transformFlowBabel_exports, {
|
|
36
|
+
transformFlow: () => transformFlow,
|
|
36
37
|
transformFlowBabel: () => transformFlowBabel
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(transformFlowBabel_exports);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const attempt = (0, import_resolve.resolvePath)("@react-native/babel-preset");
|
|
49
|
-
if ((await (0, import_promises.stat)(attempt)).isDirectory()) {
|
|
50
|
-
babelPreset = attempt;
|
|
51
|
-
}
|
|
52
|
-
} catch (err) {}
|
|
53
|
-
return await new Promise((res, rej) => {
|
|
54
|
-
import_core.default.transform(input, {
|
|
55
|
-
filename: path || "file.js",
|
|
56
|
-
presets: [babelPreset],
|
|
57
|
-
plugins: []
|
|
58
|
-
}, (err, result) => {
|
|
59
|
-
if (!result || err) {
|
|
60
|
-
return rej(err || "no res");
|
|
61
|
-
}
|
|
62
|
-
res(result.code);
|
|
63
|
-
});
|
|
40
|
+
async function transformFlow(input, options) {
|
|
41
|
+
const path = options?.path;
|
|
42
|
+
const fft = await import("fast-flow-transform");
|
|
43
|
+
const result = await fft.default({
|
|
44
|
+
filename: path || "file.js",
|
|
45
|
+
source: input,
|
|
46
|
+
sourcemap: true,
|
|
47
|
+
dialect: "flow",
|
|
48
|
+
format: "pretty"
|
|
64
49
|
});
|
|
50
|
+
return {
|
|
51
|
+
code: result.code,
|
|
52
|
+
map: result.map,
|
|
53
|
+
toString() {
|
|
54
|
+
return result.code;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async function transformFlowBabel(input, options) {
|
|
59
|
+
const res = await transformFlow(input, options);
|
|
60
|
+
return res.code;
|
|
65
61
|
}
|
|
@@ -35,35 +35,30 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
35
35
|
}), mod);
|
|
36
36
|
var transformFlowBabel_exports = {};
|
|
37
37
|
__export(transformFlowBabel_exports, {
|
|
38
|
+
transformFlow: () => transformFlow,
|
|
38
39
|
transformFlowBabel: () => transformFlowBabel
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(transformFlowBabel_exports);
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
var attempt = (0, import_resolve.resolvePath)("@react-native/babel-preset");
|
|
52
|
-
if ((await (0, import_promises.stat)(attempt)).isDirectory()) {
|
|
53
|
-
babelPreset = attempt;
|
|
54
|
-
}
|
|
55
|
-
} catch (err) {}
|
|
56
|
-
return await new Promise(function (res, rej) {
|
|
57
|
-
import_core.default.transform(input, {
|
|
58
|
-
filename: path || "file.js",
|
|
59
|
-
presets: [babelPreset],
|
|
60
|
-
plugins: []
|
|
61
|
-
}, function (err, result) {
|
|
62
|
-
if (!result || err) {
|
|
63
|
-
return rej(err || "no res");
|
|
64
|
-
}
|
|
65
|
-
res(result.code);
|
|
66
|
-
});
|
|
42
|
+
async function transformFlow(input, options) {
|
|
43
|
+
var path = options === null || options === void 0 ? void 0 : options.path;
|
|
44
|
+
var fft = await import("fast-flow-transform");
|
|
45
|
+
var result = await fft.default({
|
|
46
|
+
filename: path || "file.js",
|
|
47
|
+
source: input,
|
|
48
|
+
sourcemap: true,
|
|
49
|
+
dialect: "flow",
|
|
50
|
+
format: "pretty"
|
|
67
51
|
});
|
|
52
|
+
return {
|
|
53
|
+
code: result.code,
|
|
54
|
+
map: result.map,
|
|
55
|
+
toString() {
|
|
56
|
+
return result.code;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function transformFlowBabel(input, options) {
|
|
61
|
+
var res = await transformFlow(input, options);
|
|
62
|
+
return res.code;
|
|
68
63
|
}
|
|
69
64
|
//# sourceMappingURL=transformFlowBabel.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","transformFlowBabel_exports","__export","transformFlowBabel","module","exports","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","transformFlowBabel_exports","__export","transformFlow","transformFlowBabel","module","exports","input","options","path","fft","result","default","filename","source","sourcemap","dialect","format","code","map","toString","res"],"sources":["../../src/transformFlowBabel.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA,aAAA;EAAAC,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAMAC,MAAA,CAAAC,OAAA,GAAsBV,YACpB,CAAAK,0BAE8B;AAC9B,eAAaE,aAASA,CAAAI,KAAA,EAAAC,OAAA;EACtB,IAAAC,IAAM,GAAAD,OAAY,SAAO,IAAAA,OAAA,UAAqB,aAAAA,OAAA,CAAAC,IAAA;EAC9C,IAAAC,GAAM,SAAS,MAAM,sBAAY;EAAA,IAC/BC,MAAA,GAAU,MAAAD,GAAQ,CAAAE,OAAA;IAClBC,QAAQ,EAAAJ,IAAA;IACRK,MAAA,EAAAP,KAAW;IACXQ,SAAS;IACTC,OAAA,EAAQ;IACTC,MAAA;EACD;EAAO,OACL;IACAC,IAAA,EAAKP,MAAO,CAAAO,IAAA;IACZC,GAAA,EAAAR,MAAW,CAAAQ,GAAA;IACTC,SAAA,EAAO;MACT,OAAAT,MAAA,CAAAO,IAAA;IACF;EACF;AAEA;AAIE,eAAYd,kBAAMA,CAAcG,KAAA,EAAOC,OAAO;EAC9C,IAAAa,GAAO,SAAIlB,aAAA,CAAAI,KAAA,EAAAC,OAAA;EACb,OAAAa,GAAA,CAAAH,IAAA","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFilter } from "vite";
|
|
2
|
-
import {
|
|
3
|
-
import { transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.mjs";
|
|
2
|
+
import { transformFlow } from "./transformFlowBabel.mjs";
|
|
3
|
+
import { transformFlow as transformFlow2, transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.mjs";
|
|
4
4
|
function createFlowPlugin(opts) {
|
|
5
5
|
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0) {
|
|
6
6
|
return;
|
|
@@ -11,11 +11,13 @@ function createFlowPlugin(opts) {
|
|
|
11
11
|
enforce: "pre",
|
|
12
12
|
transform(code, id) {
|
|
13
13
|
if (filter(id)) {
|
|
14
|
-
return
|
|
14
|
+
return transformFlow(code, {
|
|
15
|
+
path: id
|
|
16
|
+
});
|
|
15
17
|
}
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
|
-
export { createFlowPlugin as default, transformFlowBabel2 as transformFlowBabel };
|
|
22
|
+
export { createFlowPlugin as default, transformFlow2 as transformFlow, transformFlowBabel2 as transformFlowBabel };
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFilter","transformFlowBabel","transformFlowBabel2","createFlowPlugin","opts","include","Array","isArray","length","filter","exclude","name","enforce","transform","code","id"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,YAAA,QAAoB;AAC7B,SAASC,
|
|
1
|
+
{"version":3,"names":["createFilter","transformFlow","transformFlow2","transformFlowBabel","transformFlowBabel2","createFlowPlugin","opts","include","Array","isArray","length","filter","exclude","name","enforce","transform","code","id","path"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,YAAA,QAAoB;AAC7B,SAASC,aAAA,QAAyC;AAElD,SAASA,aAAA,IAAAC,cAAA,EAAeC,kBAAA,IAAAC,mBAAA,QAA0B;AAOnC,SAARC,iBAAkCC,IAAA,EAA8B;EACrE,IAAI,CAACA,IAAA,EAAMC,OAAA,IAAYC,KAAA,CAAMC,OAAA,CAAQH,IAAA,CAAKC,OAAO,KAAKD,IAAA,CAAKC,OAAA,CAAQG,MAAA,KAAW,GAAI;IAChF;EACF;EAEA,MAAMC,MAAA,GAASX,YAAA,CAAaM,IAAA,EAAMC,OAAA,EAASD,IAAA,EAAMM,OAAO;EAExD,OAAO;IACLC,IAAA,EAAM;IACNC,OAAA,EAAS;IACTC,UAAUC,IAAA,EAAMC,EAAA,EAAI;MAClB,IAAIN,MAAA,CAAOM,EAAE,GAAG;QACd,OAAOhB,aAAA,CAAce,IAAA,EAAM;UAAEE,IAAA,EAAMD;QAAG,CAAC;MACzC;MACA,OAAO;IACT;EACF;AACF","ignoreList":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFilter } from "vite";
|
|
2
|
-
import {
|
|
3
|
-
import { transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.mjs";
|
|
2
|
+
import { transformFlow } from "./transformFlowBabel.mjs";
|
|
3
|
+
import { transformFlow as transformFlow2, transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.mjs";
|
|
4
4
|
function createFlowPlugin(opts) {
|
|
5
5
|
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0) {
|
|
6
6
|
return;
|
|
@@ -11,11 +11,13 @@ function createFlowPlugin(opts) {
|
|
|
11
11
|
enforce: "pre",
|
|
12
12
|
transform(code, id) {
|
|
13
13
|
if (filter(id)) {
|
|
14
|
-
return
|
|
14
|
+
return transformFlow(code, {
|
|
15
|
+
path: id
|
|
16
|
+
});
|
|
15
17
|
}
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
|
-
export { createFlowPlugin as default, transformFlowBabel2 as transformFlowBabel };
|
|
22
|
+
export { createFlowPlugin as default, transformFlow2 as transformFlow, transformFlowBabel2 as transformFlowBabel };
|
|
21
23
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFilter","transformFlowBabel","transformFlowBabel2","createFlowPlugin","opts","include","Array","isArray","length","filter","exclude","name","enforce","transform","code","id"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,YAAA,QAAoB;AAC7B,SAASC,
|
|
1
|
+
{"version":3,"names":["createFilter","transformFlow","transformFlow2","transformFlowBabel","transformFlowBabel2","createFlowPlugin","opts","include","Array","isArray","length","filter","exclude","name","enforce","transform","code","id","path"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,YAAA,QAAoB;AAC7B,SAASC,aAAA,QAAyC;AAElD,SAASA,aAAA,IAAAC,cAAA,EAAeC,kBAAA,IAAAC,mBAAA,QAA0B;AAOnC,SAARC,iBAAkCC,IAAA,EAA8B;EACrE,IAAI,CAACA,IAAA,EAAMC,OAAA,IAAYC,KAAA,CAAMC,OAAA,CAAQH,IAAA,CAAKC,OAAO,KAAKD,IAAA,CAAKC,OAAA,CAAQG,MAAA,KAAW,GAAI;IAChF;EACF;EAEA,MAAMC,MAAA,GAASX,YAAA,CAAaM,IAAA,EAAMC,OAAA,EAASD,IAAA,EAAMM,OAAO;EAExD,OAAO;IACLC,IAAA,EAAM;IACNC,OAAA,EAAS;IACTC,UAAUC,IAAA,EAAMC,EAAA,EAAI;MAClB,IAAIN,MAAA,CAAOM,EAAE,GAAG;QACd,OAAOhB,aAAA,CAAce,IAAA,EAAM;UAAEE,IAAA,EAAMD;QAAG,CAAC;MACzC;MACA,OAAO;IACT;EACF;AACF","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFilter } from "vite";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { transformFlow } from "./transformFlowBabel.native.js";
|
|
3
|
+
import { transformFlow as transformFlow2, transformFlowBabel } from "./transformFlowBabel.native.js";
|
|
4
4
|
function createFlowPlugin(opts) {
|
|
5
5
|
if (!(opts === null || opts === void 0 ? void 0 : opts.include) || Array.isArray(opts.include) && opts.include.length === 0) {
|
|
6
6
|
return;
|
|
@@ -11,11 +11,13 @@ function createFlowPlugin(opts) {
|
|
|
11
11
|
enforce: "pre",
|
|
12
12
|
transform(code, id) {
|
|
13
13
|
if (filter(id)) {
|
|
14
|
-
return
|
|
14
|
+
return transformFlow(code, {
|
|
15
|
+
path: id
|
|
16
|
+
});
|
|
15
17
|
}
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
|
-
export { createFlowPlugin as default,
|
|
22
|
+
export { createFlowPlugin as default, transformFlow2 as transformFlow, transformFlowBabel };
|
|
21
23
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFilter","
|
|
1
|
+
{"version":3,"names":["createFilter","transformFlow","transformFlow2","transformFlowBabel","createFlowPlugin","opts","include","Array","isArray","length","filter","exclude","name","enforce","transform","code","id","path"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,YAAA,QAAoB;AAC7B,SAASC,aAAA,QAAyC;AAElD,SAASA,aAAA,IAAAC,cAAA,EAAeC,kBAAA;AAOT,SAARC,iBAAkCC,IAAA,EAA8B;EACrE,IAAI,EAACA,IAAA,KAAM,QAAYA,IAAA,KAAM,KAAQ,IAAK,SAAOA,IAAK,CAAAC,OAAK,KAAQC,KAAA,CAAAC,OAAe,CAAAH,IAAA,CAAAC,OAAA,KAAAD,IAAA,CAAAC,OAAA,CAAAG,MAAA;IAChF;EACF;EAEA,IAAAC,MAAM,GAAAV,YAAS,CAAAK,IAAa,KAAM,QAASA,IAAA,KAAM,KAAO,aAAAA,IAAA,CAAAC,OAAA,EAAAD,IAAA,aAAAA,IAAA,uBAAAA,IAAA,CAAAM,OAAA;EAExD,OAAO;IACLC,IAAA,EAAM;IACNC,OAAA,EAAS;IACTC,UAAUC,IAAA,EAAMC,EAAA,EAAI;MAClB,IAAIN,MAAA,CAAOM,EAAE,GAAG;QACd,OAAOf,aAAA,CAAcc,IAAA,EAAM;UAC7BE,IAAA,EAAAD;QACA;MACF;MACF;IACF","ignoreList":[]}
|
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const attempt = resolvePath("@react-native/babel-preset");
|
|
11
|
-
if ((await stat(attempt)).isDirectory()) {
|
|
12
|
-
babelPreset = attempt;
|
|
13
|
-
}
|
|
14
|
-
} catch (err) {}
|
|
15
|
-
return await new Promise((res, rej) => {
|
|
16
|
-
babel.transform(input, {
|
|
17
|
-
filename: path || "file.js",
|
|
18
|
-
presets: [babelPreset],
|
|
19
|
-
plugins: []
|
|
20
|
-
}, (err, result) => {
|
|
21
|
-
if (!result || err) {
|
|
22
|
-
return rej(err || "no res");
|
|
23
|
-
}
|
|
24
|
-
res(result.code);
|
|
25
|
-
});
|
|
1
|
+
async function transformFlow(input, options) {
|
|
2
|
+
const path = options?.path;
|
|
3
|
+
const fft = await import("fast-flow-transform");
|
|
4
|
+
const result = await fft.default({
|
|
5
|
+
filename: path || "file.js",
|
|
6
|
+
source: input,
|
|
7
|
+
sourcemap: true,
|
|
8
|
+
dialect: "flow",
|
|
9
|
+
format: "pretty"
|
|
26
10
|
});
|
|
11
|
+
return {
|
|
12
|
+
code: result.code,
|
|
13
|
+
map: result.map,
|
|
14
|
+
toString() {
|
|
15
|
+
return result.code;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function transformFlowBabel(input, options) {
|
|
20
|
+
const res = await transformFlow(input, options);
|
|
21
|
+
return res.code;
|
|
27
22
|
}
|
|
28
|
-
export { transformFlowBabel };
|
|
23
|
+
export { transformFlow, transformFlowBabel };
|
|
29
24
|
//# sourceMappingURL=transformFlowBabel.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["transformFlow","input","options","path","fft","result","default","filename","source","sourcemap","dialect","format","code","map","toString","transformFlowBabel","res"],"sources":["../../src/transformFlowBabel.ts"],"sourcesContent":[null],"mappings":"AAMA,eAAsBA,cACpBC,KAAA,EACAC,OAAA,EAC8B;EAC9B,MAAMC,IAAA,GAAOD,OAAA,EAASC,IAAA;EACtB,MAAMC,GAAA,GAAM,MAAM,OAAO,qBAAqB;EAC9C,MAAMC,MAAA,GAAS,MAAMD,GAAA,CAAIE,OAAA,CAAQ;IAC/BC,QAAA,EAAUJ,IAAA,IAAQ;IAClBK,MAAA,EAAQP,KAAA;IACRQ,SAAA,EAAW;IACXC,OAAA,EAAS;IACTC,MAAA,EAAQ;EACV,CAAC;EACD,OAAO;IACLC,IAAA,EAAMP,MAAA,CAAOO,IAAA;IACbC,GAAA,EAAKR,MAAA,CAAOQ,GAAA;IACZC,SAAA,EAAW;MACT,OAAOT,MAAA,CAAOO,IAAA;IAChB;EACF;AACF;AAEA,eAAsBG,mBACpBd,KAAA,EACAC,OAAA,EACiB;EACjB,MAAMc,GAAA,GAAM,MAAMhB,aAAA,CAAcC,KAAA,EAAOC,OAAO;EAC9C,OAAOc,GAAA,CAAIJ,IAAA;AACb","ignoreList":[]}
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
var attempt = resolvePath("@react-native/babel-preset");
|
|
12
|
-
if ((await stat(attempt)).isDirectory()) {
|
|
13
|
-
babelPreset = attempt;
|
|
14
|
-
}
|
|
15
|
-
} catch (err) {}
|
|
16
|
-
return await new Promise(function (res, rej) {
|
|
17
|
-
babel.transform(input, {
|
|
18
|
-
filename: path || "file.js",
|
|
19
|
-
presets: [babelPreset],
|
|
20
|
-
plugins: []
|
|
21
|
-
}, function (err, result) {
|
|
22
|
-
if (!result || err) {
|
|
23
|
-
return rej(err || "no res");
|
|
24
|
-
}
|
|
25
|
-
res(result.code);
|
|
26
|
-
});
|
|
1
|
+
async function transformFlow(input, options) {
|
|
2
|
+
var path = options === null || options === void 0 ? void 0 : options.path;
|
|
3
|
+
var fft = await import("fast-flow-transform");
|
|
4
|
+
var result = await fft.default({
|
|
5
|
+
filename: path || "file.js",
|
|
6
|
+
source: input,
|
|
7
|
+
sourcemap: true,
|
|
8
|
+
dialect: "flow",
|
|
9
|
+
format: "pretty"
|
|
27
10
|
});
|
|
11
|
+
return {
|
|
12
|
+
code: result.code,
|
|
13
|
+
map: result.map,
|
|
14
|
+
toString() {
|
|
15
|
+
return result.code;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function transformFlowBabel(input, options) {
|
|
20
|
+
var res = await transformFlow(input, options);
|
|
21
|
+
return res.code;
|
|
28
22
|
}
|
|
29
|
-
export { transformFlowBabel };
|
|
23
|
+
export { transformFlow, transformFlowBabel };
|
|
30
24
|
//# sourceMappingURL=transformFlowBabel.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["transformFlow","input","options","path","fft","result","default","filename","source","sourcemap","dialect","format","code","map","toString","transformFlowBabel","res"],"sources":["../../src/transformFlowBabel.ts"],"sourcesContent":[null],"mappings":"AAMA,eAAsBA,cACpBC,KAAA,EACAC,OAAA,EAC8B;EAC9B,IAAAC,IAAM,GAAAD,OAAO,KAAS,QAAAA,OAAA,uBAAAA,OAAA,CAAAC,IAAA;EACtB,IAAAC,GAAM,SAAM,MAAM,sBAAO;EACzB,IAAAC,MAAM,SAASD,GAAM,CAAAE,OAAI;IACvBC,QAAA,EAAUJ,IAAA,IAAQ;IAClBK,MAAA,EAAQP,KAAA;IACRQ,SAAA,EAAW;IACXC,OAAA,EAAS;IACTC,MAAA,EAAQ;EACV,CAAC;EACD,OAAO;IACLC,IAAA,EAAMP,MAAA,CAAOO,IAAA;IACbC,GAAA,EAAKR,MAAA,CAAOQ,GAAA;IACZC,SAAA,EAAW;MACT,OAAOT,MAAA,CAAOO,IAAA;IAChB;EACF;AACF;AAEA,eAAsBG,mBACpBd,KAAA,EACAC,OAAA,EACiB;EACjB,IAAAc,GAAM,SAAMhB,aAAM,CAAAC,KAAc,EAAAC,OAAO;EACvC,OAAOc,GAAA,CAAIJ,IAAA;AACb","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/vite-flow",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0-1788990885077",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -28,10 +28,8 @@
|
|
|
28
28
|
"watch": "tamagui-build --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"@react-native/babel-preset": "^0.86.2",
|
|
34
|
-
"@vxrn/resolve": "1.25.16",
|
|
31
|
+
"@vxrn/resolve": "1.26.0-1788990885077",
|
|
32
|
+
"fast-flow-transform": "^0.0.3",
|
|
35
33
|
"vite": "^8.2.2"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FilterPattern, PluginOption } from 'vite'
|
|
2
2
|
import { createFilter } from 'vite'
|
|
3
|
-
import { transformFlowBabel } from './transformFlowBabel'
|
|
3
|
+
import { transformFlow, transformFlowBabel } from './transformFlowBabel'
|
|
4
4
|
|
|
5
|
-
export { transformFlowBabel } from './transformFlowBabel'
|
|
5
|
+
export { transformFlow, transformFlowBabel } from './transformFlowBabel'
|
|
6
6
|
|
|
7
7
|
export type Options = {
|
|
8
8
|
include?: FilterPattern
|
|
@@ -21,7 +21,7 @@ export default function createFlowPlugin(opts?: Options): PluginOption {
|
|
|
21
21
|
enforce: 'pre',
|
|
22
22
|
transform(code, id) {
|
|
23
23
|
if (filter(id)) {
|
|
24
|
-
return
|
|
24
|
+
return transformFlow(code, { path: id })
|
|
25
25
|
}
|
|
26
26
|
return null
|
|
27
27
|
},
|
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface TransformFlowResult {
|
|
2
|
+
code: string
|
|
3
|
+
map: any
|
|
4
|
+
toString(): string
|
|
5
|
+
}
|
|
4
6
|
|
|
5
|
-
export async function
|
|
7
|
+
export async function transformFlow(
|
|
6
8
|
input: string,
|
|
7
|
-
|
|
8
|
-
) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
options?: { development?: boolean; path?: string }
|
|
10
|
+
): Promise<TransformFlowResult> {
|
|
11
|
+
const path = options?.path
|
|
12
|
+
const fft = await import('fast-flow-transform')
|
|
13
|
+
const result = await fft.default({
|
|
14
|
+
filename: path || 'file.js',
|
|
15
|
+
source: input,
|
|
16
|
+
sourcemap: true,
|
|
17
|
+
dialect: 'flow',
|
|
18
|
+
format: 'pretty',
|
|
19
|
+
})
|
|
20
|
+
return {
|
|
21
|
+
code: result.code,
|
|
22
|
+
map: result.map,
|
|
23
|
+
toString() {
|
|
24
|
+
return result.code
|
|
25
|
+
},
|
|
20
26
|
}
|
|
27
|
+
}
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
plugins: [],
|
|
29
|
-
},
|
|
30
|
-
(err: any, result) => {
|
|
31
|
-
if (!result || err) {
|
|
32
|
-
return rej(err || 'no res')
|
|
33
|
-
}
|
|
34
|
-
res(result!.code!)
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
})
|
|
29
|
+
export async function transformFlowBabel(
|
|
30
|
+
input: string,
|
|
31
|
+
options?: { development?: boolean; path?: string }
|
|
32
|
+
): Promise<string> {
|
|
33
|
+
const res = await transformFlow(input, options)
|
|
34
|
+
return res.code
|
|
38
35
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FilterPattern, PluginOption } from 'vite';
|
|
2
|
-
export { transformFlowBabel } from './transformFlowBabel';
|
|
2
|
+
export { transformFlow, transformFlowBabel } from './transformFlowBabel';
|
|
3
3
|
export type Options = {
|
|
4
4
|
include?: FilterPattern;
|
|
5
5
|
exclude?: FilterPattern;
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAIvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAIvD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,YAAY,CAiBrE"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface TransformFlowResult {
|
|
2
|
+
code: string;
|
|
3
|
+
map: any;
|
|
4
|
+
toString(): string;
|
|
5
|
+
}
|
|
6
|
+
export declare function transformFlow(input: string, options?: {
|
|
7
|
+
development?: boolean;
|
|
8
|
+
path?: string;
|
|
9
|
+
}): Promise<TransformFlowResult>;
|
|
10
|
+
export declare function transformFlowBabel(input: string, options?: {
|
|
2
11
|
development?: boolean;
|
|
3
12
|
path?: string;
|
|
4
13
|
}): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformFlowBabel.d.ts","sourceRoot":"","sources":["../src/transformFlowBabel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transformFlowBabel.d.ts","sourceRoot":"","sources":["../src/transformFlowBabel.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,GAAG,CAAA;IACR,QAAQ,IAAI,MAAM,CAAA;CACnB;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD,OAAO,CAAC,mBAAmB,CAAC,CAiB9B;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|