@vxrn/vite-flow 1.14.4 → 1.14.5
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 +22 -15
- package/dist/cjs/index.native.js +28 -22
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/transformFlowBabel.cjs +35 -29
- package/dist/cjs/transformFlowBabel.native.js +38 -32
- package/dist/cjs/transformFlowBabel.native.js.map +1 -1
- package/dist/esm/index.js +7 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +7 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +13 -9
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/transformFlowBabel.mjs +8 -4
- package/dist/esm/transformFlowBabel.mjs.map +1 -1
- package/dist/esm/transformFlowBabel.native.js +11 -7
- package/dist/esm/transformFlowBabel.native.js.map +1 -1
- package/package.json +3 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var index_exports = {};
|
|
22
24
|
__export(index_exports, {
|
|
@@ -24,17 +26,22 @@ __export(index_exports, {
|
|
|
24
26
|
transformFlowBabel: () => import_transformFlowBabel2.transformFlowBabel
|
|
25
27
|
});
|
|
26
28
|
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
var import_vite = require("vite")
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
var import_vite = require("vite");
|
|
30
|
+
var import_transformFlowBabel = require("./transformFlowBabel.cjs");
|
|
31
|
+
var import_transformFlowBabel2 = require("./transformFlowBabel.cjs");
|
|
30
32
|
function createFlowPlugin(opts) {
|
|
31
|
-
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0)
|
|
33
|
+
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
32
36
|
const filter = (0, import_vite.createFilter)(opts?.include, opts?.exclude);
|
|
33
37
|
return {
|
|
34
38
|
name: "@vxrn/vite-flow",
|
|
35
39
|
enforce: "pre",
|
|
36
40
|
transform(code, id) {
|
|
37
|
-
|
|
41
|
+
if (filter(id)) {
|
|
42
|
+
return (0, import_transformFlowBabel.transformFlowBabel)(code);
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
38
45
|
}
|
|
39
46
|
};
|
|
40
47
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var index_exports = {};
|
|
24
26
|
__export(index_exports, {
|
|
@@ -26,19 +28,23 @@ __export(index_exports, {
|
|
|
26
28
|
transformFlowBabel: () => import_transformFlowBabel2.transformFlowBabel
|
|
27
29
|
});
|
|
28
30
|
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
var import_vite = require("vite")
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
var import_vite = require("vite");
|
|
32
|
+
var import_transformFlowBabel = require("./transformFlowBabel.native.js");
|
|
33
|
+
var import_transformFlowBabel2 = require("./transformFlowBabel.native.js");
|
|
32
34
|
function createFlowPlugin(opts) {
|
|
33
|
-
if (!(
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
name: "@vxrn/vite-flow",
|
|
37
|
-
enforce: "pre",
|
|
38
|
-
transform(code, id) {
|
|
39
|
-
return filter(id) ? (0, import_transformFlowBabel.transformFlowBabel)(code) : null;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
35
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.include) || Array.isArray(opts.include) && opts.include.length === 0) {
|
|
36
|
+
return;
|
|
42
37
|
}
|
|
38
|
+
var filter = (0, import_vite.createFilter)(opts === null || opts === void 0 ? void 0 : opts.include, opts === null || opts === void 0 ? void 0 : opts.exclude);
|
|
39
|
+
return {
|
|
40
|
+
name: "@vxrn/vite-flow",
|
|
41
|
+
enforce: "pre",
|
|
42
|
+
transform(code, id) {
|
|
43
|
+
if (filter(id)) {
|
|
44
|
+
return (0, import_transformFlowBabel.transformFlowBabel)(code);
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
43
49
|
}
|
|
44
50
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","default","createFlowPlugin","transformFlowBabel","import_transformFlowBabel2","module","exports","import_vite","require","import_transformFlowBabel","opts","include","Array","isArray","length","filter","createFilter","exclude","name","enforce","transform","code","id"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","default","createFlowPlugin","transformFlowBabel","import_transformFlowBabel2","module","exports","import_vite","require","import_transformFlowBabel","opts","include","Array","isArray","length","filter","createFilter","exclude","name","enforce","transform","code","id"],"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,kBAAA,EAAAA,CAAA,KAAAC,0BAAA,CAAAD;AAAA;AACAE,MAAA,CAAAC,OAAA,GAAAZ,YAA6B,CAAAK,aAAA;AAC7B,IAAAQ,WAAA,GAAAC,OAAA,OAAmC;AAEnC,IAAAC,yBAAA,GAAAD,OAAmC;AAOpB,IAAAJ,0BAA0B,GAA8BI,OAAA;AACrE,SAAKN,gBAAkBA,CAAAQ,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,CAAAN,kBAAA,EAAAkB,IAAA;MACA;MACF;IACF;EACF","ignoreList":[]}
|
|
@@ -2,57 +2,63 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var transformFlowBabel_exports = {};
|
|
33
35
|
__export(transformFlowBabel_exports, {
|
|
34
36
|
transformFlowBabel: () => transformFlowBabel
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(transformFlowBabel_exports);
|
|
37
|
-
var import_promises = require("node:fs/promises")
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
var import_promises = require("node:fs/promises");
|
|
40
|
+
var import_core = __toESM(require("@babel/core"), 1);
|
|
41
|
+
var import_resolve = require("@vxrn/resolve");
|
|
40
42
|
async function transformFlowBabel(input, {
|
|
41
|
-
development =
|
|
43
|
+
development = false,
|
|
42
44
|
path
|
|
43
45
|
} = {}) {
|
|
44
46
|
let babelPreset = "module:@react-native/babel-preset";
|
|
45
47
|
try {
|
|
46
48
|
const attempt = (0, import_resolve.resolvePath)("@react-native/babel-preset");
|
|
47
|
-
(await (0, import_promises.stat)(attempt)).isDirectory()
|
|
48
|
-
|
|
49
|
+
if ((await (0, import_promises.stat)(attempt)).isDirectory()) {
|
|
50
|
+
babelPreset = attempt;
|
|
51
|
+
}
|
|
52
|
+
} catch (err) {}
|
|
49
53
|
return await new Promise((res, rej) => {
|
|
50
54
|
import_core.default.transform(input, {
|
|
51
55
|
filename: path || "file.js",
|
|
52
56
|
presets: [babelPreset],
|
|
53
57
|
plugins: []
|
|
54
58
|
}, (err, result) => {
|
|
55
|
-
if (!result || err)
|
|
59
|
+
if (!result || err) {
|
|
60
|
+
return rej(err || "no res");
|
|
61
|
+
}
|
|
56
62
|
res(result.code);
|
|
57
63
|
});
|
|
58
64
|
});
|
|
@@ -4,58 +4,64 @@ var __create = Object.create;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
8
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
18
|
get: () => from[key],
|
|
18
19
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
34
36
|
var transformFlowBabel_exports = {};
|
|
35
37
|
__export(transformFlowBabel_exports, {
|
|
36
38
|
transformFlowBabel: () => transformFlowBabel
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(transformFlowBabel_exports);
|
|
39
|
-
var import_promises = require("fs/promises")
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
var import_promises = require("fs/promises");
|
|
42
|
+
var import_core = __toESM(require("@babel/core"), 1);
|
|
43
|
+
var import_resolve = require("@vxrn/resolve");
|
|
42
44
|
async function transformFlowBabel(input) {
|
|
43
45
|
var {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
development = false,
|
|
47
|
+
path
|
|
48
|
+
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
49
|
+
var babelPreset = "module:@react-native/babel-preset";
|
|
48
50
|
try {
|
|
49
51
|
var attempt = (0, import_resolve.resolvePath)("@react-native/babel-preset");
|
|
50
|
-
(await (0, import_promises.stat)(attempt)).isDirectory()
|
|
51
|
-
|
|
52
|
+
if ((await (0, import_promises.stat)(attempt)).isDirectory()) {
|
|
53
|
+
babelPreset = attempt;
|
|
54
|
+
}
|
|
55
|
+
} catch (err) {}
|
|
52
56
|
return await new Promise(function (res, rej) {
|
|
53
57
|
import_core.default.transform(input, {
|
|
54
58
|
filename: path || "file.js",
|
|
55
59
|
presets: [babelPreset],
|
|
56
60
|
plugins: []
|
|
57
61
|
}, function (err, result) {
|
|
58
|
-
if (!result || err)
|
|
62
|
+
if (!result || err) {
|
|
63
|
+
return rej(err || "no res");
|
|
64
|
+
}
|
|
59
65
|
res(result.code);
|
|
60
66
|
});
|
|
61
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","transformFlowBabel_exports","__export","transformFlowBabel","module","exports","import_promises","require","import_core","__toESM","import_resolve","input","development","path","arguments","length","babelPreset","attempt","resolvePath","stat","isDirectory","Promise","res","rej","default","transform","filename","presets","plugins","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","transformFlowBabel_exports","__export","transformFlowBabel","module","exports","import_promises","require","import_core","__toESM","import_resolve","input","development","path","arguments","length","babelPreset","attempt","resolvePath","stat","isDirectory","err","Promise","res","rej","default","transform","filename","presets","plugins","result","code"],"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,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAqB,CAAAK,0BAAA;AACrB,IAAAK,eAAkB,GAAAC,OAAA;AAClB,IAAAC,WAAA,GAAAC,OAA4B,CAAAF,OAAA;AAE5B,IAAAG,cAAsB,GAAAH,OAAA,gBAElB;AAEF,eAAIJ,kBAAcA,CAAAQ,KAAA;EAElB,IAAI;IAAAC,WAAA;IAAAC;EAAA,IAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAGF,IAAAE,WAAM,sCAAsB;EAC5B;IACE,IAAAC,OAAA,KAAc,EAAAP,cAAA,CAAAQ,WAAA;IAChB,eAAAZ,eAAA,CAAAa,IAAA,EAAAF,OAAA,GAAAG,WAAA;MACFJ,WAAc,GAAAC,OAAA;IAEd;EAEA,SAAOI,GAAA,EAAM,CACX;EAAM,OACJ,UAAAC,OAAA,WAAAC,GAAA,EAAAC,GAAA;IAAAhB,WACA,CAAAiB,OAAA,CAAAC,SAAA,CAAAf,KAAA;MAAAgB,QACE,EAAAd,IAAU,aAAQ;MAAAe,OAClB,GACAZ,WAAU,CACZ;MACAa,OAAW;IACT,aAAKR,GAAA,EAAAS,MAAU,EAAK;MAClB,KAAAA,MAAO,IAAIT,GAAA;QACb,OAAAG,GAAA,CAAAH,GAAA;MACA;MACFE,GAAA,CAAAO,MAAA,CAAAC,IAAA;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -2,13 +2,18 @@ import { createFilter } from "vite";
|
|
|
2
2
|
import { transformFlowBabel } from "./transformFlowBabel.mjs";
|
|
3
3
|
import { transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.mjs";
|
|
4
4
|
function createFlowPlugin(opts) {
|
|
5
|
-
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0)
|
|
5
|
+
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
6
8
|
const filter = createFilter(opts?.include, opts?.exclude);
|
|
7
9
|
return {
|
|
8
10
|
name: "@vxrn/vite-flow",
|
|
9
11
|
enforce: "pre",
|
|
10
12
|
transform(code, id) {
|
|
11
|
-
|
|
13
|
+
if (filter(id)) {
|
|
14
|
+
return transformFlowBabel(code);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
12
17
|
}
|
|
13
18
|
};
|
|
14
19
|
}
|
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,kBAAA,QAA0B;AAEnC,SAASA,kBAAA,IAAAC,mBAAA,QAA0B;AAOpB,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,
|
|
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,kBAAA,QAA0B;AAEnC,SAASA,kBAAA,IAAAC,mBAAA,QAA0B;AAOpB,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,GAAST,YAAA,CAAaI,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,OAAOd,kBAAA,CAAmBa,IAAI;MAChC;MACA,OAAO;IACT;EACF;AACF","ignoreList":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,13 +2,18 @@ import { createFilter } from "vite";
|
|
|
2
2
|
import { transformFlowBabel } from "./transformFlowBabel.mjs";
|
|
3
3
|
import { transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.mjs";
|
|
4
4
|
function createFlowPlugin(opts) {
|
|
5
|
-
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0)
|
|
5
|
+
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
6
8
|
const filter = createFilter(opts?.include, opts?.exclude);
|
|
7
9
|
return {
|
|
8
10
|
name: "@vxrn/vite-flow",
|
|
9
11
|
enforce: "pre",
|
|
10
12
|
transform(code, id) {
|
|
11
|
-
|
|
13
|
+
if (filter(id)) {
|
|
14
|
+
return transformFlowBabel(code);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
12
17
|
}
|
|
13
18
|
};
|
|
14
19
|
}
|
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,kBAAA,QAA0B;AAEnC,SAASA,kBAAA,IAAAC,mBAAA,QAA0B;AAOpB,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,
|
|
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,kBAAA,QAA0B;AAEnC,SAASA,kBAAA,IAAAC,mBAAA,QAA0B;AAOpB,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,GAAST,YAAA,CAAaI,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,OAAOd,kBAAA,CAAmBa,IAAI;MAChC;MACA,OAAO;IACT;EACF;AACF","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -2,16 +2,20 @@ import { createFilter } from "vite";
|
|
|
2
2
|
import { transformFlowBabel } from "./transformFlowBabel.native.js";
|
|
3
3
|
import { transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.native.js";
|
|
4
4
|
function createFlowPlugin(opts) {
|
|
5
|
-
if (!(
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
name: "@vxrn/vite-flow",
|
|
9
|
-
enforce: "pre",
|
|
10
|
-
transform(code, id) {
|
|
11
|
-
return filter(id) ? transformFlowBabel(code) : null;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
5
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.include) || Array.isArray(opts.include) && opts.include.length === 0) {
|
|
6
|
+
return;
|
|
14
7
|
}
|
|
8
|
+
var filter = createFilter(opts === null || opts === void 0 ? void 0 : opts.include, opts === null || opts === void 0 ? void 0 : opts.exclude);
|
|
9
|
+
return {
|
|
10
|
+
name: "@vxrn/vite-flow",
|
|
11
|
+
enforce: "pre",
|
|
12
|
+
transform(code, id) {
|
|
13
|
+
if (filter(id)) {
|
|
14
|
+
return transformFlowBabel(code);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
15
19
|
}
|
|
16
20
|
export { createFlowPlugin as default, transformFlowBabel2 as transformFlowBabel };
|
|
17
21
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -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,kBAAA,QAA0B;AAEnC,SAASA,kBAAA,IAAAC,mBAAA,QAA0B;AAOpB,SAARC,iBAAkCC,IAAA,EAA8B;EACrE,IAAI,
|
|
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,kBAAA,QAA0B;AAEnC,SAASA,kBAAA,IAAAC,mBAAA,QAA0B;AAOpB,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,GAAAT,YAAS,CAAAI,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,OAAOd,kBAAA,CAAmBa,IAAI;MAChC;MACA,OAAO;IACT;EACF;AACF","ignoreList":[]}
|
|
@@ -2,21 +2,25 @@ import { stat } from "node:fs/promises";
|
|
|
2
2
|
import babel from "@babel/core";
|
|
3
3
|
import { resolvePath } from "@vxrn/resolve";
|
|
4
4
|
async function transformFlowBabel(input, {
|
|
5
|
-
development =
|
|
5
|
+
development = false,
|
|
6
6
|
path
|
|
7
7
|
} = {}) {
|
|
8
8
|
let babelPreset = "module:@react-native/babel-preset";
|
|
9
9
|
try {
|
|
10
10
|
const attempt = resolvePath("@react-native/babel-preset");
|
|
11
|
-
(await stat(attempt)).isDirectory()
|
|
12
|
-
|
|
11
|
+
if ((await stat(attempt)).isDirectory()) {
|
|
12
|
+
babelPreset = attempt;
|
|
13
|
+
}
|
|
14
|
+
} catch (err) {}
|
|
13
15
|
return await new Promise((res, rej) => {
|
|
14
16
|
babel.transform(input, {
|
|
15
17
|
filename: path || "file.js",
|
|
16
18
|
presets: [babelPreset],
|
|
17
19
|
plugins: []
|
|
18
20
|
}, (err, result) => {
|
|
19
|
-
if (!result || err)
|
|
21
|
+
if (!result || err) {
|
|
22
|
+
return rej(err || "no res");
|
|
23
|
+
}
|
|
20
24
|
res(result.code);
|
|
21
25
|
});
|
|
22
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["stat","babel","resolvePath","transformFlowBabel","input","development","path","babelPreset","attempt","isDirectory","Promise","res","rej","transform","filename","presets","plugins","
|
|
1
|
+
{"version":3,"names":["stat","babel","resolvePath","transformFlowBabel","input","development","path","babelPreset","attempt","isDirectory","err","Promise","res","rej","transform","filename","presets","plugins","result","code"],"sources":["../../src/transformFlowBabel.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAA,QAAY;AACrB,OAAOC,KAAA,MAAW;AAClB,SAASC,WAAA,QAAmB;AAE5B,eAAsBC,mBACpBC,KAAA,EACA;EAAEC,WAAA,GAAc;EAAOC;AAAK,IAA8C,CAAC,GAC3E;EACA,IAAIC,WAAA,GAAc;EAElB,IAAI;IAGF,MAAMC,OAAA,GAAUN,WAAA,CAAY,4BAA4B;IACxD,KAAK,MAAMF,IAAA,CAAKQ,OAAO,GAAGC,WAAA,CAAY,GAAG;MACvCF,WAAA,GAAcC,OAAA;IAChB;EACF,SAASE,GAAA,EAAK,CAEd;EAEA,OAAO,MAAM,IAAIC,OAAA,CAAgB,CAACC,GAAA,EAAKC,GAAA,KAAQ;IAC7CZ,KAAA,CAAMa,SAAA,CACJV,KAAA,EACA;MACEW,QAAA,EAAUT,IAAA,IAAQ;MAClBU,OAAA,EAAS,CAACT,WAAW;MACrBU,OAAA,EAAS;IACX,GACA,CAACP,GAAA,EAAUQ,MAAA,KAAW;MACpB,IAAI,CAACA,MAAA,IAAUR,GAAA,EAAK;QAClB,OAAOG,GAAA,CAAIH,GAAA,IAAO,QAAQ;MAC5B;MACAE,GAAA,CAAIM,MAAA,CAAQC,IAAK;IACnB,CACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -3,21 +3,25 @@ import babel from "@babel/core";
|
|
|
3
3
|
import { resolvePath } from "@vxrn/resolve";
|
|
4
4
|
async function transformFlowBabel(input) {
|
|
5
5
|
var {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
development = false,
|
|
7
|
+
path
|
|
8
|
+
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
9
|
+
var babelPreset = "module:@react-native/babel-preset";
|
|
10
10
|
try {
|
|
11
11
|
var attempt = resolvePath("@react-native/babel-preset");
|
|
12
|
-
(await stat(attempt)).isDirectory()
|
|
13
|
-
|
|
12
|
+
if ((await stat(attempt)).isDirectory()) {
|
|
13
|
+
babelPreset = attempt;
|
|
14
|
+
}
|
|
15
|
+
} catch (err) {}
|
|
14
16
|
return await new Promise(function (res, rej) {
|
|
15
17
|
babel.transform(input, {
|
|
16
18
|
filename: path || "file.js",
|
|
17
19
|
presets: [babelPreset],
|
|
18
20
|
plugins: []
|
|
19
21
|
}, function (err, result) {
|
|
20
|
-
if (!result || err)
|
|
22
|
+
if (!result || err) {
|
|
23
|
+
return rej(err || "no res");
|
|
24
|
+
}
|
|
21
25
|
res(result.code);
|
|
22
26
|
});
|
|
23
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["stat","babel","resolvePath","transformFlowBabel","input","development","path","arguments","length","babelPreset","attempt","isDirectory","Promise","res","rej","transform","filename","presets","plugins","
|
|
1
|
+
{"version":3,"names":["stat","babel","resolvePath","transformFlowBabel","input","development","path","arguments","length","babelPreset","attempt","isDirectory","err","Promise","res","rej","transform","filename","presets","plugins","result","code"],"sources":["../../src/transformFlowBabel.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAA,QAAY;AACrB,OAAOC,KAAA,MAAW;AAClB,SAASC,WAAA,QAAmB;AAE5B,eAAsBC,mBACpBC,KAAA,EACA;EAEA,IAAI;IAAAC,WAAA,GAAc;IAAAC;EAAA,IAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAElB,IAAIE,WAAA;EAGF;IACA,IAAAC,OAAW,GAAAR,WAAY,CAAG,4BAAe;IACvC,WAAAF,IAAA,CAAcU,OAAA,GAAAC,WAAA;MAChBF,WAAA,GAAAC,OAAA;IACF;EAEA,SAAAE,GAAA,GAEA;EACE,aAAM,IAAAC,OAAA,WAAAC,GAAA,EAAAC,GAAA;IAAAd,KACJ,CAAAe,SAAA,CAAAZ,KAAA;MACAa,QAAA,EAAAX,IAAA;MAAAY,OACE,GACAT,WAAU,CAAW;MAEvBU,OAAA;IAAA,GACC,UAAUP,GAAA,EAAAQ,MAAW;MACpB,KAAAA,MAAK,IAAAR,GAAU;QACb,OAAAG,GAAO,CAAAH,GAAI,YAAO;MAAQ;MAE5BE,GAAA,CAAAM,MAAI,CAAAC,IAAQ;IAAK,EACnB;EAAA,EACF;AAAA;AAEJ,S","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/vite-flow",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"@babel/core": "^7.28.5",
|
|
32
32
|
"@babel/helper-plugin-utils": "^7.27.1",
|
|
33
33
|
"@react-native/babel-preset": "^0.83.0",
|
|
34
|
-
"@vxrn/resolve": "1.14.
|
|
34
|
+
"@vxrn/resolve": "1.14.5",
|
|
35
35
|
"vite": "^8.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@biomejs/biome": "2.3.3",
|
|
39
|
-
"@tamagui/build": "2.0.0-rc.
|
|
39
|
+
"@tamagui/build": "2.0.0-rc.36-1775258360494"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|