@tamagui/metro-plugin 1.135.2 → 1.135.4-1761748186554

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.
@@ -0,0 +1,61 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
+ withTamagui: () => withTamagui
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+ var import_static = require("@tamagui/static");
38
+ function withTamagui(metroConfig, optionsIn) {
39
+ const options = {
40
+ ...optionsIn,
41
+ ...(0, import_static.loadTamaguiBuildConfigSync)(optionsIn)
42
+ },
43
+ extractor = (0, import_static.createExtractor)();
44
+ options.disable || extractor.loadTamagui(options), metroConfig.resolver = {
45
+ ...metroConfig.resolver,
46
+ sourceExts: [...(metroConfig.resolver?.sourceExts || []), "css"]
47
+ };
48
+ const ogTransformPath = metroConfig.transformerPath;
49
+ return metroConfig.transformerPath = require.resolve("./transformer"), metroConfig.transformer = {
50
+ ...metroConfig.transformer,
51
+ ...(ogTransformPath && {
52
+ ogTransformPath
53
+ }),
54
+ // @ts-ignore
55
+ tamagui: {
56
+ ...options,
57
+ disableInitialBuild: !0
58
+ }
59
+ }, metroConfig;
60
+ }
61
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["index_exports","__export","withTamagui","module","exports","__toCommonJS","import_static","require","metroConfig","optionsIn","options","loadTamaguiBuildConfigSync","extractor","createExtractor","disable","loadTamagui","resolver","sourceExts","ogTransformPath","transformerPath","resolve","transformer","tamagui","disableInitialBuild"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,aAAA;AAAA,IAAAM,aAAA,GAIOC,OAAA;AAGA,SAASL,YACdM,WAAA,EACAC,SAAA,EAGA;EACA,MAAMC,OAAA,GAAU;MACd,GAAGD,SAAA;MACH,OAAGH,aAAA,CAAAK,0BAAA,EAA2BF,SAAS;IACzC;IAGMG,SAAA,OAAYN,aAAA,CAAAO,eAAA,EAAgB;EAG7BH,OAAA,CAAQI,OAAA,IACNF,SAAA,CAAUG,WAAA,CAAYL,OAAO,GAIpCF,WAAA,CAAYQ,QAAA,GAAW;IACrB,GAAIR,WAAA,CAAYQ,QAAA;IAChBC,UAAA,EAAY,CAAC,IAAIT,WAAA,CAAYQ,QAAA,EAAUC,UAAA,IAAc,EAAC,GAAI,KAAK;EACjE;EAEA,MAAMC,eAAA,GAAkBV,WAAA,CAAYW,eAAA;EACpC,OAAAX,WAAA,CAAYW,eAAA,GAAkBZ,OAAA,CAAAa,OAAA,CAAgB,eAAe,GAC7DZ,WAAA,CAAYa,WAAA,GAAc;IACxB,GAAGb,WAAA,CAAYa,WAAA;IACf,IAAIH,eAAA,IAAmB;MACrBA;IACF;IAAA;IAEAI,OAAA,EAAS;MACP,GAAGZ,OAAA;MACHa,mBAAA,EAAqB;IACvB;EACF,GAEOf,WAAA;AACT","ignoreList":[]}
@@ -1,26 +1,36 @@
1
1
  "use strict";
2
+
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
16
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
23
  // If the importer is in node compatibility mode or this is not an ESM
18
24
  // file that has been converted to a CommonJS file using a Babel-
19
25
  // compatible transform (i.e. "__esModule" has not been set), then set
20
26
  // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
24
34
  var index_exports = {};
25
35
  __export(index_exports, {
26
36
  withTamagui: () => withTamagui
@@ -28,23 +38,22 @@ __export(index_exports, {
28
38
  module.exports = __toCommonJS(index_exports);
29
39
  var import_static = require("@tamagui/static");
30
40
  function withTamagui(metroConfig, optionsIn) {
31
- var _metroConfig_resolver, options = {
32
- ...optionsIn,
33
- ...(0, import_static.loadTamaguiBuildConfigSync)(optionsIn)
34
- }, extractor = (0, import_static.createExtractor)();
41
+ var _metroConfig_resolver,
42
+ options = {
43
+ ...optionsIn,
44
+ ...(0, import_static.loadTamaguiBuildConfigSync)(optionsIn)
45
+ },
46
+ extractor = (0, import_static.createExtractor)();
35
47
  options.disable || extractor.loadTamagui(options), metroConfig.resolver = {
36
48
  ...metroConfig.resolver,
37
- sourceExts: [
38
- ...((_metroConfig_resolver = metroConfig.resolver) === null || _metroConfig_resolver === void 0 ? void 0 : _metroConfig_resolver.sourceExts) || [],
39
- "css"
40
- ]
49
+ sourceExts: [...(((_metroConfig_resolver = metroConfig.resolver) === null || _metroConfig_resolver === void 0 ? void 0 : _metroConfig_resolver.sourceExts) || []), "css"]
41
50
  };
42
51
  var ogTransformPath = metroConfig.transformerPath;
43
52
  return metroConfig.transformerPath = require.resolve("./transformer"), metroConfig.transformer = {
44
53
  ...metroConfig.transformer,
45
- ...ogTransformPath && {
54
+ ...(ogTransformPath && {
46
55
  ogTransformPath
47
- },
56
+ }),
48
57
  // @ts-ignore
49
58
  tamagui: {
50
59
  ...options,
@@ -52,8 +61,4 @@ function withTamagui(metroConfig, optionsIn) {
52
61
  }
53
62
  }, metroConfig;
54
63
  }
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {
57
- withTamagui
58
- });
59
- //# sourceMappingURL=index.js.map
64
+ //# sourceMappingURL=index.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA4D;AACrD,SAAS,YAAY,aAAa,WAAW;AAChD,MAAI,uBACA,UAAU;AAAA,IACV,GAAG;AAAA,IACH,OAAG,0CAA2B,SAAS;AAAA,EAC3C,GAEI,gBAAY,+BAAgB;AAEhC,EAAK,QAAQ,WACJ,UAAU,YAAY,OAAO,GAGtC,YAAY,WAAW;AAAA,IACnB,GAAG,YAAY;AAAA,IACf,YAAY;AAAA,MACR,KAAK,wBAAwB,YAAY,cAAc,QAAQ,0BAA0B,SAAS,SAAS,sBAAsB,eAAe,CAAC;AAAA,MACjJ;AAAA,IACJ;AAAA,EACJ;AACA,MAAI,kBAAkB,YAAY;AAClC,qBAAY,kBAAkB,gBAAgB,eAAe,GAC7D,YAAY,cAAc;AAAA,IACtB,GAAG,YAAY;AAAA,IACf,GAAG,mBAAmB;AAAA,MAClB;AAAA,IACJ;AAAA;AAAA,IAEA,SAAS;AAAA,MACL,GAAG;AAAA,MACH,qBAAqB;AAAA,IACzB;AAAA,EACJ,GACO;AACX;",
5
- "names": []
6
- }
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","withTamagui","module","exports","import_static","require","metroConfig","optionsIn","_metroConfig_resolver","options","loadTamaguiBuildConfigSync","extractor","createExtractor","disable","loadTamagui","resolver","sourceExts","ogTransformPath","transformerPath","resolve","transformer","tamagui"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAIO,CAAAK,aAAA;AAGA,IAAAK,aAAS,GAAAC,OACd,kBAIA;AACA,SAAMJ,WAAUA,CAAAK,WAAA,EAAAC,SAAA;EAAA,IACdC,qBAAG;IAAAC,OAAA;MACH,GAAAF,SAAG;MACL,GAGM,IAAAH,aAAY,CAAAM,0BAAA,EAAgBH,SAAA;IAG7B;IAAAI,SAAQ,OACNP,aAAU,CAAAQ,eAAmB,GAIpC;EAAuBH,OACjB,CAAAI,OAAA,IAAYF,SAAA,CAAAG,WAAA,CAAAL,OAAA,GAAAH,WAAA,CAAAS,QAAA;IAChB,GAAAT,WAAa,CAAAS,QAAI;IACnBC,UAAA,GAEA,IAAM,EAAAR,qBAAkB,GAAAF,WAAY,CAAAS,QAAA,cAAAP,qBAAA,uBAAAA,qBAAA,CAAAQ,UAAA,UACpC;EAEiB;EACQ,IACrBC,eAAA,GAAAX,WAAA,CAAAY,eAAA;EAAA,OACFZ,WAAA,CAAAY,eAAA,GAAAb,OAAA,CAAAc,OAAA,mBAAAb,WAAA,CAAAc,WAAA;IAAA,GAAAd,WAAA,CAAAc,WAAA;IAEA,IAAAH,eAAS;MACPA;IAAG;IAEL;IACFI,OAEO;MACT,GAAAZ,OAAA","ignoreList":[]}
@@ -0,0 +1,90 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var transformer_exports = {};
33
+ __export(transformer_exports, {
34
+ transform: () => transform
35
+ });
36
+ module.exports = __toCommonJS(transformer_exports);
37
+ var import_fs_extra = require("fs-extra"),
38
+ import_metro_transform_worker = __toESM(require("metro-transform-worker")),
39
+ import_node_path = require("node:path"),
40
+ import_static = require("@tamagui/static");
41
+ const extractor = (0, import_static.createExtractor)();
42
+ async function transform(config, projectRoot, filename, data, options) {
43
+ const ogPath = config.ogTransformPath || config.transformerPath,
44
+ transformer = ogPath ? require(ogPath).transform : import_metro_transform_worker.default.transform;
45
+ if (config.tamagui.disable || options.platform !== "web" || options.type === "asset" || filename.includes("node_modules")) return transformer(config, projectRoot, filename, data, options);
46
+ if (
47
+ // could by a styled() call:
48
+ filename.endsWith(".ts") || filename.endsWith(".tsx") || filename.endsWith(".jsx")) {
49
+ const sourcePath = toPosixPath((0, import_node_path.join)(projectRoot, filename)),
50
+ source = `${data}`,
51
+ out = await (0, import_static.extractToClassNames)({
52
+ extractor,
53
+ options: {
54
+ // @ts-ignore
55
+ platform: "web",
56
+ ...config.tamagui
57
+ },
58
+ shouldPrintDebug: source.startsWith("// debug-verbose") ? "verbose" : source.startsWith("// debug"),
59
+ source,
60
+ sourcePath
61
+ });
62
+ if (out?.styles) {
63
+ const tmpDir = (0, import_node_path.join)(projectRoot, ".tamagui", "css"),
64
+ outStylePath = toPosixPath((0, import_node_path.join)(tmpDir, `${filename}`.replace(/[^a-zA-Z0-9]/gi, "") + ".css"));
65
+ if (process.env.DEBUG?.includes("tamagui") && console.info(" Outputting CSS file:", outStylePath), process.env.TAMAGUI_METRO_INLINE_CSS !== "0") {
66
+ const cssInjectionCode = `
67
+ (function() {
68
+ if (typeof document !== 'undefined') {
69
+ var css = ${JSON.stringify(out.styles)};
70
+ var style = document.createElement('style');
71
+ style.type = 'text/css';
72
+ style.appendChild(document.createTextNode(css));
73
+ document.head.appendChild(style);
74
+ }
75
+ })();
76
+ `;
77
+ return transformer(config, projectRoot, filename, Buffer.from(`${out.js}
78
+ ${cssInjectionCode}`, "utf-8"), options);
79
+ }
80
+ const existsAlready = await (0, import_fs_extra.pathExists)(outStylePath);
81
+ return await (0, import_fs_extra.outputFile)(outStylePath, out.styles, "utf-8"), existsAlready || (await new Promise(res => setTimeout(res, process.env.TAMAGUI_METRO_CSS_EMIT_DELAY ? +process.env.TAMAGUI_METRO_CSS_EMIT_DELAY : 1e3))), transformer(config, projectRoot, filename, Buffer.from(`${out.js}
82
+ require("${outStylePath}")`, "utf-8"), options);
83
+ }
84
+ }
85
+ return transformer(config, projectRoot, filename, data, options);
86
+ }
87
+ function toPosixPath(path) {
88
+ return path.split(import_node_path.sep).join(import_node_path.posix.sep);
89
+ }
90
+ //# sourceMappingURL=transformer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["transformer_exports","__export","transform","module","exports","__toCommonJS","import_fs_extra","require","import_metro_transform_worker","__toESM","import_node_path","import_static","extractor","createExtractor","config","projectRoot","filename","data","options","ogPath","ogTransformPath","transformerPath","transformer","default","tamagui","disable","platform","type","includes","endsWith","sourcePath","toPosixPath","join","source","out","extractToClassNames","shouldPrintDebug","startsWith","styles","tmpDir","outStylePath","replace","process","env","DEBUG","console","info","TAMAGUI_METRO_INLINE_CSS","cssInjectionCode","JSON","stringify","Buffer","from","js","existsAlready","pathExists","outputFile","Promise","res","setTimeout","TAMAGUI_METRO_CSS_EMIT_DELAY","path","split","sep","posix"],"sources":["../../src/transformer.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,mBAAA;AAAA,IAAAM,eAAA,GAAuCC,OAAA;EAMvCC,6BAAA,GAAmBC,OAAA,CAAAF,OAAA;EACnBG,gBAAA,GAAiCH,OAAA;EAGjCI,aAAA,GAAqDJ,OAAA;AAOrD,MAAMK,SAAA,OAAYD,aAAA,CAAAE,eAAA,EAAgB;AAElC,eAAsBX,UACpBY,MAAA,EACAC,WAAA,EACAC,QAAA,EACAC,IAAA,EACAC,OAAA,EAC4B;EAC5B,MAAMC,MAAA,GAASL,MAAA,CAAOM,eAAA,IAAsBN,MAAA,CAAOO,eAAA;IAC7CC,WAAA,GAAcH,MAAA,GAASZ,OAAA,CAAQY,MAAM,EAAEjB,SAAA,GAAYM,6BAAA,CAAAe,OAAA,CAAOrB,SAAA;EAEhE,IACEY,MAAA,CAAOU,OAAA,CAAQC,OAAA,IACfP,OAAA,CAAQQ,QAAA,KAAa,SACrBR,OAAA,CAAQS,IAAA,KAAS,WACjBX,QAAA,CAASY,QAAA,CAAS,cAAc,GAEhC,OAAON,WAAA,CAAYR,MAAA,EAAQC,WAAA,EAAaC,QAAA,EAAUC,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,IAAA,CAAK,GAAGlB,GAAA,CAAImB,EAAE;AAAA,EAAKL,gBAAgB,IAAI,OAAO,GACrD9B,OACF;MACF;MAEA,MAAMoC,aAAA,GAAgB,UAAMhD,eAAA,CAAAiD,UAAA,EAAWf,YAAY;MAEnD,iBAAMlC,eAAA,CAAAkD,UAAA,EAAWhB,YAAA,EAAcN,GAAA,CAAII,MAAA,EAAQ,OAAO,GAE7CgB,aAAA,KAEH,MAAM,IAAIG,OAAA,CAASC,GAAA,IACjBC,UAAA,CACED,GAAA,EACAhB,OAAA,CAAQC,GAAA,CAAIiB,4BAAA,GACR,CAAClB,OAAA,CAAQC,GAAA,CAAIiB,4BAAA,GACb,GACN,CACF,IAGKtC,WAAA,CACLR,MAAA,EACAC,WAAA,EACAC,QAAA,EACAmC,MAAA,CAAOC,IAAA,CAAK,GAAGlB,GAAA,CAAImB,EAAE;AAAA,WAAcb,YAAY,MAAM,OAAO,GAC5DtB,OACF;IACF;EACF;EAEA,OAAOI,WAAA,CAAYR,MAAA,EAAQC,WAAA,EAAaC,QAAA,EAAUC,IAAA,EAAMC,OAAO;AACjE;AAEA,SAASa,YAAY8B,IAAA,EAAc;EACjC,OAAOA,IAAA,CAAKC,KAAA,CAAMpD,gBAAA,CAAAqD,GAAG,EAAE/B,IAAA,CAAKtB,gBAAA,CAAAsD,KAAA,CAAMD,GAAG;AACvC","ignoreList":[]}
@@ -1,53 +1,70 @@
1
1
  "use strict";
2
+
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
16
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
23
  // If the importer is in node compatibility mode or this is not an ESM
18
24
  // file that has been converted to a CommonJS file using a Babel-
19
25
  // compatible transform (i.e. "__esModule" has not been set), then set
20
26
  // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
24
34
  var transformer_exports = {};
25
35
  __export(transformer_exports, {
26
36
  transform: () => transform
27
37
  });
28
38
  module.exports = __toCommonJS(transformer_exports);
29
- var import_fs_extra = require("fs-extra"), import_metro_transform_worker = __toESM(require("metro-transform-worker")), import_node_path = require("node:path"), import_static = require("@tamagui/static"), extractor = (0, import_static.createExtractor)();
39
+ var import_fs_extra = require("fs-extra"),
40
+ import_metro_transform_worker = __toESM(require("metro-transform-worker")),
41
+ import_path = require("path"),
42
+ import_static = require("@tamagui/static"),
43
+ extractor = (0, import_static.createExtractor)();
30
44
  async function transform(config, projectRoot, filename, data, options) {
31
- var ogPath = config.ogTransformPath || config.transformerPath, transformer = ogPath ? require(ogPath).transform : import_metro_transform_worker.default.transform;
32
- if (config.tamagui.disable || options.platform !== "web" || options.type === "asset" || filename.includes("node_modules"))
33
- return transformer(config, projectRoot, filename, data, options);
45
+ var ogPath = config.ogTransformPath || config.transformerPath,
46
+ transformer = ogPath ? require(ogPath).transform : import_metro_transform_worker.default.transform;
47
+ if (config.tamagui.disable || options.platform !== "web" || options.type === "asset" || filename.includes("node_modules")) return transformer(config, projectRoot, filename, data, options);
34
48
  if (
35
- // could by a styled() call:
36
- filename.endsWith(".ts") || filename.endsWith(".tsx") || filename.endsWith(".jsx")
37
- ) {
38
- var sourcePath = toPosixPath((0, import_node_path.join)(projectRoot, filename)), source = `${data}`, out = await (0, import_static.extractToClassNames)({
39
- extractor,
40
- options: {
41
- // @ts-ignore
42
- platform: "web",
43
- ...config.tamagui
44
- },
45
- shouldPrintDebug: source.startsWith("// debug-verbose") ? "verbose" : source.startsWith("// debug"),
46
- source,
47
- sourcePath
48
- });
49
- if (out != null && out.styles) {
50
- var _process_env_DEBUG, tmpDir = (0, import_node_path.join)(projectRoot, ".tamagui", "css"), outStylePath = toPosixPath((0, import_node_path.join)(tmpDir, `${filename}`.replace(/[^a-zA-Z0-9]/gi, "") + ".css"));
49
+ // could by a styled() call:
50
+ filename.endsWith(".ts") || filename.endsWith(".tsx") || filename.endsWith(".jsx")) {
51
+ var sourcePath = toPosixPath((0, import_path.join)(projectRoot, filename)),
52
+ source = `${data}`,
53
+ out = await (0, import_static.extractToClassNames)({
54
+ extractor,
55
+ options: {
56
+ // @ts-ignore
57
+ platform: "web",
58
+ ...config.tamagui
59
+ },
60
+ shouldPrintDebug: source.startsWith("// debug-verbose") ? "verbose" : source.startsWith("// debug"),
61
+ source,
62
+ sourcePath
63
+ });
64
+ if (out?.styles) {
65
+ var _process_env_DEBUG,
66
+ tmpDir = (0, import_path.join)(projectRoot, ".tamagui", "css"),
67
+ outStylePath = toPosixPath((0, import_path.join)(tmpDir, `${filename}`.replace(/[^a-zA-Z0-9]/gi, "") + ".css"));
51
68
  if (!((_process_env_DEBUG = process.env.DEBUG) === null || _process_env_DEBUG === void 0) && _process_env_DEBUG.includes("tamagui") && console.info(" Outputting CSS file:", outStylePath), process.env.TAMAGUI_METRO_INLINE_CSS !== "0") {
52
69
  var cssInjectionCode = `
53
70
  (function() {
@@ -64,19 +81,15 @@ async function transform(config, projectRoot, filename, data, options) {
64
81
  ${cssInjectionCode}`, "utf-8"), options);
65
82
  }
66
83
  var existsAlready = await (0, import_fs_extra.pathExists)(outStylePath);
67
- return await (0, import_fs_extra.outputFile)(outStylePath, out.styles, "utf-8"), existsAlready || await new Promise(function(res) {
84
+ return await (0, import_fs_extra.outputFile)(outStylePath, out.styles, "utf-8"), existsAlready || (await new Promise(function (res) {
68
85
  return setTimeout(res, process.env.TAMAGUI_METRO_CSS_EMIT_DELAY ? +process.env.TAMAGUI_METRO_CSS_EMIT_DELAY : 1e3);
69
- }), transformer(config, projectRoot, filename, Buffer.from(`${out.js}
86
+ })), transformer(config, projectRoot, filename, Buffer.from(`${out.js}
70
87
  require("${outStylePath}")`, "utf-8"), options);
71
88
  }
72
89
  }
73
90
  return transformer(config, projectRoot, filename, data, options);
74
91
  }
75
92
  function toPosixPath(path) {
76
- return path.split(import_node_path.sep).join(import_node_path.posix.sep);
93
+ return path.split(import_path.sep).join(import_path.posix.sep);
77
94
  }
78
- // Annotate the CommonJS export names for ESM import in node:
79
- 0 && (module.exports = {
80
- transform
81
- });
82
- //# sourceMappingURL=transformer.js.map
95
+ //# sourceMappingURL=transformer.native.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/transformer.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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,eAAO,YAAY,QAAQ,aAAa,UAAU,OAAO,KAAK,GAAG,IAAI,EAAE;AAAA,EAAK,gBAAgB,IAAI,OAAO,GAAG,OAAO;AAAA,MACrH;AACA,UAAI,gBAAgB,UAAM,4BAAW,YAAY;AACjD,uBAAM,4BAAW,cAAc,IAAI,QAAQ,OAAO,GAC7C,iBAED,MAAM,IAAI,QAAQ,SAAS,KAAK;AAC5B,eAAO,WAAW,KAAK,QAAQ,IAAI,+BAA+B,CAAC,QAAQ,IAAI,+BAA+B,GAAI;AAAA,MACtH,CAAC,GAEE,YAAY,QAAQ,aAAa,UAAU,OAAO,KAAK,GAAG,IAAI,EAAE;AAAA,WAAc,YAAY,MAAM,OAAO,GAAG,OAAO;AAAA,IAC5H;AAAA,EACJ;AACA,SAAO,YAAY,QAAQ,aAAa,UAAU,MAAM,OAAO;AACnE;AACA,SAAS,YAAY,MAAM;AACvB,SAAO,KAAK,MAAM,oBAAG,EAAE,KAAK,uBAAM,GAAG;AACzC;",
5
- "names": ["worker"]
6
- }
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","transformer_exports","__export","transform","module","exports","import_fs_extra","require","import_metro_transform_worker","__toESM","import_path","import_static","extractor","createExtractor","config","projectRoot","filename","data","options","ogPath","ogTransformPath","transformerPath","transformer","default","tamagui","disable","platform","type","includes","endsWith","sourcePath","toPosixPath","join","source","out","extractToClassNames","shouldPrintDebug","startsWith","styles","_process_env_DEBUG","tmpDir","outStylePath","replace","process","env","DEBUG","console","info","TAMAGUI_METRO_INLINE_CSS","cssInjectionCode","JSON","stringify","Buffer","from","js","existsAlready","pathExists","outputFile","Promise","res","setTimeout","TAMAGUI_METRO_CSS_EMIT_DELAY","path","split","sep","posix"],"sources":["../../src/transformer.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,G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,CAAAC,IAAA,IAAAnB,GAAA,CAAAoB,EAAA;AAAA,WAAKb,YAAoB,MAAO,UAAAvB,OAAA;IAAA;EACrD;EACF,OACFI,WAAA,CAAAR,MAAA,EAAAC,WAAA,EAAAC,QAAA,EAAAC,IAAA,EAAAC,OAAA;AAEA;AAEA,SAAAa,YAAA+B,IAAM;EAIM,OAASA,IAAA,CAAAC,KACjB,CAAArD,WAAA,CAAAsD,GAAA,EAAAhC,IAAA,CAAAtB,WAAA,CAAAuD,KAAA,CAAAD,GAAA;AAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { outputFile, pathExists } from "fs-extra";
2
2
  import worker from "metro-transform-worker";
3
- import { join, posix, sep } from "node:path";
3
+ import { join, posix, sep } from "path";
4
4
  import { createExtractor, extractToClassNames } from "@tamagui/static";
5
5
  var extractor = createExtractor();
6
6
  async function transform(config, projectRoot, filename, data, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/metro-plugin",
3
- "version": "1.135.2",
3
+ "version": "1.135.4-1761748186554",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs/index.js",
@@ -23,13 +23,13 @@
23
23
  "clean:build": "tamagui-build clean:build"
24
24
  },
25
25
  "dependencies": {
26
- "@tamagui/static": "1.135.2",
26
+ "@tamagui/static": "1.135.4-1761748186554",
27
27
  "fs-extra": "^11.2.0",
28
28
  "metro-config": "*",
29
29
  "metro-transform-worker": "*",
30
30
  "react-native-css-interop": "^0.1.22"
31
31
  },
32
32
  "devDependencies": {
33
- "@tamagui/build": "1.135.2"
33
+ "@tamagui/build": "1.135.4-1761748186554"
34
34
  }
35
35
  }