@vxrn/vite-flow 1.1.547 → 1.2.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/dist/cjs/index.cjs +4 -8
- package/dist/cjs/index.js +3 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/index.native.js +4 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/transformFlowBabel.cjs +11 -23
- package/dist/cjs/transformFlowBabel.js +8 -25
- package/dist/cjs/transformFlowBabel.js.map +1 -1
- package/dist/cjs/transformFlowBabel.native.js +11 -23
- package/dist/cjs/transformFlowBabel.native.js.map +1 -1
- package/dist/esm/index.js +3 -5
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/index.mjs +3 -7
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -9
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/transformFlowBabel.js +8 -25
- package/dist/esm/transformFlowBabel.js.map +1 -1
- package/dist/esm/transformFlowBabel.mjs +9 -21
- package/dist/esm/transformFlowBabel.mjs.map +1 -1
- package/dist/esm/transformFlowBabel.native.js +9 -21
- package/dist/esm/transformFlowBabel.native.js.map +1 -1
- package/package.json +5 -9
- package/src/index.ts +2 -9
- package/src/transformFlowBabel.ts +8 -22
- package/types/index.d.ts +1 -3
- package/types/index.d.ts.map +1 -1
- package/types/transformFlowBabel.d.ts +2 -1
- package/types/transformFlowBabel.d.ts.map +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -21,16 +21,12 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
default: () => createFlowPlugin,
|
|
24
|
-
|
|
24
|
+
transformFlowBabel: () => import_transformFlowBabel2.transformFlowBabel
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
var import_vite = require("vite"),
|
|
28
|
-
import_transformFlowBabel = require("./transformFlowBabel.cjs")
|
|
29
|
-
|
|
30
|
-
development = !1
|
|
31
|
-
} = {}) {
|
|
32
|
-
return await (0, import_transformFlowBabel.transformFlowBabel)(input);
|
|
33
|
-
}
|
|
28
|
+
import_transformFlowBabel = require("./transformFlowBabel.cjs"),
|
|
29
|
+
import_transformFlowBabel2 = require("./transformFlowBabel.cjs");
|
|
34
30
|
function createFlowPlugin(opts) {
|
|
35
31
|
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0) return;
|
|
36
32
|
const filter = (0, import_vite.createFilter)(opts?.include, opts?.exclude);
|
|
@@ -38,7 +34,7 @@ function createFlowPlugin(opts) {
|
|
|
38
34
|
name: "@vxrn/vite-flow",
|
|
39
35
|
enforce: "pre",
|
|
40
36
|
transform(code, id) {
|
|
41
|
-
return filter(id) ?
|
|
37
|
+
return filter(id) ? (0, import_transformFlowBabel.transformFlowBabel)(code) : null;
|
|
42
38
|
}
|
|
43
39
|
};
|
|
44
40
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,13 +15,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0
|
|
|
15
15
|
var index_exports = {};
|
|
16
16
|
__export(index_exports, {
|
|
17
17
|
default: () => createFlowPlugin,
|
|
18
|
-
|
|
18
|
+
transformFlowBabel: () => import_transformFlowBabel2.transformFlowBabel
|
|
19
19
|
});
|
|
20
20
|
module.exports = __toCommonJS(index_exports);
|
|
21
|
-
var import_vite = require("vite"), import_transformFlowBabel = require("./transformFlowBabel");
|
|
22
|
-
async function transformFlow(input, { development = !1 } = {}) {
|
|
23
|
-
return await (0, import_transformFlowBabel.transformFlowBabel)(input);
|
|
24
|
-
}
|
|
21
|
+
var import_vite = require("vite"), import_transformFlowBabel = require("./transformFlowBabel"), import_transformFlowBabel2 = require("./transformFlowBabel");
|
|
25
22
|
function createFlowPlugin(opts) {
|
|
26
23
|
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0)
|
|
27
24
|
return;
|
|
@@ -30,7 +27,7 @@ function createFlowPlugin(opts) {
|
|
|
30
27
|
name: "@vxrn/vite-flow",
|
|
31
28
|
enforce: "pre",
|
|
32
29
|
transform(code, id) {
|
|
33
|
-
return filter(id) ?
|
|
30
|
+
return filter(id) ? (0, import_transformFlowBabel.transformFlowBabel)(code) : null;
|
|
34
31
|
}
|
|
35
32
|
};
|
|
36
33
|
}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA6B,iBAC7B,4BAAmC
|
|
5
|
-
"names": []
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA6B,iBAC7B,4BAAmC,iCAEnCA,6BAAmC;AAOpB,SAAR,iBAAkC,MAA8B;AACrE,MAAI,CAAC,MAAM,WAAY,MAAM,QAAQ,KAAK,OAAO,KAAK,KAAK,QAAQ,WAAW;AAC5E;AAGF,QAAM,aAAS,0BAAa,MAAM,SAAS,MAAM,OAAO;AAExD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU,MAAM,IAAI;AAClB,aAAI,OAAO,EAAE,QACJ,8CAAmB,IAAI,IAEzB;AAAA,IACT;AAAA,EACF;AACF;",
|
|
5
|
+
"names": ["import_transformFlowBabel"]
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -23,18 +23,12 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
23
23
|
var index_exports = {};
|
|
24
24
|
__export(index_exports, {
|
|
25
25
|
default: () => createFlowPlugin,
|
|
26
|
-
|
|
26
|
+
transformFlowBabel: () => import_transformFlowBabel2.transformFlowBabel
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
var import_vite = require("vite"),
|
|
30
|
-
import_transformFlowBabel = require("./transformFlowBabel.native.js")
|
|
31
|
-
|
|
32
|
-
var {
|
|
33
|
-
development = !1
|
|
34
|
-
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
35
|
-
final = await (0, import_transformFlowBabel.transformFlowBabel)(input);
|
|
36
|
-
return final;
|
|
37
|
-
}
|
|
30
|
+
import_transformFlowBabel = require("./transformFlowBabel.native.js"),
|
|
31
|
+
import_transformFlowBabel2 = require("./transformFlowBabel.native.js");
|
|
38
32
|
function createFlowPlugin(opts) {
|
|
39
33
|
if (!(!opts?.include || Array.isArray(opts.include) && opts.include.length === 0)) {
|
|
40
34
|
var filter = (0, import_vite.createFilter)(opts?.include, opts?.exclude);
|
|
@@ -42,7 +36,7 @@ function createFlowPlugin(opts) {
|
|
|
42
36
|
name: "@vxrn/vite-flow",
|
|
43
37
|
enforce: "pre",
|
|
44
38
|
transform(code, id) {
|
|
45
|
-
return filter(id) ?
|
|
39
|
+
return filter(id) ? (0, import_transformFlowBabel.transformFlowBabel)(code) : null;
|
|
46
40
|
}
|
|
47
41
|
};
|
|
48
42
|
}
|
|
@@ -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","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,aAC7B;AASe,IAAAQ,WAAR,GAAAC,OAAA,CAAkC,MAA8B;EAAAC,yBAAA,GAAAD,OAAA;EAAAJ,0BAAA,GAAAI,OAAA;AACrE,SAAKN,gBAAkBA,CAAAQ,IAAM;EAC3B,OAAAA,IAAA,EAAAC,OAAA,IAAAC,KAAA,CAAAC,OAAA,CAAAH,IAAA,CAAAC,OAAA,KAAAD,IAAA,CAAAC,OAAA,CAAAG,MAAA;IAGF,IAAMC,MAAA,OAASR,WAAA,CAAAS,YAAA,EAAaN,IAAA,EAAMC,OAAA,EAASD,IAAA,EAAMO,OAAO;IAExD,OAAO;MACLC,IAAM;MACNC,OAAS;MACTC,SAAUA,CAAAC,IAAM,EAAAC,EAAI;QAClB,OAAIP,MAAO,CAAEO,EAAA,MACJ,EAAAb,yBAAA,CAAAN,kBAAmB,EAAAkB,IAAI,IAEzB;MACT;IACF;EACF","ignoreList":[]}
|
|
@@ -34,35 +34,23 @@ __export(transformFlowBabel_exports, {
|
|
|
34
34
|
transformFlowBabel: () => transformFlowBabel
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(transformFlowBabel_exports);
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
var import_promises = require("node:fs/promises"),
|
|
38
|
+
import_core = __toESM(require("@babel/core"), 1),
|
|
39
|
+
import_resolve = require("@vxrn/resolve");
|
|
40
40
|
async function transformFlowBabel(input, {
|
|
41
|
-
development = !1
|
|
41
|
+
development = !1,
|
|
42
|
+
path
|
|
42
43
|
} = {}) {
|
|
43
|
-
let
|
|
44
|
+
let babelPreset = "module:@react-native/babel-preset";
|
|
44
45
|
try {
|
|
45
|
-
const attempt = (0, import_resolve.resolvePath)("
|
|
46
|
-
(await (0, import_promises.stat)(attempt)).isDirectory() && (
|
|
46
|
+
const attempt = (0, import_resolve.resolvePath)("@react-native/babel-preset");
|
|
47
|
+
(await (0, import_promises.stat)(attempt)).isDirectory() && (babelPreset = attempt);
|
|
47
48
|
} catch {}
|
|
48
49
|
return await new Promise((res, rej) => {
|
|
49
50
|
import_core.default.transform(input, {
|
|
50
|
-
filename: "file.js",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// To use the `@babel/plugin-transform-react-jsx` plugin for JSX.
|
|
54
|
-
useTransformReactJSXExperimental: !0,
|
|
55
|
-
unstable_transformProfile: "hermes-stable"
|
|
56
|
-
}]],
|
|
57
|
-
plugins: [["babel-plugin-syntax-hermes-parser"],
|
|
58
|
-
// This parser is required for the `@babel/plugin-transform-react-jsx` plugin to work.
|
|
59
|
-
["@react-native/babel-plugin-codegen"],
|
|
60
|
-
// Transforms thing like `export default (codegenNativeComponent<NativeProps>('DebuggingOverlay'));` into `export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);`, we need to do this here since Flow types are required to generate that `__INTERNAL_VIEW_CONFIG`. Without this we'll get warnings/errors like "Codegen didn't run for DebuggingOverlay".
|
|
61
|
-
["@babel/plugin-transform-react-jsx", {
|
|
62
|
-
development
|
|
63
|
-
}], ["@babel/plugin-transform-private-methods", {
|
|
64
|
-
loose: !0
|
|
65
|
-
}]]
|
|
51
|
+
filename: path || "file.js",
|
|
52
|
+
presets: [babelPreset],
|
|
53
|
+
plugins: []
|
|
66
54
|
}, (err, result) => {
|
|
67
55
|
if (!result || err) return rej(err || "no res");
|
|
68
56
|
res(result.code);
|
|
@@ -25,38 +25,21 @@ __export(transformFlowBabel_exports, {
|
|
|
25
25
|
transformFlowBabel: () => transformFlowBabel
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(transformFlowBabel_exports);
|
|
28
|
-
var import_core = __toESM(require("@babel/core"), 1), import_resolve = require("@vxrn/resolve")
|
|
29
|
-
async function transformFlowBabel(input, { development = !1 } = {}) {
|
|
30
|
-
let
|
|
28
|
+
var import_promises = require("node:fs/promises"), import_core = __toESM(require("@babel/core"), 1), import_resolve = require("@vxrn/resolve");
|
|
29
|
+
async function transformFlowBabel(input, { development = !1, path } = {}) {
|
|
30
|
+
let babelPreset = "module:@react-native/babel-preset";
|
|
31
31
|
try {
|
|
32
|
-
const attempt = (0, import_resolve.resolvePath)("
|
|
33
|
-
(await (0, import_promises.stat)(attempt)).isDirectory() && (
|
|
32
|
+
const attempt = (0, import_resolve.resolvePath)("@react-native/babel-preset");
|
|
33
|
+
(await (0, import_promises.stat)(attempt)).isDirectory() && (babelPreset = attempt);
|
|
34
34
|
} catch {
|
|
35
35
|
}
|
|
36
36
|
return await new Promise((res, rej) => {
|
|
37
37
|
import_core.default.transform(
|
|
38
38
|
input,
|
|
39
39
|
{
|
|
40
|
-
filename: "file.js",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
[
|
|
44
|
-
metroPresetPath,
|
|
45
|
-
{
|
|
46
|
-
// To use the `@babel/plugin-transform-react-jsx` plugin for JSX.
|
|
47
|
-
useTransformReactJSXExperimental: !0,
|
|
48
|
-
unstable_transformProfile: "hermes-stable"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
],
|
|
52
|
-
plugins: [
|
|
53
|
-
["babel-plugin-syntax-hermes-parser"],
|
|
54
|
-
// This parser is required for the `@babel/plugin-transform-react-jsx` plugin to work.
|
|
55
|
-
["@react-native/babel-plugin-codegen"],
|
|
56
|
-
// Transforms thing like `export default (codegenNativeComponent<NativeProps>('DebuggingOverlay'));` into `export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);`, we need to do this here since Flow types are required to generate that `__INTERNAL_VIEW_CONFIG`. Without this we'll get warnings/errors like "Codegen didn't run for DebuggingOverlay".
|
|
57
|
-
["@babel/plugin-transform-react-jsx", { development }],
|
|
58
|
-
["@babel/plugin-transform-private-methods", { loose: !0 }]
|
|
59
|
-
]
|
|
40
|
+
filename: path || "file.js",
|
|
41
|
+
presets: [babelPreset],
|
|
42
|
+
plugins: []
|
|
60
43
|
},
|
|
61
44
|
(err, result) => {
|
|
62
45
|
if (!result || err)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/transformFlowBabel.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB,6BACrB,cAAkB,oCAClB,iBAA4B;AAE5B,eAAsB,mBACpB,OACA,EAAE,cAAc,IAAO,KAAK,IAA8C,CAAC,GAC3E;AACA,MAAI,cAAc;AAElB,MAAI;AAGF,UAAM,cAAU,4BAAY,4BAA4B;AACxD,KAAK,UAAM,sBAAK,OAAO,GAAG,YAAY,MACpC,cAAc;AAAA,EAElB,QAAc;AAAA,EAEd;AAEA,SAAO,MAAM,IAAI,QAAgB,CAAC,KAAK,QAAQ;AAC7C,gBAAAA,QAAM;AAAA,MACJ;AAAA,MACA;AAAA,QACE,UAAU,QAAQ;AAAA,QAClB,SAAS,CAAC,WAAW;AAAA,QACrB,SAAS,CAAC;AAAA,MACZ;AAAA,MACA,CAAC,KAAU,WAAW;AACpB,YAAI,CAAC,UAAU;AACb,iBAAO,IAAI,OAAO,QAAQ;AAE5B,YAAI,OAAQ,IAAK;AAAA,MACnB;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
5
5
|
"names": ["babel"]
|
|
6
6
|
}
|
|
@@ -36,36 +36,24 @@ __export(transformFlowBabel_exports, {
|
|
|
36
36
|
transformFlowBabel: () => transformFlowBabel
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(transformFlowBabel_exports);
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
var import_promises = require("fs/promises"),
|
|
40
|
+
import_core = __toESM(require("@babel/core"), 1),
|
|
41
|
+
import_resolve = require("@vxrn/resolve");
|
|
42
42
|
async function transformFlowBabel(input) {
|
|
43
43
|
var {
|
|
44
|
-
development = !1
|
|
44
|
+
development = !1,
|
|
45
|
+
path
|
|
45
46
|
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
46
|
-
|
|
47
|
+
babelPreset = "module:@react-native/babel-preset";
|
|
47
48
|
try {
|
|
48
|
-
var attempt = (0, import_resolve.resolvePath)("
|
|
49
|
-
(await (0, import_promises.stat)(attempt)).isDirectory() && (
|
|
49
|
+
var attempt = (0, import_resolve.resolvePath)("@react-native/babel-preset");
|
|
50
|
+
(await (0, import_promises.stat)(attempt)).isDirectory() && (babelPreset = attempt);
|
|
50
51
|
} catch {}
|
|
51
52
|
return await new Promise(function (res, rej) {
|
|
52
53
|
import_core.default.transform(input, {
|
|
53
|
-
filename: "file.js",
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// To use the `@babel/plugin-transform-react-jsx` plugin for JSX.
|
|
57
|
-
useTransformReactJSXExperimental: !0,
|
|
58
|
-
unstable_transformProfile: "hermes-stable"
|
|
59
|
-
}]],
|
|
60
|
-
plugins: [["babel-plugin-syntax-hermes-parser"],
|
|
61
|
-
// This parser is required for the `@babel/plugin-transform-react-jsx` plugin to work.
|
|
62
|
-
["@react-native/babel-plugin-codegen"],
|
|
63
|
-
// Transforms thing like `export default (codegenNativeComponent<NativeProps>('DebuggingOverlay'));` into `export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);`, we need to do this here since Flow types are required to generate that `__INTERNAL_VIEW_CONFIG`. Without this we'll get warnings/errors like "Codegen didn't run for DebuggingOverlay".
|
|
64
|
-
["@babel/plugin-transform-react-jsx", {
|
|
65
|
-
development
|
|
66
|
-
}], ["@babel/plugin-transform-private-methods", {
|
|
67
|
-
loose: !0
|
|
68
|
-
}]]
|
|
54
|
+
filename: path || "file.js",
|
|
55
|
+
presets: [babelPreset],
|
|
56
|
+
plugins: []
|
|
69
57
|
}, function (err, result) {
|
|
70
58
|
if (!result || err) return rej(err || "no res");
|
|
71
59
|
res(result.code);
|
|
@@ -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","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","err","result","code"],"sources":["../../src/transformFlowBabel.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAqB,CAAAK,0BACrB;AAGA,IAAAK,eAAsB,GAAAC,OAAA,cAElB;EAAAC,WAAc,GAAAC,OAAY,CAAAF,OAC5B;EAAAG,cAAA,GAAAH,OAAA;AACA,eAAIJ,kBAAcA,CAAAQ,KAAA;EAElB,IAAI;MAAAC,WAAA;MAAAC;IAAA,IAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;IAAAE,WAAA;EAGF;IACA,IAAKC,OAAM,OAAAP,cAAA,CAAKQ,WAAU,8BACxB,CAAc;IAElB,OAAc,IAAAZ,eAAA,CAAAa,IAAA,EAAAF,OAAA,GAAAG,WAAA,OAAAJ,WAAA,GAAAC,OAAA;EAEd,SAEA;EACE,iBAAAI,OAAM,WAAAC,GAAA,EAAAC,GAAA;IAAAf,WACJ,CAAAgB,OAAA,CAAAC,SAAA,CAAAd,KAAA;MACAe,QAAA,EAAAb,IAAA;MAAAc,OACE,GACAX,WAAU,CAAW;MAEvBY,OAAA;IAAA,GACC,UAAUC,GAAA,EAAAC,MAAW;MACpB,KAAAA,MAAK,IAAAD,GAAU,EACb,OAAAN,GAAO,CAAAM,GAAI,YAAO;MAEpBP,GAAA,CAAAQ,MAAI,CAAAC,IAAQ;IAAK,EACnB;EAAA,EACF;AAAA","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { createFilter } from "vite";
|
|
2
2
|
import { transformFlowBabel } from "./transformFlowBabel";
|
|
3
|
-
|
|
4
|
-
return await transformFlowBabel(input);
|
|
5
|
-
}
|
|
3
|
+
import { transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel";
|
|
6
4
|
function createFlowPlugin(opts) {
|
|
7
5
|
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0)
|
|
8
6
|
return;
|
|
@@ -11,12 +9,12 @@ function createFlowPlugin(opts) {
|
|
|
11
9
|
name: "@vxrn/vite-flow",
|
|
12
10
|
enforce: "pre",
|
|
13
11
|
transform(code, id) {
|
|
14
|
-
return filter(id) ?
|
|
12
|
+
return filter(id) ? transformFlowBabel(code) : null;
|
|
15
13
|
}
|
|
16
14
|
};
|
|
17
15
|
}
|
|
18
16
|
export {
|
|
19
17
|
createFlowPlugin as default,
|
|
20
|
-
|
|
18
|
+
transformFlowBabel2 as transformFlowBabel
|
|
21
19
|
};
|
|
22
20
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "AACA,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AAEnC,
|
|
5
|
-
"names": []
|
|
4
|
+
"mappings": "AACA,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AAEnC,SAAS,sBAAAA,2BAA0B;AAOpB,SAAR,iBAAkC,MAA8B;AACrE,MAAI,CAAC,MAAM,WAAY,MAAM,QAAQ,KAAK,OAAO,KAAK,KAAK,QAAQ,WAAW;AAC5E;AAGF,QAAM,SAAS,aAAa,MAAM,SAAS,MAAM,OAAO;AAExD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU,MAAM,IAAI;AAClB,aAAI,OAAO,EAAE,IACJ,mBAAmB,IAAI,IAEzB;AAAA,IACT;AAAA,EACF;AACF;",
|
|
5
|
+
"names": ["transformFlowBabel"]
|
|
6
6
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { createFilter } from "vite";
|
|
2
2
|
import { transformFlowBabel } from "./transformFlowBabel.mjs";
|
|
3
|
-
|
|
4
|
-
development = !1
|
|
5
|
-
} = {}) {
|
|
6
|
-
return await transformFlowBabel(input);
|
|
7
|
-
}
|
|
3
|
+
import { transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.mjs";
|
|
8
4
|
function createFlowPlugin(opts) {
|
|
9
5
|
if (!opts?.include || Array.isArray(opts.include) && opts.include.length === 0) return;
|
|
10
6
|
const filter = createFilter(opts?.include, opts?.exclude);
|
|
@@ -12,9 +8,9 @@ function createFlowPlugin(opts) {
|
|
|
12
8
|
name: "@vxrn/vite-flow",
|
|
13
9
|
enforce: "pre",
|
|
14
10
|
transform(code, id) {
|
|
15
|
-
return filter(id) ?
|
|
11
|
+
return filter(id) ? transformFlowBabel(code) : null;
|
|
16
12
|
}
|
|
17
13
|
};
|
|
18
14
|
}
|
|
19
|
-
export { createFlowPlugin as default,
|
|
15
|
+
export { createFlowPlugin as default, transformFlowBabel2 as transformFlowBabel };
|
|
20
16
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFilter","transformFlowBabel","
|
|
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,GAC5E;EAGF,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,OAAIN,MAAA,CAAOM,EAAE,IACJd,kBAAA,CAAmBa,IAAI,IAEzB;IACT;EACF;AACF","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { createFilter } from "vite";
|
|
2
2
|
import { transformFlowBabel } from "./transformFlowBabel.native.js";
|
|
3
|
-
|
|
4
|
-
var {
|
|
5
|
-
development = !1
|
|
6
|
-
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
7
|
-
final = await transformFlowBabel(input);
|
|
8
|
-
return final;
|
|
9
|
-
}
|
|
3
|
+
import { transformFlowBabel as transformFlowBabel2 } from "./transformFlowBabel.native.js";
|
|
10
4
|
function createFlowPlugin(opts) {
|
|
11
5
|
if (!(!opts?.include || Array.isArray(opts.include) && opts.include.length === 0)) {
|
|
12
6
|
var filter = createFilter(opts?.include, opts?.exclude);
|
|
@@ -14,10 +8,10 @@ function createFlowPlugin(opts) {
|
|
|
14
8
|
name: "@vxrn/vite-flow",
|
|
15
9
|
enforce: "pre",
|
|
16
10
|
transform(code, id) {
|
|
17
|
-
return filter(id) ?
|
|
11
|
+
return filter(id) ? transformFlowBabel(code) : null;
|
|
18
12
|
}
|
|
19
13
|
};
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
|
-
export { createFlowPlugin as default,
|
|
16
|
+
export { createFlowPlugin as default, transformFlowBabel2 as transformFlowBabel };
|
|
23
17
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFilter","transformFlowBabel","
|
|
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,EAAC,CAAAA,IAAM,EAAAC,OAAA,IAAYC,KAAM,CAAAC,OAAQ,CAAAH,IAAK,CAAAC,OAAO,KAAKD,IAAK,CAAAC,OAAQ,CAAAG,MAAA,KAAW;IAC5E,IAAAC,MAAA,GAAAT,YAAA,CAAAI,IAAA,EAAAC,OAAA,EAAAD,IAAA,EAAAM,OAAA;IAGF,OAAM;MAENC,IAAO;MACLC,OAAM;MACNC,SAASA,CAAAC,IAAA,EAAAC,EAAA;QACT,OAAUN,MAAM,CAAAM,EAAI,IAAAd,kBAAA,CAAAa,IAAA;MAClB;IAIF;EACF;AACF","ignoreList":[]}
|
|
@@ -1,37 +1,20 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
1
2
|
import babel from "@babel/core";
|
|
2
3
|
import { resolvePath } from "@vxrn/resolve";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let metroPresetPath = "module:metro-react-native-babel-preset";
|
|
4
|
+
async function transformFlowBabel(input, { development = !1, path } = {}) {
|
|
5
|
+
let babelPreset = "module:@react-native/babel-preset";
|
|
6
6
|
try {
|
|
7
|
-
const attempt = resolvePath("
|
|
8
|
-
(await stat(attempt)).isDirectory() && (
|
|
7
|
+
const attempt = resolvePath("@react-native/babel-preset");
|
|
8
|
+
(await stat(attempt)).isDirectory() && (babelPreset = attempt);
|
|
9
9
|
} catch {
|
|
10
10
|
}
|
|
11
11
|
return await new Promise((res, rej) => {
|
|
12
12
|
babel.transform(
|
|
13
13
|
input,
|
|
14
14
|
{
|
|
15
|
-
filename: "file.js",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
[
|
|
19
|
-
metroPresetPath,
|
|
20
|
-
{
|
|
21
|
-
// To use the `@babel/plugin-transform-react-jsx` plugin for JSX.
|
|
22
|
-
useTransformReactJSXExperimental: !0,
|
|
23
|
-
unstable_transformProfile: "hermes-stable"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
],
|
|
27
|
-
plugins: [
|
|
28
|
-
["babel-plugin-syntax-hermes-parser"],
|
|
29
|
-
// This parser is required for the `@babel/plugin-transform-react-jsx` plugin to work.
|
|
30
|
-
["@react-native/babel-plugin-codegen"],
|
|
31
|
-
// Transforms thing like `export default (codegenNativeComponent<NativeProps>('DebuggingOverlay'));` into `export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);`, we need to do this here since Flow types are required to generate that `__INTERNAL_VIEW_CONFIG`. Without this we'll get warnings/errors like "Codegen didn't run for DebuggingOverlay".
|
|
32
|
-
["@babel/plugin-transform-react-jsx", { development }],
|
|
33
|
-
["@babel/plugin-transform-private-methods", { loose: !0 }]
|
|
34
|
-
]
|
|
15
|
+
filename: path || "file.js",
|
|
16
|
+
presets: [babelPreset],
|
|
17
|
+
plugins: []
|
|
35
18
|
},
|
|
36
19
|
(err, result) => {
|
|
37
20
|
if (!result || err)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/transformFlowBabel.ts"],
|
|
4
|
-
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,mBAAmB;
|
|
4
|
+
"mappings": "AAAA,SAAS,YAAY;AACrB,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAE5B,eAAsB,mBACpB,OACA,EAAE,cAAc,IAAO,KAAK,IAA8C,CAAC,GAC3E;AACA,MAAI,cAAc;AAElB,MAAI;AAGF,UAAM,UAAU,YAAY,4BAA4B;AACxD,KAAK,MAAM,KAAK,OAAO,GAAG,YAAY,MACpC,cAAc;AAAA,EAElB,QAAc;AAAA,EAEd;AAEA,SAAO,MAAM,IAAI,QAAgB,CAAC,KAAK,QAAQ;AAC7C,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,QACE,UAAU,QAAQ;AAAA,QAClB,SAAS,CAAC,WAAW;AAAA,QACrB,SAAS,CAAC;AAAA,MACZ;AAAA,MACA,CAAC,KAAU,WAAW;AACpB,YAAI,CAAC,UAAU;AACb,iBAAO,IAAI,OAAO,QAAQ;AAE5B,YAAI,OAAQ,IAAK;AAAA,MACnB;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,32 +1,20 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
1
2
|
import babel from "@babel/core";
|
|
2
3
|
import { resolvePath } from "@vxrn/resolve";
|
|
3
|
-
import { stat } from "node:fs/promises";
|
|
4
4
|
async function transformFlowBabel(input, {
|
|
5
|
-
development = !1
|
|
5
|
+
development = !1,
|
|
6
|
+
path
|
|
6
7
|
} = {}) {
|
|
7
|
-
let
|
|
8
|
+
let babelPreset = "module:@react-native/babel-preset";
|
|
8
9
|
try {
|
|
9
|
-
const attempt = resolvePath("
|
|
10
|
-
(await stat(attempt)).isDirectory() && (
|
|
10
|
+
const attempt = resolvePath("@react-native/babel-preset");
|
|
11
|
+
(await stat(attempt)).isDirectory() && (babelPreset = attempt);
|
|
11
12
|
} catch {}
|
|
12
13
|
return await new Promise((res, rej) => {
|
|
13
14
|
babel.transform(input, {
|
|
14
|
-
filename: "file.js",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// To use the `@babel/plugin-transform-react-jsx` plugin for JSX.
|
|
18
|
-
useTransformReactJSXExperimental: !0,
|
|
19
|
-
unstable_transformProfile: "hermes-stable"
|
|
20
|
-
}]],
|
|
21
|
-
plugins: [["babel-plugin-syntax-hermes-parser"],
|
|
22
|
-
// This parser is required for the `@babel/plugin-transform-react-jsx` plugin to work.
|
|
23
|
-
["@react-native/babel-plugin-codegen"],
|
|
24
|
-
// Transforms thing like `export default (codegenNativeComponent<NativeProps>('DebuggingOverlay'));` into `export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);`, we need to do this here since Flow types are required to generate that `__INTERNAL_VIEW_CONFIG`. Without this we'll get warnings/errors like "Codegen didn't run for DebuggingOverlay".
|
|
25
|
-
["@babel/plugin-transform-react-jsx", {
|
|
26
|
-
development
|
|
27
|
-
}], ["@babel/plugin-transform-private-methods", {
|
|
28
|
-
loose: !0
|
|
29
|
-
}]]
|
|
15
|
+
filename: path || "file.js",
|
|
16
|
+
presets: [babelPreset],
|
|
17
|
+
plugins: []
|
|
30
18
|
}, (err, result) => {
|
|
31
19
|
if (!result || err) return rej(err || "no res");
|
|
32
20
|
res(result.code);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["stat","babel","resolvePath","transformFlowBabel","input","development","path","babelPreset","attempt","isDirectory","Promise","res","rej","transform","filename","presets","plugins","err","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,CAAK,MAAMF,IAAA,CAAKQ,OAAO,GAAGC,WAAA,CAAY,MACpCF,WAAA,GAAcC,OAAA;EAElB,QAAc,CAEd;EAEA,OAAO,MAAM,IAAIE,OAAA,CAAgB,CAACC,GAAA,EAAKC,GAAA,KAAQ;IAC7CX,KAAA,CAAMY,SAAA,CACJT,KAAA,EACA;MACEU,QAAA,EAAUR,IAAA,IAAQ;MAClBS,OAAA,EAAS,CAACR,WAAW;MACrBS,OAAA,EAAS;IACX,GACA,CAACC,GAAA,EAAUC,MAAA,KAAW;MACpB,IAAI,CAACA,MAAA,IAAUD,GAAA,EACb,OAAOL,GAAA,CAAIK,GAAA,IAAO,QAAQ;MAE5BN,GAAA,CAAIO,MAAA,CAAQC,IAAK;IACnB,CACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,33 +1,21 @@
|
|
|
1
|
+
import { stat } from "fs/promises";
|
|
1
2
|
import babel from "@babel/core";
|
|
2
3
|
import { resolvePath } from "@vxrn/resolve";
|
|
3
|
-
import { stat } from "fs/promises";
|
|
4
4
|
async function transformFlowBabel(input) {
|
|
5
5
|
var {
|
|
6
|
-
development = !1
|
|
6
|
+
development = !1,
|
|
7
|
+
path
|
|
7
8
|
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
8
|
-
|
|
9
|
+
babelPreset = "module:@react-native/babel-preset";
|
|
9
10
|
try {
|
|
10
|
-
var attempt = resolvePath("
|
|
11
|
-
(await stat(attempt)).isDirectory() && (
|
|
11
|
+
var attempt = resolvePath("@react-native/babel-preset");
|
|
12
|
+
(await stat(attempt)).isDirectory() && (babelPreset = attempt);
|
|
12
13
|
} catch {}
|
|
13
14
|
return await new Promise(function (res, rej) {
|
|
14
15
|
babel.transform(input, {
|
|
15
|
-
filename: "file.js",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// To use the `@babel/plugin-transform-react-jsx` plugin for JSX.
|
|
19
|
-
useTransformReactJSXExperimental: !0,
|
|
20
|
-
unstable_transformProfile: "hermes-stable"
|
|
21
|
-
}]],
|
|
22
|
-
plugins: [["babel-plugin-syntax-hermes-parser"],
|
|
23
|
-
// This parser is required for the `@babel/plugin-transform-react-jsx` plugin to work.
|
|
24
|
-
["@react-native/babel-plugin-codegen"],
|
|
25
|
-
// Transforms thing like `export default (codegenNativeComponent<NativeProps>('DebuggingOverlay'));` into `export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);`, we need to do this here since Flow types are required to generate that `__INTERNAL_VIEW_CONFIG`. Without this we'll get warnings/errors like "Codegen didn't run for DebuggingOverlay".
|
|
26
|
-
["@babel/plugin-transform-react-jsx", {
|
|
27
|
-
development
|
|
28
|
-
}], ["@babel/plugin-transform-private-methods", {
|
|
29
|
-
loose: !0
|
|
30
|
-
}]]
|
|
16
|
+
filename: path || "file.js",
|
|
17
|
+
presets: [babelPreset],
|
|
18
|
+
plugins: []
|
|
31
19
|
}, function (err, result) {
|
|
32
20
|
if (!result || err) return rej(err || "no res");
|
|
33
21
|
res(result.code);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["stat","babel","resolvePath","transformFlowBabel","input","development","path","arguments","length","babelPreset","attempt","isDirectory","Promise","res","rej","transform","filename","presets","plugins","err","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;MAAAC,WAAA,GAAc;MAAAC;IAAA,IAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;IAAAE,WAAA;EAElB,IAAI;IAGF,IAAAC,OAAM,GAAAR,WAAU,6BAAY;IAC5B,CAAK,MAAMF,IAAA,CAAKU,OAAO,GAAGC,WAAA,CAAY,MACpCF,WAAA,GAAcC,OAAA;EAElB,QAAc,CAEd;EAEA,OAAO,MAAM,IAAIE,OAAA,CAAgB,UAAMC,GAAA,EAAQC,GAAA;IAC7Cb,KAAA,CAAMc,SAAA,CAAAX,KAAA;MACJY,QAAA,EAAAV,IAAA;MACAW,OAAA,GACER,WAAU,CAAQ;MACGS,OACrB;IAAU,GACZ,UAAAC,GAAA,EAAAC,MAAA;MACA,IAAC,CAAAA,MAAU,IAAAD,GAAW,EACpB,OAAKL,GAAA,CAAAK,GAAA,IAAU;MACbN,GAAA,CAAAO,MAAA,CAAOC,IAAI;IAEb;EAAiB;AACnB;AACF,SAEJlB,kBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/vite-flow",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -29,17 +29,13 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/core": "^7.28.5",
|
|
31
31
|
"@babel/helper-plugin-utils": "^7.27.1",
|
|
32
|
-
"@babel
|
|
33
|
-
"@
|
|
34
|
-
"@vxrn/resolve": "1.1.547",
|
|
35
|
-
"babel-plugin-syntax-hermes-parser": "^0.25.1",
|
|
36
|
-
"flow-remove-types": "^2.247.1",
|
|
37
|
-
"metro-react-native-babel-preset": "^0.77.0",
|
|
32
|
+
"@react-native/babel-preset": "^0.82.1",
|
|
33
|
+
"@vxrn/resolve": "1.2.1",
|
|
38
34
|
"vite": "^7.1.12"
|
|
39
35
|
},
|
|
40
36
|
"devDependencies": {
|
|
41
|
-
"@biomejs/biome": "
|
|
42
|
-
"@tamagui/build": "^1.
|
|
37
|
+
"@biomejs/biome": "2.3.3",
|
|
38
|
+
"@tamagui/build": "^1.136.1"
|
|
43
39
|
},
|
|
44
40
|
"publishConfig": {
|
|
45
41
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -2,14 +2,7 @@ import type { FilterPattern, PluginOption } from 'vite'
|
|
|
2
2
|
import { createFilter } from 'vite'
|
|
3
3
|
import { transformFlowBabel } from './transformFlowBabel'
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
input: string,
|
|
7
|
-
{ development = false }: { development?: boolean } = {}
|
|
8
|
-
) {
|
|
9
|
-
const final = await transformFlowBabel(input)
|
|
10
|
-
|
|
11
|
-
return final
|
|
12
|
-
}
|
|
5
|
+
export { transformFlowBabel } from './transformFlowBabel'
|
|
13
6
|
|
|
14
7
|
export type Options = {
|
|
15
8
|
include?: FilterPattern
|
|
@@ -28,7 +21,7 @@ export default function createFlowPlugin(opts?: Options): PluginOption {
|
|
|
28
21
|
enforce: 'pre',
|
|
29
22
|
transform(code, id) {
|
|
30
23
|
if (filter(id)) {
|
|
31
|
-
return
|
|
24
|
+
return transformFlowBabel(code)
|
|
32
25
|
}
|
|
33
26
|
return null
|
|
34
27
|
},
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
import { stat } from 'node:fs/promises'
|
|
1
2
|
import babel from '@babel/core'
|
|
2
3
|
import { resolvePath } from '@vxrn/resolve'
|
|
3
|
-
import { stat } from 'node:fs/promises'
|
|
4
4
|
|
|
5
5
|
export async function transformFlowBabel(
|
|
6
6
|
input: string,
|
|
7
|
-
{ development = false }: { development?: boolean } = {}
|
|
7
|
+
{ development = false, path }: { development?: boolean; path?: string } = {}
|
|
8
8
|
) {
|
|
9
|
-
let
|
|
9
|
+
let babelPreset = 'module:@react-native/babel-preset'
|
|
10
10
|
|
|
11
11
|
try {
|
|
12
12
|
// the above doesn't work in some monorepos so lets try resolving it specifically ourselves
|
|
13
13
|
// has to be relative to this package as it is installed below it
|
|
14
|
-
const attempt = resolvePath('
|
|
14
|
+
const attempt = resolvePath('@react-native/babel-preset')
|
|
15
15
|
if ((await stat(attempt)).isDirectory()) {
|
|
16
|
-
|
|
16
|
+
babelPreset = attempt
|
|
17
17
|
}
|
|
18
18
|
} catch (err) {
|
|
19
19
|
// fallback to original
|
|
@@ -23,23 +23,9 @@ export async function transformFlowBabel(
|
|
|
23
23
|
babel.transform(
|
|
24
24
|
input,
|
|
25
25
|
{
|
|
26
|
-
filename: 'file.js',
|
|
27
|
-
presets: [
|
|
28
|
-
|
|
29
|
-
metroPresetPath,
|
|
30
|
-
{
|
|
31
|
-
// To use the `@babel/plugin-transform-react-jsx` plugin for JSX.
|
|
32
|
-
useTransformReactJSXExperimental: true,
|
|
33
|
-
unstable_transformProfile: 'hermes-stable',
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
],
|
|
37
|
-
plugins: [
|
|
38
|
-
['babel-plugin-syntax-hermes-parser'], // This parser is required for the `@babel/plugin-transform-react-jsx` plugin to work.
|
|
39
|
-
['@react-native/babel-plugin-codegen'], // Transforms thing like `export default (codegenNativeComponent<NativeProps>('DebuggingOverlay'));` into `export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);`, we need to do this here since Flow types are required to generate that `__INTERNAL_VIEW_CONFIG`. Without this we'll get warnings/errors like "Codegen didn't run for DebuggingOverlay".
|
|
40
|
-
['@babel/plugin-transform-react-jsx', { development }],
|
|
41
|
-
['@babel/plugin-transform-private-methods', { loose: true }],
|
|
42
|
-
],
|
|
26
|
+
filename: path || 'file.js',
|
|
27
|
+
presets: [babelPreset],
|
|
28
|
+
plugins: [],
|
|
43
29
|
},
|
|
44
30
|
(err: any, result) => {
|
|
45
31
|
if (!result || err) {
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { FilterPattern, PluginOption } from 'vite';
|
|
2
|
-
export
|
|
3
|
-
development?: boolean;
|
|
4
|
-
}): Promise<string>;
|
|
2
|
+
export { transformFlowBabel } from './transformFlowBabel';
|
|
5
3
|
export type Options = {
|
|
6
4
|
include?: FilterPattern;
|
|
7
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,
|
|
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;AAEzD,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,5 @@
|
|
|
1
|
-
export declare function transformFlowBabel(input: string, { development }?: {
|
|
1
|
+
export declare function transformFlowBabel(input: string, { development, path }?: {
|
|
2
2
|
development?: boolean;
|
|
3
|
+
path?: string;
|
|
3
4
|
}): Promise<string>;
|
|
4
5
|
//# sourceMappingURL=transformFlowBabel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformFlowBabel.d.ts","sourceRoot":"","sources":["../src/transformFlowBabel.ts"],"names":[],"mappings":"AAIA,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,EAAE,WAAmB,EAAE,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,
|
|
1
|
+
{"version":3,"file":"transformFlowBabel.d.ts","sourceRoot":"","sources":["../src/transformFlowBabel.ts"],"names":[],"mappings":"AAIA,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,EAAE,WAAmB,EAAE,IAAI,EAAE,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,mBA+B7E"}
|