@vxrn/compiler 1.1.397

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.
Files changed (98) hide show
  1. package/LICENSE +45 -0
  2. package/dist/cjs/configure.cjs +34 -0
  3. package/dist/cjs/configure.js +29 -0
  4. package/dist/cjs/configure.js.map +6 -0
  5. package/dist/cjs/configure.native.js +35 -0
  6. package/dist/cjs/configure.native.js.map +6 -0
  7. package/dist/cjs/constants.cjs +65 -0
  8. package/dist/cjs/constants.js +34 -0
  9. package/dist/cjs/constants.js.map +6 -0
  10. package/dist/cjs/constants.native.js +65 -0
  11. package/dist/cjs/constants.native.js.map +6 -0
  12. package/dist/cjs/index.cjs +124 -0
  13. package/dist/cjs/index.js +113 -0
  14. package/dist/cjs/index.js.map +6 -0
  15. package/dist/cjs/index.native.js +123 -0
  16. package/dist/cjs/index.native.js.map +6 -0
  17. package/dist/cjs/refresh-runtime.cjs +295 -0
  18. package/dist/cjs/refresh-runtime.js +296 -0
  19. package/dist/cjs/refresh-runtime.js.map +6 -0
  20. package/dist/cjs/refresh-runtime.native.js +316 -0
  21. package/dist/cjs/refresh-runtime.native.js.map +6 -0
  22. package/dist/cjs/transformBabel.cjs +111 -0
  23. package/dist/cjs/transformBabel.js +116 -0
  24. package/dist/cjs/transformBabel.js.map +6 -0
  25. package/dist/cjs/transformBabel.native.js +152 -0
  26. package/dist/cjs/transformBabel.native.js.map +6 -0
  27. package/dist/cjs/transformSWC.cjs +261 -0
  28. package/dist/cjs/transformSWC.js +256 -0
  29. package/dist/cjs/transformSWC.js.map +6 -0
  30. package/dist/cjs/transformSWC.native.js +275 -0
  31. package/dist/cjs/transformSWC.native.js.map +6 -0
  32. package/dist/cjs/types.cjs +16 -0
  33. package/dist/cjs/types.js +14 -0
  34. package/dist/cjs/types.js.map +6 -0
  35. package/dist/cjs/types.native.js +15 -0
  36. package/dist/cjs/types.native.js.map +6 -0
  37. package/dist/esm/configure.js +13 -0
  38. package/dist/esm/configure.js.map +6 -0
  39. package/dist/esm/configure.mjs +10 -0
  40. package/dist/esm/configure.mjs.map +1 -0
  41. package/dist/esm/configure.native.js +13 -0
  42. package/dist/esm/configure.native.js.map +6 -0
  43. package/dist/esm/constants.js +18 -0
  44. package/dist/esm/constants.js.map +6 -0
  45. package/dist/esm/constants.mjs +38 -0
  46. package/dist/esm/constants.mjs.map +1 -0
  47. package/dist/esm/constants.native.js +41 -0
  48. package/dist/esm/constants.native.js.map +6 -0
  49. package/dist/esm/index.js +102 -0
  50. package/dist/esm/index.js.map +6 -0
  51. package/dist/esm/index.mjs +99 -0
  52. package/dist/esm/index.mjs.map +1 -0
  53. package/dist/esm/index.native.js +104 -0
  54. package/dist/esm/index.native.js.map +6 -0
  55. package/dist/esm/refresh-runtime.js +280 -0
  56. package/dist/esm/refresh-runtime.js.map +6 -0
  57. package/dist/esm/refresh-runtime.mjs +266 -0
  58. package/dist/esm/refresh-runtime.mjs.map +1 -0
  59. package/dist/esm/refresh-runtime.native.js +290 -0
  60. package/dist/esm/refresh-runtime.native.js.map +6 -0
  61. package/dist/esm/transformBabel.js +95 -0
  62. package/dist/esm/transformBabel.js.map +6 -0
  63. package/dist/esm/transformBabel.mjs +76 -0
  64. package/dist/esm/transformBabel.mjs.map +1 -0
  65. package/dist/esm/transformBabel.native.js +125 -0
  66. package/dist/esm/transformBabel.native.js.map +6 -0
  67. package/dist/esm/transformSWC.js +246 -0
  68. package/dist/esm/transformSWC.js.map +6 -0
  69. package/dist/esm/transformSWC.mjs +237 -0
  70. package/dist/esm/transformSWC.mjs.map +1 -0
  71. package/dist/esm/transformSWC.native.js +257 -0
  72. package/dist/esm/transformSWC.native.js.map +6 -0
  73. package/dist/esm/types.js +1 -0
  74. package/dist/esm/types.js.map +6 -0
  75. package/dist/esm/types.mjs +2 -0
  76. package/dist/esm/types.mjs.map +1 -0
  77. package/dist/esm/types.native.js +1 -0
  78. package/dist/esm/types.native.js.map +6 -0
  79. package/package.json +54 -0
  80. package/src/configure.ts +17 -0
  81. package/src/constants.ts +21 -0
  82. package/src/index.ts +166 -0
  83. package/src/refresh-runtime.js +619 -0
  84. package/src/transformBabel.ts +218 -0
  85. package/src/transformSWC.ts +381 -0
  86. package/src/types.ts +36 -0
  87. package/types/configure.d.ts +10 -0
  88. package/types/configure.d.ts.map +1 -0
  89. package/types/constants.d.ts +9 -0
  90. package/types/constants.d.ts.map +1 -0
  91. package/types/index.d.ts +12 -0
  92. package/types/index.d.ts.map +1 -0
  93. package/types/transformBabel.d.ts +12 -0
  94. package/types/transformBabel.d.ts.map +1 -0
  95. package/types/transformSWC.d.ts +7 -0
  96. package/types/transformSWC.d.ts.map +1 -0
  97. package/types/types.d.ts +29 -0
  98. package/types/types.d.ts.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,45 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Callstack
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ MIT License
26
+
27
+ Copyright (c) Arnaud Barré (https://github.com/ArnaudBarre)
28
+
29
+ Permission is hereby granted, free of charge, to any person obtaining a copy
30
+ of this software and associated documentation files (the "Software"), to deal
31
+ in the Software without restriction, including without limitation the rights
32
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33
+ copies of the Software, and to permit persons to whom the Software is
34
+ furnished to do so, subject to the following conditions:
35
+
36
+ The above copyright notice and this permission notice shall be included in all
37
+ copies or substantial portions of the Software.
38
+
39
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45
+ SOFTWARE.
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var configure_exports = {};
22
+ __export(configure_exports, {
23
+ configuration: () => configuration,
24
+ configureVXRNCompilerPlugin: () => configureVXRNCompilerPlugin
25
+ });
26
+ module.exports = __toCommonJS(configure_exports);
27
+ const configuration = {
28
+ enableReanimated: !1,
29
+ enableCompiler: !1,
30
+ enableNativeCSS: !1
31
+ };
32
+ function configureVXRNCompilerPlugin(_) {
33
+ Object.assign(configuration, _);
34
+ }
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var configure_exports = {};
16
+ __export(configure_exports, {
17
+ configuration: () => configuration,
18
+ configureVXRNCompilerPlugin: () => configureVXRNCompilerPlugin
19
+ });
20
+ module.exports = __toCommonJS(configure_exports);
21
+ const configuration = {
22
+ enableReanimated: !1,
23
+ enableCompiler: !1,
24
+ enableNativeCSS: !1
25
+ };
26
+ function configureVXRNCompilerPlugin(_) {
27
+ Object.assign(configuration, _);
28
+ }
29
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/configure.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,MAAM,gBAAsB;AAAA,EACjC,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,iBAAiB;AACnB;AAEO,SAAS,4BAA4B,GAAS;AACnD,SAAO,OAAO,eAAe,CAAC;AAChC;",
5
+ "names": []
6
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var configure_exports = {};
17
+ __export(configure_exports, {
18
+ configuration: () => configuration,
19
+ configureVXRNCompilerPlugin: () => configureVXRNCompilerPlugin
20
+ });
21
+ module.exports = __toCommonJS(configure_exports);
22
+ var configuration = {
23
+ enableReanimated: !1,
24
+ enableCompiler: !1,
25
+ enableNativeCSS: !1
26
+ };
27
+ function configureVXRNCompilerPlugin(_) {
28
+ Object.assign(configuration, _);
29
+ }
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ configuration,
33
+ configureVXRNCompilerPlugin
34
+ });
35
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/one/packages/compiler/src/configure.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAQA;;;;;;AAAO,IAAMA,gBAAsB;EACjCC,kBAAkB;EAClBC,gBAAgB;EAChBC,iBAAiB;AACnB;AAEO,SAASC,4BAA4BC,GAAO;AACjDC,SAAOC,OAAOP,eAAeK,CAAAA;AAC/B;",
5
+ "names": ["configuration", "enableReanimated", "enableCompiler", "enableNativeCSS", "configureVXRNCompilerPlugin", "_", "Object", "assign"]
6
+ }
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var constants_exports = {};
22
+ __export(constants_exports, {
23
+ asyncGeneratorRegex: () => asyncGeneratorRegex,
24
+ debug: () => debug,
25
+ parsers: () => parsers,
26
+ runtimePublicPath: () => runtimePublicPath,
27
+ validParsers: () => validParsers
28
+ });
29
+ module.exports = __toCommonJS(constants_exports);
30
+ var import_utils = require("@vxrn/utils");
31
+ const {
32
+ debug
33
+ } = (0, import_utils.createDebugger)("vxrn:compiler-plugin"),
34
+ runtimePublicPath = "/@react-refresh",
35
+ asyncGeneratorRegex = /(async \*|async function\*|for await)/,
36
+ parsers = {
37
+ ".tsx": {
38
+ syntax: "typescript",
39
+ tsx: !0,
40
+ decorators: !0
41
+ },
42
+ ".ts": {
43
+ syntax: "typescript",
44
+ tsx: !1,
45
+ decorators: !0
46
+ },
47
+ ".jsx": {
48
+ syntax: "ecmascript",
49
+ jsx: !0
50
+ },
51
+ ".js": {
52
+ syntax: "ecmascript"
53
+ },
54
+ ".mjs": {
55
+ syntax: "ecmascript"
56
+ },
57
+ ".cjs": {
58
+ syntax: "ecmascript"
59
+ },
60
+ ".mdx": {
61
+ syntax: "ecmascript",
62
+ jsx: !0
63
+ }
64
+ },
65
+ validParsers = /* @__PURE__ */new Set([...Object.keys(parsers), ".css"]);
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var constants_exports = {};
16
+ __export(constants_exports, {
17
+ asyncGeneratorRegex: () => asyncGeneratorRegex,
18
+ debug: () => debug,
19
+ parsers: () => parsers,
20
+ runtimePublicPath: () => runtimePublicPath,
21
+ validParsers: () => validParsers
22
+ });
23
+ module.exports = __toCommonJS(constants_exports);
24
+ var import_utils = require("@vxrn/utils");
25
+ const { debug } = (0, import_utils.createDebugger)("vxrn:compiler-plugin"), runtimePublicPath = "/@react-refresh", asyncGeneratorRegex = /(async \*|async function\*|for await)/, parsers = {
26
+ ".tsx": { syntax: "typescript", tsx: !0, decorators: !0 },
27
+ ".ts": { syntax: "typescript", tsx: !1, decorators: !0 },
28
+ ".jsx": { syntax: "ecmascript", jsx: !0 },
29
+ ".js": { syntax: "ecmascript" },
30
+ ".mjs": { syntax: "ecmascript" },
31
+ ".cjs": { syntax: "ecmascript" },
32
+ ".mdx": { syntax: "ecmascript", jsx: !0 }
33
+ }, validParsers = /* @__PURE__ */ new Set([...Object.keys(parsers), ".css"]);
34
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/constants.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA+B;AAExB,MAAM,EAAE,MAAM,QAAI,6BAAe,sBAAsB,GAEjD,oBAAoB,mBAEpB,sBAAsB,yCAEtB,UAAwC;AAAA,EACnD,QAAQ,EAAE,QAAQ,cAAc,KAAK,IAAM,YAAY,GAAK;AAAA,EAC5D,OAAO,EAAE,QAAQ,cAAc,KAAK,IAAO,YAAY,GAAK;AAAA,EAC5D,QAAQ,EAAE,QAAQ,cAAc,KAAK,GAAK;AAAA,EAC1C,OAAO,EAAE,QAAQ,aAAa;AAAA,EAC9B,QAAQ,EAAE,QAAQ,aAAa;AAAA,EAC/B,QAAQ,EAAE,QAAQ,aAAa;AAAA,EAC/B,QAAQ,EAAE,QAAQ,cAAc,KAAK,GAAK;AAC5C,GAEa,eAAe,oBAAI,IAAI,CAAC,GAAG,OAAO,KAAK,OAAO,GAAG,MAAM,CAAC;",
5
+ "names": []
6
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var constants_exports = {};
17
+ __export(constants_exports, {
18
+ asyncGeneratorRegex: () => asyncGeneratorRegex,
19
+ debug: () => debug,
20
+ parsers: () => parsers,
21
+ runtimePublicPath: () => runtimePublicPath,
22
+ validParsers: () => validParsers
23
+ });
24
+ module.exports = __toCommonJS(constants_exports);
25
+ var import_utils = require("@vxrn/utils"), { debug } = (0, import_utils.createDebugger)("vxrn:compiler-plugin"), runtimePublicPath = "/@react-refresh", asyncGeneratorRegex = /(async \*|async function\*|for await)/, parsers = {
26
+ ".tsx": {
27
+ syntax: "typescript",
28
+ tsx: !0,
29
+ decorators: !0
30
+ },
31
+ ".ts": {
32
+ syntax: "typescript",
33
+ tsx: !1,
34
+ decorators: !0
35
+ },
36
+ ".jsx": {
37
+ syntax: "ecmascript",
38
+ jsx: !0
39
+ },
40
+ ".js": {
41
+ syntax: "ecmascript"
42
+ },
43
+ ".mjs": {
44
+ syntax: "ecmascript"
45
+ },
46
+ ".cjs": {
47
+ syntax: "ecmascript"
48
+ },
49
+ ".mdx": {
50
+ syntax: "ecmascript",
51
+ jsx: !0
52
+ }
53
+ }, validParsers = /* @__PURE__ */ new Set([
54
+ ...Object.keys(parsers),
55
+ ".css"
56
+ ]);
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ asyncGeneratorRegex,
60
+ debug,
61
+ parsers,
62
+ runtimePublicPath,
63
+ validParsers
64
+ });
65
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/one/packages/compiler/src/constants.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;AAEA;;;;;;;;;mBAA+B,wBAElB,EAAEA,MAAK,QAAKC,6BAAe,sBAAA,GAE3BC,oBAAoB,mBAEpBC,sBAAsB,yCAEtBC,UAAwC;EACnD,QAAQ;IAAEC,QAAQ;IAAcC,KAAK;IAAMC,YAAY;EAAK;EAC5D,OAAO;IAAEF,QAAQ;IAAcC,KAAK;IAAOC,YAAY;EAAK;EAC5D,QAAQ;IAAEF,QAAQ;IAAcG,KAAK;EAAK;EAC1C,OAAO;IAAEH,QAAQ;EAAa;EAC9B,QAAQ;IAAEA,QAAQ;EAAa;EAC/B,QAAQ;IAAEA,QAAQ;EAAa;EAC/B,QAAQ;IAAEA,QAAQ;IAAcG,KAAK;EAAK;AAC5C,GAEaC,eAAe,oBAAIC,IAAI;KAAIC,OAAOC,KAAKR,OAAAA;EAAU;CAAO;",
5
+ "names": ["debug", "createDebugger", "runtimePublicPath", "asyncGeneratorRegex", "parsers", "syntax", "tsx", "decorators", "jsx", "validParsers", "Set", "Object", "keys"]
6
+ }
@@ -0,0 +1,124 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ },
18
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
20
+ value: !0
21
+ }), mod);
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ createVXRNCompilerPlugin: () => createVXRNCompilerPlugin
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+ var import_utils = require("@vxrn/utils"),
28
+ import_node_fs = require("node:fs"),
29
+ import_promises = require("node:fs/promises"),
30
+ import_node_path = require("node:path"),
31
+ import_constants = require("./constants.cjs"),
32
+ import_transformBabel = require("./transformBabel.cjs"),
33
+ import_transformSWC = require("./transformSWC.cjs");
34
+ __reExport(index_exports, require("./configure.cjs"), module.exports);
35
+ __reExport(index_exports, require("./transformBabel.cjs"), module.exports);
36
+ __reExport(index_exports, require("./transformSWC.cjs"), module.exports);
37
+ const import_meta = {};
38
+ async function createVXRNCompilerPlugin(optionsIn) {
39
+ const reactVersion = await (async () => {
40
+ const path = (0, import_utils.resolvePath)("react/package.json");
41
+ return JSON.parse(await (0, import_promises.readFile)(path, "utf-8")).version;
42
+ })(),
43
+ envNames = {
44
+ ios: !0,
45
+ android: !0,
46
+ client: !0,
47
+ ssr: !0
48
+ };
49
+ function getEnvName(name) {
50
+ if (!envNames[name]) throw new Error(`Invalid env: ${name}`);
51
+ return name;
52
+ }
53
+ return [{
54
+ name: "one:compiler-resolve-refresh-runtime",
55
+ apply: "serve",
56
+ enforce: "pre",
57
+ // Run before Vite default resolve to avoid syscalls
58
+ resolveId: id => id === import_constants.runtimePublicPath ? id : void 0,
59
+ load: id => id === import_constants.runtimePublicPath ? (0, import_node_fs.readFileSync)((0, import_node_path.join)(import_meta.dirname, "refresh-runtime.js"), "utf-8") : void 0
60
+ }, {
61
+ name: "one:compiler",
62
+ enforce: "pre",
63
+ config: () => {
64
+ const config = {
65
+ esbuild: !1,
66
+ optimizeDeps: {
67
+ noDiscovery: !0
68
+ }
69
+ };
70
+ return {
71
+ environments: {
72
+ ios: config,
73
+ android: config
74
+ }
75
+ };
76
+ },
77
+ transform: {
78
+ order: "pre",
79
+ async handler(codeIn, _id) {
80
+ let code = codeIn;
81
+ const shouldDebug = process.env.NODE_ENV === "development" && codeIn.startsWith("// debug");
82
+ shouldDebug && (console.info(`[one] ${_id} input:`), console.info(codeIn));
83
+ const extension = (0, import_node_path.extname)(_id);
84
+ if (!import_constants.validParsers.has(extension)) return;
85
+ let id = _id.split("?")[0];
86
+ const isPreProcess = id.startsWith("vxrn-swc-preprocess:");
87
+ if (isPreProcess && (id = id.replace("vxrn-swc-preprocess:", "")), id.includes("virtual:")) return;
88
+ const environment = getEnvName(this.environment.name),
89
+ production = process.env.NODE_ENV === "production",
90
+ transformProps = {
91
+ id,
92
+ code,
93
+ development: !production,
94
+ environment,
95
+ reactForRNVersion: reactVersion.split(".")[0]
96
+ },
97
+ userTransform = optionsIn?.transform?.(transformProps);
98
+ if (userTransform === !1) return;
99
+ if (!isPreProcess && userTransform !== "swc") {
100
+ const babelOptions = (0, import_transformBabel.getBabelOptions)({
101
+ ...transformProps,
102
+ userSetting: userTransform
103
+ });
104
+ if (babelOptions) {
105
+ const babelOut = await (0, import_transformBabel.transformBabel)(id, code, babelOptions);
106
+ babelOut && ((0, import_constants.debug)?.(`[${id}] transformed with babel options: ${JSON.stringify(babelOptions)}`), code = babelOut);
107
+ }
108
+ }
109
+ const swcOptions = {
110
+ environment,
111
+ mode: "serve",
112
+ production,
113
+ ...optionsIn
114
+ },
115
+ out = await (0, import_transformSWC.transformSWC)(id, code, {
116
+ ...swcOptions,
117
+ es5: !0,
118
+ noHMR: isPreProcess
119
+ });
120
+ return shouldDebug && (console.info("swcOptions", swcOptions), console.info("final output:", out?.code)), out;
121
+ }
122
+ }
123
+ }];
124
+ }
@@ -0,0 +1,113 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var index_exports = {};
16
+ __export(index_exports, {
17
+ createVXRNCompilerPlugin: () => createVXRNCompilerPlugin
18
+ });
19
+ module.exports = __toCommonJS(index_exports);
20
+ var import_utils = require("@vxrn/utils"), import_node_fs = require("node:fs"), import_promises = require("node:fs/promises"), import_node_path = require("node:path"), import_constants = require("./constants"), import_transformBabel = require("./transformBabel"), import_transformSWC = require("./transformSWC");
21
+ __reExport(index_exports, require("./configure"), module.exports);
22
+ __reExport(index_exports, require("./transformBabel"), module.exports);
23
+ __reExport(index_exports, require("./transformSWC"), module.exports);
24
+ const import_meta = {};
25
+ async function createVXRNCompilerPlugin(optionsIn) {
26
+ const reactVersion = await (async () => {
27
+ const path = (0, import_utils.resolvePath)("react/package.json");
28
+ return JSON.parse(await (0, import_promises.readFile)(path, "utf-8")).version;
29
+ })(), envNames = {
30
+ ios: !0,
31
+ android: !0,
32
+ client: !0,
33
+ ssr: !0
34
+ };
35
+ function getEnvName(name) {
36
+ if (!envNames[name]) throw new Error(`Invalid env: ${name}`);
37
+ return name;
38
+ }
39
+ return [
40
+ {
41
+ name: "one:compiler-resolve-refresh-runtime",
42
+ apply: "serve",
43
+ enforce: "pre",
44
+ // Run before Vite default resolve to avoid syscalls
45
+ resolveId: (id) => id === import_constants.runtimePublicPath ? id : void 0,
46
+ load: (id) => id === import_constants.runtimePublicPath ? (0, import_node_fs.readFileSync)((0, import_node_path.join)(import_meta.dirname, "refresh-runtime.js"), "utf-8") : void 0
47
+ },
48
+ {
49
+ name: "one:compiler",
50
+ enforce: "pre",
51
+ config: () => {
52
+ const config = {
53
+ esbuild: !1,
54
+ optimizeDeps: {
55
+ noDiscovery: !0
56
+ }
57
+ };
58
+ return {
59
+ environments: {
60
+ ios: config,
61
+ android: config
62
+ }
63
+ };
64
+ },
65
+ transform: {
66
+ order: "pre",
67
+ async handler(codeIn, _id) {
68
+ let code = codeIn;
69
+ const shouldDebug = process.env.NODE_ENV === "development" && codeIn.startsWith("// debug");
70
+ shouldDebug && (console.info(`[one] ${_id} input:`), console.info(codeIn));
71
+ const extension = (0, import_node_path.extname)(_id);
72
+ if (!import_constants.validParsers.has(extension))
73
+ return;
74
+ let id = _id.split("?")[0];
75
+ const isPreProcess = id.startsWith("vxrn-swc-preprocess:");
76
+ if (isPreProcess && (id = id.replace("vxrn-swc-preprocess:", "")), id.includes("virtual:"))
77
+ return;
78
+ const environment = getEnvName(this.environment.name), production = process.env.NODE_ENV === "production", transformProps = {
79
+ id,
80
+ code,
81
+ development: !production,
82
+ environment,
83
+ reactForRNVersion: reactVersion.split(".")[0]
84
+ }, userTransform = optionsIn?.transform?.(transformProps);
85
+ if (userTransform === !1)
86
+ return;
87
+ if (!isPreProcess && userTransform !== "swc") {
88
+ const babelOptions = (0, import_transformBabel.getBabelOptions)({
89
+ ...transformProps,
90
+ userSetting: userTransform
91
+ });
92
+ if (babelOptions) {
93
+ const babelOut = await (0, import_transformBabel.transformBabel)(id, code, babelOptions);
94
+ babelOut && ((0, import_constants.debug)?.(`[${id}] transformed with babel options: ${JSON.stringify(babelOptions)}`), code = babelOut);
95
+ }
96
+ }
97
+ const swcOptions = {
98
+ environment,
99
+ mode: "serve",
100
+ production,
101
+ ...optionsIn
102
+ }, out = await (0, import_transformSWC.transformSWC)(id, code, {
103
+ ...swcOptions,
104
+ es5: !0,
105
+ noHMR: isPreProcess
106
+ });
107
+ return shouldDebug && (console.info("swcOptions", swcOptions), console.info("final output:", out?.code)), out;
108
+ }
109
+ }
110
+ }
111
+ ];
112
+ }
113
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AA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