@tamagui/metro-plugin 1.135.4 → 1.135.6

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.
@@ -1,26 +1,34 @@
1
- "use strict";
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  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
- };
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
+ };
16
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
21
  // If the importer is in node compatibility mode or this is not an ESM
18
22
  // file that has been converted to a CommonJS file using a Babel-
19
23
  // compatible transform (i.e. "__esModule" has not been set), then set
20
24
  // "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);
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);
24
32
  var index_exports = {};
25
33
  __export(index_exports, {
26
34
  withTamagui: () => withTamagui
@@ -28,23 +36,21 @@ __export(index_exports, {
28
36
  module.exports = __toCommonJS(index_exports);
29
37
  var import_static = require("@tamagui/static");
30
38
  function withTamagui(metroConfig, optionsIn) {
31
- var _metroConfig_resolver, options = {
32
- ...optionsIn,
33
- ...(0, import_static.loadTamaguiBuildConfigSync)(optionsIn)
34
- }, extractor = (0, import_static.createExtractor)();
39
+ const options = {
40
+ ...optionsIn,
41
+ ...(0, import_static.loadTamaguiBuildConfigSync)(optionsIn)
42
+ },
43
+ extractor = (0, import_static.createExtractor)();
35
44
  options.disable || extractor.loadTamagui(options), metroConfig.resolver = {
36
45
  ...metroConfig.resolver,
37
- sourceExts: [
38
- ...((_metroConfig_resolver = metroConfig.resolver) === null || _metroConfig_resolver === void 0 ? void 0 : _metroConfig_resolver.sourceExts) || [],
39
- "css"
40
- ]
46
+ sourceExts: [...(metroConfig.resolver?.sourceExts || []), "css"]
41
47
  };
42
- var ogTransformPath = metroConfig.transformerPath;
48
+ const ogTransformPath = metroConfig.transformerPath;
43
49
  return metroConfig.transformerPath = require.resolve("./transformer"), metroConfig.transformer = {
44
50
  ...metroConfig.transformer,
45
- ...ogTransformPath && {
51
+ ...(ogTransformPath && {
46
52
  ogTransformPath
47
- },
53
+ }),
48
54
  // @ts-ignore
49
55
  tamagui: {
50
56
  ...options,
@@ -52,8 +58,4 @@ function withTamagui(metroConfig, optionsIn) {
52
58
  }
53
59
  }, metroConfig;
54
60
  }
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {
57
- withTamagui
58
- });
59
- //# sourceMappingURL=index.js.map
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":[]}
@@ -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,K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AA,CAAII,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;QAS5C,OAAOhB,WAAA,CACLR,MAAA,EACAC,WAAA,EACAC,QAAA,EACAmC,MAAA,CAAOC,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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/metro-plugin",
3
- "version": "1.135.4",
3
+ "version": "1.135.6",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs/index.js",
@@ -15,21 +15,21 @@
15
15
  "access": "public"
16
16
  },
17
17
  "scripts": {
18
- "build": "tamagui-build",
19
- "watch": "tamagui-build --watch",
18
+ "build": "tamagui-build --skip-native",
19
+ "watch": "tamagui-build --skip-native --watch",
20
20
  "lint": "biome check src",
21
21
  "lint:fix": "biome check --write src",
22
22
  "clean": "tamagui-build clean",
23
23
  "clean:build": "tamagui-build clean:build"
24
24
  },
25
25
  "dependencies": {
26
- "@tamagui/static": "1.135.4",
26
+ "@tamagui/static": "1.135.6",
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.4"
33
+ "@tamagui/build": "1.135.6"
34
34
  }
35
35
  }
@@ -1,6 +0,0 @@
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,82 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
- 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
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "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);
24
- var transformer_exports = {};
25
- __export(transformer_exports, {
26
- transform: () => transform
27
- });
28
- 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)();
30
- 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);
34
- 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"));
51
- 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
- var cssInjectionCode = `
53
- (function() {
54
- if (typeof document !== 'undefined') {
55
- var css = ${JSON.stringify(out.styles)};
56
- var style = document.createElement('style');
57
- style.type = 'text/css';
58
- style.appendChild(document.createTextNode(css));
59
- document.head.appendChild(style);
60
- }
61
- })();
62
- `;
63
- return transformer(config, projectRoot, filename, Buffer.from(`${out.js}
64
- ${cssInjectionCode}`, "utf-8"), options);
65
- }
66
- 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) {
68
- 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}
70
- require("${outStylePath}")`, "utf-8"), options);
71
- }
72
- }
73
- return transformer(config, projectRoot, filename, data, options);
74
- }
75
- function toPosixPath(path) {
76
- return path.split(import_node_path.sep).join(import_node_path.posix.sep);
77
- }
78
- // Annotate the CommonJS export names for ESM import in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AS,KACnI,QAAQ,KAAK,yBAAyB,YAAY,GAElD,QAAQ,IAAI,6BAA6B,KAAK;AAC9C,YAAI,mBAAmB;AAAA;AAAA;AAAA,0BAGb,KAAK,UAAU,IAAI,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpC,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,27 +0,0 @@
1
- import { createExtractor, loadTamaguiBuildConfigSync } from "@tamagui/static";
2
- function withTamagui(metroConfig, optionsIn) {
3
- var _metroConfig_resolver,
4
- options = {
5
- ...optionsIn,
6
- ...loadTamaguiBuildConfigSync(optionsIn)
7
- },
8
- extractor = createExtractor();
9
- options.disable || extractor.loadTamagui(options), metroConfig.resolver = {
10
- ...metroConfig.resolver,
11
- sourceExts: [...(((_metroConfig_resolver = metroConfig.resolver) === null || _metroConfig_resolver === void 0 ? void 0 : _metroConfig_resolver.sourceExts) || []), "css"]
12
- };
13
- var ogTransformPath = metroConfig.transformerPath;
14
- return metroConfig.transformerPath = require.resolve("./transformer"), metroConfig.transformer = {
15
- ...metroConfig.transformer,
16
- ...(ogTransformPath && {
17
- ogTransformPath
18
- }),
19
- // @ts-ignore
20
- tamagui: {
21
- ...options,
22
- disableInitialBuild: !0
23
- }
24
- }, metroConfig;
25
- }
26
- export { withTamagui };
27
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createExtractor","loadTamaguiBuildConfigSync","withTamagui","metroConfig","optionsIn","_metroConfig_resolver","options","extractor","disable","loadTamagui","resolver","sourceExts","ogTransformPath","transformerPath","require","resolve","transformer","tamagui","disableInitialBuild"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAAAA,eAAA,EAAAC,0BAAA;AAAA,SACEC,YAAAC,WAAA,EAAAC,SAAA;EACA,IAAAC,qBAAA;IAAAC,OAAA;MAAA,GAEKF,SAAA;MAGA,GAAAH,0BACL,CACAG,SAAA;IAIA;IAAAG,SAAM,GAAAP,eAAU;EAAAM,OACX,CAAAE,OAAA,IAAAD,SAAA,CAAAE,WAAA,CAAAH,OAAA,GAAAH,WAAA,CAAAO,QAAA;IACH,GAAGP,WAAA,CAAAO,QAAA;IACLC,UAGM,GAGD,KAAQ,CAAAN,qBACI,GAAAF,WAAY,CAAAO,QAI7B,UAAY,IAAAL,qBAAW,uBAAAA,qBAAA,CAAAM,UAAA,UACrB,KAAI;EAEN;EAEA,IAAAC,eAAM,GAAAT,WAAkB,CAAAU,eAAY;EACpC,OAAAV,WAAA,CAAYU,eAAA,GAAkBC,OAAA,CAAAC,OAAA,CAAgB,eAAe,GAC7DZ,WAAA,CAAYa,WAAA,GAAc;IACxB,GAAGb,WAAA,CAAYa,WAAA;IACf,IAAIJ,eAAA,IAAmB;MACrBA;IACF;IAAA;IAEAK,OAAA,EAAS;MACP,GAAGX,OAAA;MACHY,mBAAA,EAAqB;IACvB;EACF,GAEOf,WAAA;AACT","ignoreList":[]}
@@ -1,58 +0,0 @@
1
- import { outputFile, pathExists } from "fs-extra";
2
- import worker from "metro-transform-worker";
3
- import { join, posix, sep } from "node:path";
4
- import { createExtractor, extractToClassNames } from "@tamagui/static";
5
- var extractor = createExtractor();
6
- async function transform(config, projectRoot, filename, data, options) {
7
- var ogPath = config.ogTransformPath || config.transformerPath,
8
- transformer = ogPath ? require(ogPath).transform : worker.transform;
9
- if (config.tamagui.disable || options.platform !== "web" || options.type === "asset" || filename.includes("node_modules")) return transformer(config, projectRoot, filename, data, options);
10
- if (
11
- // could by a styled() call:
12
- filename.endsWith(".ts") || filename.endsWith(".tsx") || filename.endsWith(".jsx")) {
13
- var sourcePath = toPosixPath(join(projectRoot, filename)),
14
- source = `${data}`,
15
- out = await extractToClassNames({
16
- extractor,
17
- options: {
18
- // @ts-ignore
19
- platform: "web",
20
- ...config.tamagui
21
- },
22
- shouldPrintDebug: source.startsWith("// debug-verbose") ? "verbose" : source.startsWith("// debug"),
23
- source,
24
- sourcePath
25
- });
26
- if (out?.styles) {
27
- var _process_env_DEBUG,
28
- tmpDir = join(projectRoot, ".tamagui", "css"),
29
- outStylePath = toPosixPath(join(tmpDir, `${filename}`.replace(/[^a-zA-Z0-9]/gi, "") + ".css"));
30
- 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") {
31
- var cssInjectionCode = `
32
- (function() {
33
- if (typeof document !== 'undefined') {
34
- var css = ${JSON.stringify(out.styles)};
35
- var style = document.createElement('style');
36
- style.type = 'text/css';
37
- style.appendChild(document.createTextNode(css));
38
- document.head.appendChild(style);
39
- }
40
- })();
41
- `;
42
- return transformer(config, projectRoot, filename, Buffer.from(`${out.js}
43
- ${cssInjectionCode}`, "utf-8"), options);
44
- }
45
- var existsAlready = await pathExists(outStylePath);
46
- return await outputFile(outStylePath, out.styles, "utf-8"), existsAlready || (await new Promise(function (res) {
47
- return setTimeout(res, process.env.TAMAGUI_METRO_CSS_EMIT_DELAY ? +process.env.TAMAGUI_METRO_CSS_EMIT_DELAY : 1e3);
48
- })), transformer(config, projectRoot, filename, Buffer.from(`${out.js}
49
- require("${outStylePath}")`, "utf-8"), options);
50
- }
51
- }
52
- return transformer(config, projectRoot, filename, data, options);
53
- }
54
- function toPosixPath(path) {
55
- return path.split(sep).join(posix.sep);
56
- }
57
- export { transform };
58
- //# sourceMappingURL=transformer.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["outputFile","pathExists","worker","join","posix","sep","createExtractor","extractToClassNames","extractor","transform","config","projectRoot","filename","data","options","ogPath","ogTransformPath","transformerPath","transformer","require","tamagui","disable","platform","type","includes","endsWith","sourcePath","toPosixPath","source","out","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","Promise","res","setTimeout","TAMAGUI_METRO_CSS_EMIT_DELAY","path","split"],"sources":["../../src/transformer.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAA,EAAYC,UAAA,QAAkB;AAMvC,OAAOC,MAAA,MAAY;AACnB,SAASC,IAAA,EAAMC,KAAA,EAAOC,GAAA,QAAW;AAGjC,SAASC,eAAA,EAAiBC,mBAAA,QAA2B;AAOrD,IAAAC,SAAM,GAAAF,eAAY;AAElB,eAAsBG,UACpBC,MAAA,EACAC,WAAA,EACAC,QAAA,EACAC,IAAA,EACAC,OAAA,EAC4B;EAC5B,IAAAC,MAAM,GAAAL,MAAS,CAAAM,eAAO,IAAAN,MAAsB,CAAAO,eAAO;IAAAC,WAC7C,GAAAH,MAAc,GAAAI,OAAS,CAAAJ,MAAQ,EAAMN,SAAE,GAAAP,MAAY,CAAAO,SAAO;EAEhE,IACEC,MAAA,CAAOU,OAAA,CAAQC,OAAA,IACfP,OAAA,CAAQQ,QAAA,KAAa,SACrBR,OAAA,C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