tamagui-loader 1.13.2 → 1.13.4

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/css.js CHANGED
@@ -1,53 +1,2 @@
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: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var css_exports = {};
20
- __export(css_exports, {
21
- default: () => loader,
22
- extractedInfoByFile: () => extractedInfoByFile,
23
- stylePathToFilePath: () => stylePathToFilePath
24
- });
25
- module.exports = __toCommonJS(css_exports);
26
- const extractedInfoByFile = /* @__PURE__ */ new Map();
27
- const stylePathToFilePath = /* @__PURE__ */ new Map();
28
- function loader() {
29
- this.async();
30
- const options = { ...this.getOptions() };
31
- const sourcePath = `${this.resourcePath}`;
32
- let out = "";
33
- if (options.cssPath) {
34
- const pathKey = stylePathToFilePath.get(sourcePath) ?? sourcePath;
35
- const info = extractedInfoByFile.get(pathKey);
36
- stylePathToFilePath.delete(sourcePath);
37
- extractedInfoByFile.delete(pathKey);
38
- const out2 = info == null ? void 0 : info.styles;
39
- return this.callback(null, out2 || "");
40
- } else if (options.cssData) {
41
- out = Buffer.from(options.cssData, "base64").toString("utf-8");
42
- }
43
- if (out) {
44
- return this.callback(null, out || "");
45
- }
46
- this.callback({ message: "No CSS found", name: "missing_css" });
47
- }
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- extractedInfoByFile,
51
- stylePathToFilePath
52
- });
1
+ "use strict";var n=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var o in t)n(e,o,{get:t[o],enumerable:!0})},g=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of u(t))!h.call(e,s)&&s!==o&&n(e,s,{get:()=>t[s],enumerable:!(a=p(t,s))||a.enumerable});return e};var d=e=>g(n({},"__esModule",{value:!0}),e);var m={};f(m,{default:()=>c,extractedInfoByFile:()=>i,stylePathToFilePath:()=>r});module.exports=d(m);const i=new Map,r=new Map;function c(){this.async();const e={...this.getOptions()},t=`${this.resourcePath}`;let o="";if(e.cssPath){const a=r.get(t)??t,s=i.get(a);r.delete(t),i.delete(a);const l=s==null?void 0:s.styles;return this.callback(null,l||"")}else e.cssData&&(o=Buffer.from(e.cssData,"base64").toString("utf-8"));if(o)return this.callback(null,o||"");this.callback({message:"No CSS found",name:"missing_css"})}0&&(module.exports={extractedInfoByFile,stylePathToFilePath});
53
2
  //# sourceMappingURL=css.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/css.ts"],
4
4
  "sourcesContent": ["import { ExtractedResponse, TamaguiOptions } from '@tamagui/static'\nimport type { LoaderContext } from 'webpack'\n\nexport const extractedInfoByFile = new Map<string, ExtractedResponse>()\nexport const stylePathToFilePath = new Map<string, string>()\n\nexport default function loader(this: LoaderContext<TamaguiOptions>) {\n this.async()\n const options = { ...this.getOptions() }\n const sourcePath = `${this.resourcePath}`\n let out = ''\n if (options.cssPath) {\n // get in memory info\n const pathKey = stylePathToFilePath.get(sourcePath) ?? sourcePath\n const info = extractedInfoByFile.get(pathKey)\n // clear memory\n stylePathToFilePath.delete(sourcePath)\n extractedInfoByFile.delete(pathKey)\n const out = info?.styles\n return this.callback(null, out || '')\n } else if (options.cssData) {\n // get output CSS\n out = Buffer.from(options.cssData, 'base64').toString('utf-8')\n }\n\n if (out) {\n // use original JS sourcemap\n return this.callback(null, out || '')\n }\n\n this.callback({ message: 'No CSS found', name: 'missing_css' })\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,sBAAsB,oBAAI,IAA+B;AAC/D,MAAM,sBAAsB,oBAAI,IAAoB;AAE5C,SAAR,SAA6D;AAClE,OAAK,MAAM;AACX,QAAM,UAAU,EAAE,GAAG,KAAK,WAAW,EAAE;AACvC,QAAM,aAAa,GAAG,KAAK;AAC3B,MAAI,MAAM;AACV,MAAI,QAAQ,SAAS;AAEnB,UAAM,UAAU,oBAAoB,IAAI,UAAU,KAAK;AACvD,UAAM,OAAO,oBAAoB,IAAI,OAAO;AAE5C,wBAAoB,OAAO,UAAU;AACrC,wBAAoB,OAAO,OAAO;AAClC,UAAMA,OAAM,6BAAM;AAClB,WAAO,KAAK,SAAS,MAAMA,QAAO,EAAE;AAAA,EACtC,WAAW,QAAQ,SAAS;AAE1B,UAAM,OAAO,KAAK,QAAQ,SAAS,QAAQ,EAAE,SAAS,OAAO;AAAA,EAC/D;AAEA,MAAI,KAAK;AAEP,WAAO,KAAK,SAAS,MAAM,OAAO,EAAE;AAAA,EACtC;AAEA,OAAK,SAAS,EAAE,SAAS,gBAAgB,MAAM,cAAc,CAAC;AAChE;",
6
- "names": ["out"]
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,wBAAAC,EAAA,wBAAAC,IAAA,eAAAC,EAAAL,GAGO,MAAMG,EAAsB,IAAI,IAC1BC,EAAsB,IAAI,IAExB,SAARF,GAA6D,CAClE,KAAK,MAAM,EACX,MAAMI,EAAU,CAAE,GAAG,KAAK,WAAW,CAAE,EACjCC,EAAa,GAAG,KAAK,eAC3B,IAAIC,EAAM,GACV,GAAIF,EAAQ,QAAS,CAEnB,MAAMG,EAAUL,EAAoB,IAAIG,CAAU,GAAKA,EACjDG,EAAOP,EAAoB,IAAIM,CAAO,EAE5CL,EAAoB,OAAOG,CAAU,EACrCJ,EAAoB,OAAOM,CAAO,EAClC,MAAMD,EAAME,GAAA,YAAAA,EAAM,OAClB,OAAO,KAAK,SAAS,KAAMF,GAAO,EAAE,CACtC,MAAWF,EAAQ,UAEjBE,EAAM,OAAO,KAAKF,EAAQ,QAAS,QAAQ,EAAE,SAAS,OAAO,GAG/D,GAAIE,EAEF,OAAO,KAAK,SAAS,KAAMA,GAAO,EAAE,EAGtC,KAAK,SAAS,CAAE,QAAS,eAAgB,KAAM,aAAc,CAAC,CAChE",
6
+ "names": ["css_exports", "__export", "loader", "extractedInfoByFile", "stylePathToFilePath", "__toCommonJS", "options", "sourcePath", "out", "pathKey", "info"]
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -1,55 +1,2 @@
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;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var src_exports = {};
31
- __export(src_exports, {
32
- default: () => src_default,
33
- shouldExclude: () => shouldExclude
34
- });
35
- module.exports = __toCommonJS(src_exports);
36
- var import_path = __toESM(require("path"));
37
- __reExport(src_exports, require("./plugin"), module.exports);
38
- process.env.TAMAGUI_TARGET = process.env.TAMAGUI_TARGET || "web";
39
- process.env.TAMAGUI_COMPILE_PROCESS = "1";
40
- process.env.IS_STATIC = "is_static";
41
- var src_default = require("./loader").loader;
42
- const shouldExclude = (filePath, projectRoot) => {
43
- if (filePath.includes(projectRoot) && filePath.endsWith("sx") || isTamaguiDistJSX(filePath)) {
44
- return false;
45
- }
46
- return true;
47
- };
48
- function isTamaguiDistJSX(filePath) {
49
- return filePath.includes("/dist/jsx/".replace(/\//g, import_path.default.sep));
50
- }
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- shouldExclude
54
- });
1
+ "use strict";var T=Object.create;var i=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var x=(e,s)=>{for(var r in s)i(e,r,{get:s[r],enumerable:!0})},n=(e,s,r,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let t of d(s))!l.call(e,t)&&t!==r&&i(e,t,{get:()=>s[t],enumerable:!(c=A(s,t))||c.enumerable});return e},u=(e,s,r)=>(n(e,s,"default"),r&&n(r,s,"default")),I=(e,s,r)=>(r=e!=null?T(a(e)):{},n(s||!e||!e.__esModule?i(r,"default",{value:e,enumerable:!0}):r,e)),_=e=>n(i({},"__esModule",{value:!0}),e);var o={};x(o,{default:()=>g,shouldExclude:()=>E});module.exports=_(o);var p=I(require("path"));u(o,require("./plugin"),module.exports);process.env.TAMAGUI_TARGET=process.env.TAMAGUI_TARGET||"web",process.env.TAMAGUI_COMPILE_PROCESS="1",process.env.IS_STATIC="is_static";var g=require("./loader").loader;const E=(e,s)=>!(e.includes(s)&&e.endsWith("sx")||G(e));function G(e){return e.includes("/dist/jsx/".replace(/\//g,p.default.sep))}0&&(module.exports={shouldExclude});
55
2
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": ["import path from 'path'\n\nprocess.env.TAMAGUI_TARGET = process.env.TAMAGUI_TARGET || 'web'\nprocess.env.TAMAGUI_COMPILE_PROCESS = '1'\nprocess.env.IS_STATIC = 'is_static'\n\nexport * from './plugin'\n\nexport default require('./loader').loader\n\n// helper for webpack exclude specific to tamagui\n\nexport const shouldExclude = (filePath: string, projectRoot: string) => {\n if (\n (filePath.includes(projectRoot) && filePath.endsWith('sx')) ||\n isTamaguiDistJSX(filePath)\n ) {\n return false\n }\n return true\n}\n\nfunction isTamaguiDistJSX(filePath: string) {\n return filePath.includes('/dist/jsx/'.replace(/\\//g, path.sep))\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAMjB,wBAAc,qBANd;AAEA,QAAQ,IAAI,iBAAiB,QAAQ,IAAI,kBAAkB;AAC3D,QAAQ,IAAI,0BAA0B;AACtC,QAAQ,IAAI,YAAY;AAIxB,IAAO,cAAQ,QAAQ,UAAU,EAAE;AAI5B,MAAM,gBAAgB,CAAC,UAAkB,gBAAwB;AACtE,MACG,SAAS,SAAS,WAAW,KAAK,SAAS,SAAS,IAAI,KACzD,iBAAiB,QAAQ,GACzB;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,iBAAiB,UAAkB;AAC1C,SAAO,SAAS,SAAS,aAAa,QAAQ,OAAO,YAAAA,QAAK,GAAG,CAAC;AAChE;",
6
- "names": ["path"]
5
+ "mappings": "wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,kBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAiB,mBAMjBC,EAAAN,EAAc,oBANd,gBAEA,QAAQ,IAAI,eAAiB,QAAQ,IAAI,gBAAkB,MAC3D,QAAQ,IAAI,wBAA0B,IACtC,QAAQ,IAAI,UAAY,YAIxB,IAAOE,EAAQ,QAAQ,UAAU,EAAE,OAI5B,MAAMC,EAAgB,CAACI,EAAkBC,IAE3C,EAAAD,EAAS,SAASC,CAAW,GAAKD,EAAS,SAAS,IAAI,GACzDE,EAAiBF,CAAQ,GAO7B,SAASE,EAAiBF,EAAkB,CAC1C,OAAOA,EAAS,SAAS,aAAa,QAAQ,MAAO,EAAAG,QAAK,GAAG,CAAC,CAChE",
6
+ "names": ["src_exports", "__export", "src_default", "shouldExclude", "__toCommonJS", "import_path", "__reExport", "filePath", "projectRoot", "isTamaguiDistJSX", "path"]
7
7
  }
@@ -1,105 +1,7 @@
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;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], 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", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var loader_exports = {};
30
- __export(loader_exports, {
31
- loader: () => loader
32
- });
33
- module.exports = __toCommonJS(loader_exports);
34
- var import_cli_color = require("@tamagui/cli-color");
35
- var import_static = require("@tamagui/static");
36
- var import_css = require("./css");
37
- Error.stackTraceLimit = Infinity;
38
- const CSS_LOADER_PATH = require.resolve("./css");
39
- Error.stackTraceLimit = Infinity;
40
- const extractor = (0, import_static.createExtractor)();
41
- let index = 0;
42
- process.env.TAMAGUI_TARGET = "web";
43
- const loader = async function loader2(sourceIn) {
44
- this.cacheable(true);
45
- const callback = this.async();
46
- const source = sourceIn.toString();
47
- try {
48
- const threaded = this.emitFile === void 0;
49
- const options = { ...this.getOptions() };
50
- const sourcePath = `${this.resourcePath}`;
51
- const { shouldDisable, shouldPrintDebug } = (0, import_static.getPragmaOptions)({
52
- source,
53
- path: sourcePath
54
- });
55
- if (shouldDisable) {
56
- if (shouldPrintDebug) {
57
- console.log("Disabling on file via pragma");
58
- }
59
- return callback(null, source);
60
- }
61
- const cssPath = threaded ? `${sourcePath}.tamagui.css` : `${sourcePath}.${index++}.tamagui.css`;
62
- const extracted = await (0, import_static.extractToClassNames)({
63
- extractor,
64
- source,
65
- sourcePath,
66
- options,
67
- shouldPrintDebug
68
- });
69
- if (!extracted) {
70
- return callback(null, source);
71
- }
72
- if (extracted.styles) {
73
- const cssQuery = threaded ? `cssData=${Buffer.from(extracted.styles).toString("base64")}` : `cssPath=${cssPath}`;
74
- const remReq = this.remainingRequest;
75
- const importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`;
76
- extracted.js = `${extracted.js}
1
+ "use strict";var b=Object.create;var l=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var C=(t,s)=>{for(var o in s)l(t,o,{get:s[o],enumerable:!0})},h=(t,s,o,a)=>{if(s&&typeof s=="object"||typeof s=="function")for(let e of P(s))!k.call(t,e)&&e!==o&&l(t,e,{get:()=>s[e],enumerable:!(a=T(s,e))||a.enumerable});return t};var E=(t,s,o)=>(o=t!=null?b(x(t)):{},h(s||!t||!t.__esModule?l(o,"default",{value:t,enumerable:!0}):o,t)),L=t=>h(l({},"__esModule",{value:!0}),t);var D={};C(D,{loader:()=>A});module.exports=L(D);var u=require("@tamagui/cli-color"),n=require("@tamagui/static"),m=require("./css");Error.stackTraceLimit=1/0;const O=require.resolve("./css");Error.stackTraceLimit=1/0;const S=(0,n.createExtractor)();let w=0;process.env.TAMAGUI_TARGET="web";const A=async function(s){this.cacheable(!0);const o=this.async(),a=s.toString();try{const e=this.emitFile===void 0,c={...this.getOptions()},i=`${this.resourcePath}`,{shouldDisable:p,shouldPrintDebug:g}=(0,n.getPragmaOptions)({source:a,path:i});if(p)return g&&console.log("Disabling on file via pragma"),o(null,a);const f=e?`${i}.tamagui.css`:`${i}.${w++}.tamagui.css`,r=await(0,n.extractToClassNames)({extractor:S,source:a,sourcePath:i,options:c,shouldPrintDebug:g});if(!r)return o(null,a);if(r.styles){const d=e?`cssData=${Buffer.from(r.styles).toString("base64")}`:`cssPath=${f}`,y=this.remainingRequest,$=`${f}!=!${O}?${d}!${y}`;r.js=`${r.js}
77
2
 
78
- require(${JSON.stringify(importPath)})`;
79
- }
80
- import_css.extractedInfoByFile.set(sourcePath, extracted);
81
- if (!threaded) {
82
- if (extracted.stylesPath) {
83
- import_css.stylePathToFilePath.set(extracted.stylesPath, sourcePath);
84
- }
85
- }
86
- callback(null, extracted.js, extracted.map);
87
- } catch (err) {
88
- const message = err instanceof Error ? `${err.message}
89
- ${err.stack}` : String(err);
90
- console.error("Tamagui Webpack Loader Error:\n", ` ${message}
91
- `);
92
- if (message.includes("Cannot create proxy")) {
93
- console.log(
94
- "This is usually due to components not loading at build-time. Check for logs just below the line above:"
95
- );
96
- (0, import_cli_color.colorLog)(import_cli_color.Color.FgYellow, `"Tamagui built config and components"`);
97
- }
98
- return this.callback(null, source);
99
- }
100
- };
101
- // Annotate the CommonJS export names for ESM import in node:
102
- 0 && (module.exports = {
103
- loader
104
- });
3
+ require(${JSON.stringify($)})`}m.extractedInfoByFile.set(i,r),e||r.stylesPath&&m.stylePathToFilePath.set(r.stylesPath,i),o(null,r.js,r.map)}catch(e){const c=e instanceof Error?`${e.message}
4
+ ${e.stack}`:String(e);return console.error(`Tamagui Webpack Loader Error:
5
+ `,` ${c}
6
+ `),c.includes("Cannot create proxy")&&(console.log("This is usually due to components not loading at build-time. Check for logs just below the line above:"),(0,u.colorLog)(u.Color.FgYellow,'"Tamagui built config and components"')),this.callback(null,a)}};0&&(module.exports={loader});
105
7
  //# sourceMappingURL=loader.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/loader.ts"],
4
4
  "sourcesContent": ["import { Color, colorLog } from '@tamagui/cli-color'\nimport {\n TamaguiOptions,\n createExtractor,\n extractToClassNames,\n getPragmaOptions,\n} from '@tamagui/static'\nimport type { LoaderContext } from 'webpack'\n\nimport { extractedInfoByFile, stylePathToFilePath } from './css'\n\nError.stackTraceLimit = Infinity\n\n// pass loader as path\nconst CSS_LOADER_PATH = require.resolve('./css')\n\nError.stackTraceLimit = Infinity\nconst extractor = createExtractor()\n\nlet index = 0\n\nprocess.env.TAMAGUI_TARGET = 'web'\n\nexport const loader = async function loader(\n this: LoaderContext<TamaguiOptions>,\n sourceIn: Buffer | string\n) {\n this.cacheable(true)\n const callback = this.async()\n const source = sourceIn.toString()\n\n try {\n const threaded = this.emitFile === undefined\n const options: TamaguiOptions = { ...this.getOptions() }\n const sourcePath = `${this.resourcePath}`\n const { shouldDisable, shouldPrintDebug } = getPragmaOptions({\n source,\n path: sourcePath,\n })\n\n if (shouldDisable) {\n if (shouldPrintDebug) {\n // eslint-disable-next-line no-console\n console.log('Disabling on file via pragma')\n }\n return callback(null, source)\n }\n\n const cssPath = threaded\n ? `${sourcePath}.tamagui.css`\n : `${sourcePath}.${index++}.tamagui.css`\n\n const extracted = await extractToClassNames({\n extractor,\n source,\n sourcePath,\n options,\n shouldPrintDebug,\n })\n\n if (!extracted) {\n return callback(null, source)\n }\n\n // add import to css\n if (extracted.styles) {\n const cssQuery = threaded\n ? `cssData=${Buffer.from(extracted.styles).toString('base64')}`\n : `cssPath=${cssPath}`\n const remReq = this.remainingRequest\n const importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`\n extracted.js = `${extracted.js}\\n\\nrequire(${JSON.stringify(importPath)})`\n }\n\n extractedInfoByFile.set(sourcePath, extracted)\n\n if (!threaded) {\n if (extracted.stylesPath) {\n stylePathToFilePath.set(extracted.stylesPath, sourcePath)\n }\n }\n\n callback(null, extracted.js, extracted.map)\n } catch (err) {\n const message = err instanceof Error ? `${err.message}\\n${err.stack}` : String(err)\n\n // eslint-disable-next-line no-console\n console.error('Tamagui Webpack Loader Error:\\n', ` ${message}\\n`)\n\n if (message.includes('Cannot create proxy')) {\n // eslint-disable-next-line no-console\n console.log(\n 'This is usually due to components not loading at build-time. Check for logs just below the line above:'\n )\n colorLog(Color.FgYellow, `\"Tamagui built config and components\"`)\n }\n\n return this.callback(null, source)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,oBAKO;AAGP,iBAAyD;AAEzD,MAAM,kBAAkB;AAGxB,MAAM,kBAAkB,gBAAgB,OAAO;AAE/C,MAAM,k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AU,OAAQ,CACpB,MAAMC,EAAWP,EACb,WAAW,OAAO,KAAKM,EAAU,MAAM,EAAE,SAAS,QAAQ,IAC1D,WAAWD,IACTG,EAAS,KAAK,iBACdC,EAAa,GAAGJ,OAAaX,KAAmBa,KAAYC,IAClEF,EAAU,GAAK,GAAGA,EAAU;AAAA;AAAA,UAAiB,KAAK,UAAUG,CAAU,IACxE,CAEA,sBAAoB,IAAIP,EAAYI,CAAS,EAExCN,GACCM,EAAU,YACZ,sBAAoB,IAAIA,EAAU,WAAYJ,CAAU,EAI5DJ,EAAS,KAAMQ,EAAU,GAAIA,EAAU,GAAG,CAC5C,OAASI,EAAP,CACA,MAAMC,EAAUD,aAAe,MAAQ,GAAGA,EAAI;AAAA,EAAYA,EAAI,QAAU,OAAOA,CAAG,EAGlF,eAAQ,MAAM;AAAA,EAAmC,KAAKC;AAAA,CAAW,EAE7DA,EAAQ,SAAS,qBAAqB,IAExC,QAAQ,IACN,wGACF,KACA,YAAS,QAAM,SAAU,uCAAuC,GAG3D,KAAK,SAAS,KAAMZ,CAAM,CACnC,CACF",
6
+ "names": ["loader_exports", "__export", "loader", "__toCommonJS", "import_cli_color", "import_static", "import_css", "CSS_LOADER_PATH", "extractor", "index", "sourceIn", "callback", "source", "threaded", "options", "sourcePath", "shouldDisable", "shouldPrintDebug", "cssPath", "extracted", "cssQuery", "remReq", "importPath", "err", "message"]
7
7
  }
@@ -1,126 +1,2 @@
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;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], 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", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var plugin_exports = {};
30
- __export(plugin_exports, {
31
- TamaguiPlugin: () => TamaguiPlugin
32
- });
33
- module.exports = __toCommonJS(plugin_exports);
34
- class TamaguiPlugin {
35
- constructor(options = {
36
- components: ["@tamagui/core"]
37
- }) {
38
- this.options = options;
39
- this.pluginName = "TamaguiPlugin";
40
- }
41
- apply(compiler) {
42
- var _a;
43
- compiler.hooks.normalModuleFactory.tap(this.pluginName, (nmf) => {
44
- nmf.hooks.createModule.tap(
45
- this.pluginName,
46
- // @ts-expect-error CreateData is typed as 'object'...
47
- (createData) => {
48
- var _a2;
49
- if ((_a2 = createData.matchResource) == null ? void 0 : _a2.endsWith(".tamagui.css")) {
50
- createData.settings.sideEffects = true;
51
- }
52
- }
53
- );
54
- });
55
- compiler.options.resolve.extensions = [
56
- .../* @__PURE__ */ new Set([
57
- ".web.tsx",
58
- ".web.ts",
59
- ".web.js",
60
- ".ts",
61
- ".tsx",
62
- ".js",
63
- ...compiler.options.resolve.extensions || []
64
- ])
65
- ];
66
- const mainFields = compiler.options.resolve.mainFields;
67
- if (mainFields) {
68
- compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [mainFields];
69
- mainFields.unshift("module:jsx");
70
- }
71
- if (!compiler.options.module) {
72
- return;
73
- }
74
- const { jsLoader } = this.options;
75
- const existing = compiler.options.module.rules;
76
- const rules = ((_a = existing.find((x) => typeof x === "object" && "oneOf" in x ? x : null)) == null ? void 0 : _a.oneOf) ?? existing;
77
- const nextJsRules = rules.findIndex(
78
- (x) => (x == null ? void 0 : x.use) && x.use.loader === "next-swc-loader" && x.issuerLayer !== "api"
79
- );
80
- const startIndex = nextJsRules ? nextJsRules + 1 : 0;
81
- const existingLoader = nextJsRules ? rules[startIndex] : void 0;
82
- rules.splice(startIndex, 0, {
83
- test: this.options.test ?? /\.m?[jt]sx?$/,
84
- exclude: this.options.exclude,
85
- resolve: {
86
- fullySpecified: false
87
- },
88
- use: [
89
- ...jsLoader ? [jsLoader] : [],
90
- ...existingLoader && nextJsRules ? [].concat(existingLoader.use) : [],
91
- ...!(jsLoader || existingLoader) ? [
92
- {
93
- loader: require.resolve("esbuild-loader"),
94
- options: {
95
- target: "es2021",
96
- keepNames: true,
97
- loader: {
98
- ".tsx": "tsx",
99
- ".png": "copy",
100
- ".jpg": "copy",
101
- ".gif": "copy"
102
- },
103
- tsconfigRaw: {
104
- module: this.options.commonjs ? "commonjs" : "esnext",
105
- isolatedModules: true,
106
- jsx: "preserve",
107
- resolveJsonModule: true
108
- }
109
- }
110
- }
111
- ] : [],
112
- {
113
- loader: require.resolve("tamagui-loader"),
114
- options: {
115
- ...this.options
116
- }
117
- }
118
- ]
119
- });
120
- }
121
- }
122
- // Annotate the CommonJS export names for ESM import in node:
123
- 0 && (module.exports = {
124
- TamaguiPlugin
125
- });
1
+ "use strict";var y=Object.create;var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var v=(s,e)=>{for(var o in e)a(s,o,{get:e[o],enumerable:!0})},g=(s,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!R.call(s,n)&&n!==o&&a(s,n,{get:()=>e[n],enumerable:!(i=h(e,n))||i.enumerable});return s};var f=(s,e,o)=>(o=s!=null?y(j(s)):{},g(e||!s||!s.__esModule?a(o,"default",{value:s,enumerable:!0}):o,s)),b=s=>g(a({},"__esModule",{value:!0}),s);var O={};v(O,{TamaguiPlugin:()=>w});module.exports=b(O);class w{constructor(e={components:["@tamagui/core"]}){this.options=e;this.pluginName="TamaguiPlugin"}apply(e){var c;e.hooks.normalModuleFactory.tap(this.pluginName,t=>{t.hooks.createModule.tap(this.pluginName,d=>{var m;(m=d.matchResource)!=null&&m.endsWith(".tamagui.css")&&(d.settings.sideEffects=!0)})}),e.options.resolve.extensions=[...new Set([".web.tsx",".web.ts",".web.js",".ts",".tsx",".js",...e.options.resolve.extensions||[]])];const o=e.options.resolve.mainFields;if(o&&(e.options.resolve.mainFields=Array.isArray(o)?o:[o],o.unshift("module:jsx")),!e.options.module)return;const{jsLoader:i}=this.options,n=e.options.module.rules,l=((c=n.find(t=>typeof t=="object"&&"oneOf"in t?t:null))==null?void 0:c.oneOf)??n,u=l.findIndex(t=>(t==null?void 0:t.use)&&t.use.loader==="next-swc-loader"&&t.issuerLayer!=="api"),p=u?u+1:0,r=u?l[p]:void 0;l.splice(p,0,{test:this.options.test??/\.m?[jt]sx?$/,exclude:this.options.exclude,resolve:{fullySpecified:!1},use:[...i?[i]:[],...r&&u?[].concat(r.use):[],...i||r?[]:[{loader:require.resolve("esbuild-loader"),options:{target:"es2021",keepNames:!0,loader:{".tsx":"tsx",".png":"copy",".jpg":"copy",".gif":"copy"},tsconfigRaw:{module:this.options.commonjs?"commonjs":"esnext",isolatedModules:!0,jsx:"preserve",resolveJsonModule:!0}}}],{loader:require.resolve("tamagui-loader"),options:{...this.options}}]})}}0&&(module.exports={TamaguiPlugin});
126
2
  //# sourceMappingURL=plugin.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/plugin.ts"],
4
4
  "sourcesContent": ["import type { TamaguiOptions } from '@tamagui/static'\nimport type { Compiler, RuleSetRule } from 'webpack'\n\ntype PluginOptions = TamaguiOptions & {\n commonjs?: boolean\n exclude?: RuleSetRule['exclude']\n test?: RuleSetRule['test']\n jsLoader?: any\n}\n\nexport class TamaguiPlugin {\n pluginName = 'TamaguiPlugin'\n\n constructor(\n public options: PluginOptions = {\n components: ['@tamagui/core'],\n }\n ) {}\n\n apply(compiler: Compiler) {\n // mark as side effect\n compiler.hooks.normalModuleFactory.tap(this.pluginName, (nmf) => {\n nmf.hooks.createModule.tap(\n this.pluginName,\n // @ts-expect-error CreateData is typed as 'object'...\n (createData: { matchResource?: string; settings: { sideEffects?: boolean } }) => {\n if (createData.matchResource?.endsWith('.tamagui.css')) {\n createData.settings.sideEffects = true\n }\n }\n )\n })\n\n compiler.options.resolve.extensions = [\n ...new Set([\n '.web.tsx',\n '.web.ts',\n '.web.js',\n '.ts',\n '.tsx',\n '.js',\n ...(compiler.options.resolve.extensions || []),\n ]),\n ]\n\n // look for compiled js with jsx intact as specified by module:jsx\n const mainFields = compiler.options.resolve.mainFields\n if (mainFields) {\n compiler.options.resolve.mainFields = Array.isArray(mainFields)\n ? mainFields\n : [mainFields]\n mainFields.unshift('module:jsx')\n }\n\n if (!compiler.options.module) {\n return\n }\n\n const { jsLoader } = this.options\n\n const existing = compiler.options.module.rules as any[]\n\n const rules =\n (existing.find((x) => (typeof x === 'object' && 'oneOf' in x ? x : null))\n ?.oneOf as any[]) ?? existing\n\n const nextJsRules = rules.findIndex(\n (x) => x?.use && x.use.loader === 'next-swc-loader' && x.issuerLayer !== 'api'\n )\n\n const startIndex = nextJsRules ? nextJsRules + 1 : 0\n const existingLoader = nextJsRules ? rules[startIndex] : undefined\n\n rules.splice(startIndex, 0, {\n test: this.options.test ?? /\\.m?[jt]sx?$/,\n exclude: this.options.exclude,\n resolve: {\n fullySpecified: false,\n },\n use: [\n ...(jsLoader ? [jsLoader] : []),\n ...(existingLoader && nextJsRules ? [].concat(existingLoader.use) : []),\n ...(!(jsLoader || existingLoader)\n ? [\n {\n loader: require.resolve('esbuild-loader'),\n options: {\n target: 'es2021',\n keepNames: true,\n loader: {\n '.tsx': 'tsx',\n '.png': 'copy',\n '.jpg': 'copy',\n '.gif': 'copy',\n },\n\n tsconfigRaw: {\n module: this.options.commonjs ? 'commonjs' : 'esnext',\n isolatedModules: true,\n jsx: 'preserve',\n resolveJsonModule: true,\n },\n },\n },\n ]\n : []),\n {\n loader: require.resolve('tamagui-loader'),\n options: {\n ...this.options,\n },\n },\n ],\n })\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,cAAc;AAAA,EAGzB,YACS,UAAyB;AAAA,IAC9B,YAAY,CAAC,eAAe;AAAA,EAC9B,GACA;AAHO;AAHT,sBAAa;AAAA,EAMV;AAAA,EAEH,MAAM,UAAoB;AAnB5B;AAqBI,aAAS,MAAM,oBAAoB,IAAI,KAAK,YAAY,CAAC,QAAQ;AAC/D,UAAI,MAAM,aAAa;AAAA,QACrB,KAAK;AAAA;AAAA,QAEL,CAAC,eAAgF;AAzBzF,cAAAA;AA0BU,eAAIA,MAAA,WAAW,kBAAX,gBAAAA,IAA0B,SAAS,iBAAiB;AACtD,uBAAW,SAAS,cAAc;AAAA,UACpC;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,aAAS,QAAQ,QAAQ,aAAa;AAAA,MACpC,GAAG,oBAAI,IAAI;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAI,SAAS,QAAQ,QAAQ,cAAc,CAAC;AAAA,MAC9C,CAAC;AAAA,IACH;AAGA,UAAM,aAAa,SAAS,QAAQ,QAAQ;AAC5C,QAAI,YAAY;AACd,eAAS,QAAQ,QAAQ,aAAa,MAAM,QAAQ,UAAU,IAC1D,aACA,CAAC,UAAU;AACf,iBAAW,QAAQ,YAAY;AAAA,IACjC;AAEA,QAAI,CAAC,SAAS,QAAQ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H,EAAM,OAAOG,EAAY,EAAG,CAC1B,KAAM,KAAK,QAAQ,MAAQ,eAC3B,QAAS,KAAK,QAAQ,QACtB,QAAS,CACP,eAAgB,EAClB,EACA,IAAK,CACH,GAAIL,EAAW,CAACA,CAAQ,EAAI,CAAC,EAC7B,GAAIM,GAAkBF,EAAc,CAAC,EAAE,OAAOE,EAAe,GAAG,EAAI,CAAC,EACrE,GAAMN,GAAYM,EAuBd,CAAC,EAtBD,CACE,CACE,OAAQ,gBAAgB,gBAAgB,EACxC,QAAS,CACP,OAAQ,SACR,UAAW,GACX,OAAQ,CACN,OAAQ,MACR,OAAQ,OACR,OAAQ,OACR,OAAQ,MACV,EAEA,YAAa,CACX,OAAQ,KAAK,QAAQ,SAAW,WAAa,SAC7C,gBAAiB,GACjB,IAAK,WACL,kBAAmB,EACrB,CACF,CACF,CACF,EAEJ,CACE,OAAQ,gBAAgB,gBAAgB,EACxC,QAAS,CACP,GAAG,KAAK,OACV,CACF,CACF,CACF,CAAC,CACH,CACF",
6
+ "names": ["plugin_exports", "__export", "TamaguiPlugin", "__toCommonJS", "options", "compiler", "_a", "nmf", "createData", "mainFields", "jsLoader", "existing", "rules", "x", "nextJsRules", "startIndex", "existingLoader"]
7
7
  }
package/dist/esm/css.js CHANGED
@@ -1,28 +1,2 @@
1
- const extractedInfoByFile = /* @__PURE__ */ new Map();
2
- const stylePathToFilePath = /* @__PURE__ */ new Map();
3
- function loader() {
4
- this.async();
5
- const options = { ...this.getOptions() };
6
- const sourcePath = `${this.resourcePath}`;
7
- let out = "";
8
- if (options.cssPath) {
9
- const pathKey = stylePathToFilePath.get(sourcePath) ?? sourcePath;
10
- const info = extractedInfoByFile.get(pathKey);
11
- stylePathToFilePath.delete(sourcePath);
12
- extractedInfoByFile.delete(pathKey);
13
- const out2 = info == null ? void 0 : info.styles;
14
- return this.callback(null, out2 || "");
15
- } else if (options.cssData) {
16
- out = Buffer.from(options.cssData, "base64").toString("utf-8");
17
- }
18
- if (out) {
19
- return this.callback(null, out || "");
20
- }
21
- this.callback({ message: "No CSS found", name: "missing_css" });
22
- }
23
- export {
24
- loader as default,
25
- extractedInfoByFile,
26
- stylePathToFilePath
27
- };
1
+ const n=new Map,i=new Map;function c(){this.async();const t={...this.getOptions()},e=`${this.resourcePath}`;let s="";if(t.cssPath){const a=i.get(e)??e,o=n.get(a);i.delete(e),n.delete(a);const r=o==null?void 0:o.styles;return this.callback(null,r||"")}else t.cssData&&(s=Buffer.from(t.cssData,"base64").toString("utf-8"));if(s)return this.callback(null,s||"");this.callback({message:"No CSS found",name:"missing_css"})}export{c as default,n as extractedInfoByFile,i as stylePathToFilePath};
28
2
  //# sourceMappingURL=css.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/css.ts"],
4
4
  "sourcesContent": ["import { ExtractedResponse, TamaguiOptions } from '@tamagui/static'\nimport type { LoaderContext } from 'webpack'\n\nexport const extractedInfoByFile = new Map<string, ExtractedResponse>()\nexport const stylePathToFilePath = new Map<string, string>()\n\nexport default function loader(this: LoaderContext<TamaguiOptions>) {\n this.async()\n const options = { ...this.getOptions() }\n const sourcePath = `${this.resourcePath}`\n let out = ''\n if (options.cssPath) {\n // get in memory info\n const pathKey = stylePathToFilePath.get(sourcePath) ?? sourcePath\n const info = extractedInfoByFile.get(pathKey)\n // clear memory\n stylePathToFilePath.delete(sourcePath)\n extractedInfoByFile.delete(pathKey)\n const out = info?.styles\n return this.callback(null, out || '')\n } else if (options.cssData) {\n // get output CSS\n out = Buffer.from(options.cssData, 'base64').toString('utf-8')\n }\n\n if (out) {\n // use original JS sourcemap\n return this.callback(null, out || '')\n }\n\n this.callback({ message: 'No CSS found', name: 'missing_css' })\n}\n"],
5
- "mappings": "AAGO,MAAM,sBAAsB,oBAAI,IAA+B;AAC/D,MAAM,sBAAsB,oBAAI,IAAoB;AAE5C,SAAR,SAA6D;AAClE,OAAK,MAAM;AACX,QAAM,UAAU,EAAE,GAAG,KAAK,WAAW,EAAE;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options", "sourcePath", "out", "pathKey", "info"]
7
7
  }
package/dist/esm/css.mjs CHANGED
@@ -1,28 +1,2 @@
1
- const extractedInfoByFile = /* @__PURE__ */ new Map();
2
- const stylePathToFilePath = /* @__PURE__ */ new Map();
3
- function loader() {
4
- this.async();
5
- const options = { ...this.getOptions() };
6
- const sourcePath = `${this.resourcePath}`;
7
- let out = "";
8
- if (options.cssPath) {
9
- const pathKey = stylePathToFilePath.get(sourcePath) ?? sourcePath;
10
- const info = extractedInfoByFile.get(pathKey);
11
- stylePathToFilePath.delete(sourcePath);
12
- extractedInfoByFile.delete(pathKey);
13
- const out2 = info == null ? void 0 : info.styles;
14
- return this.callback(null, out2 || "");
15
- } else if (options.cssData) {
16
- out = Buffer.from(options.cssData, "base64").toString("utf-8");
17
- }
18
- if (out) {
19
- return this.callback(null, out || "");
20
- }
21
- this.callback({ message: "No CSS found", name: "missing_css" });
22
- }
23
- export {
24
- loader as default,
25
- extractedInfoByFile,
26
- stylePathToFilePath
27
- };
1
+ const n=new Map,i=new Map;function c(){this.async();const t={...this.getOptions()},e=`${this.resourcePath}`;let s="";if(t.cssPath){const a=i.get(e)??e,o=n.get(a);i.delete(e),n.delete(a);const r=o==null?void 0:o.styles;return this.callback(null,r||"")}else t.cssData&&(s=Buffer.from(t.cssData,"base64").toString("utf-8"));if(s)return this.callback(null,s||"");this.callback({message:"No CSS found",name:"missing_css"})}export{c as default,n as extractedInfoByFile,i as stylePathToFilePath};
28
2
  //# sourceMappingURL=css.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/css.ts"],
4
4
  "sourcesContent": ["import { ExtractedResponse, TamaguiOptions } from '@tamagui/static'\nimport type { LoaderContext } from 'webpack'\n\nexport const extractedInfoByFile = new Map<string, ExtractedResponse>()\nexport const stylePathToFilePath = new Map<string, string>()\n\nexport default function loader(this: LoaderContext<TamaguiOptions>) {\n this.async()\n const options = { ...this.getOptions() }\n const sourcePath = `${this.resourcePath}`\n let out = ''\n if (options.cssPath) {\n // get in memory info\n const pathKey = stylePathToFilePath.get(sourcePath) ?? sourcePath\n const info = extractedInfoByFile.get(pathKey)\n // clear memory\n stylePathToFilePath.delete(sourcePath)\n extractedInfoByFile.delete(pathKey)\n const out = info?.styles\n return this.callback(null, out || '')\n } else if (options.cssData) {\n // get output CSS\n out = Buffer.from(options.cssData, 'base64').toString('utf-8')\n }\n\n if (out) {\n // use original JS sourcemap\n return this.callback(null, out || '')\n }\n\n this.callback({ message: 'No CSS found', name: 'missing_css' })\n}\n"],
5
- "mappings": "AAGO,MAAM,sBAAsB,oBAAI,IAA+B;AAC/D,MAAM,sBAAsB,oBAAI,IAAoB;AAE5C,SAAR,SAA6D;AAClE,OAAK,MAAM;AACX,QAAM,UAAU,EAAE,GAAG,KAAK,WAAW,EAAE;AACvC,QAAM,aAAa,GAAG,KAAK;AAC3B,MAAI,MAAM;AACV,MAAI,QAAQ,SAAS;AAEnB,UAAM,UAAU,oBAAoB,IAAI,UAAU,KAAK;AACvD,UAAM,OAAO,oBAAoB,IAAI,OAAO;AAE5C,wBAAoB,OAAO,UAAU;AACrC,wBAAoB,OAAO,OAAO;AAClC,UAAMA,OAAM,6BAAM;AAClB,WAAO,KAAK,SAAS,MAAMA,QAAO,EAAE;AAAA,EACtC,WAAW,QAAQ,SAAS;AAE1B,UAAM,OAAO,KAAK,QAAQ,SAAS,QAAQ,EAAE,SAAS,OAAO;AAAA,EAC/D;AAEA,MAAI,KAAK;AAEP,WAAO,KAAK,SAAS,MAAM,OAAO,EAAE;AAAA,EACtC;AAEA,OAAK,SAAS,EAAE,SAAS,gBAAgB,MAAM,cAAc,CAAC;AAChE;",
6
- "names": ["out"]
5
+ "mappings": "AAGO,MAAMA,EAAsB,IAAI,IAC1BC,EAAsB,IAAI,IAExB,SAARC,GAA6D,CAClE,KAAK,MAAM,EACX,MAAMC,EAAU,CAAE,GAAG,KAAK,WAAW,CAAE,EACjCC,EAAa,GAAG,KAAK,eAC3B,IAAIC,EAAM,GACV,GAAIF,EAAQ,QAAS,CAEnB,MAAMG,EAAUL,EAAoB,IAAIG,CAAU,GAAKA,EACjDG,EAAOP,EAAoB,IAAIM,CAAO,EAE5CL,EAAoB,OAAOG,CAAU,EACrCJ,EAAoB,OAAOM,CAAO,EAClC,MAAMD,EAAME,GAAA,YAAAA,EAAM,OAClB,OAAO,KAAK,SAAS,KAAMF,GAAO,EAAE,CACtC,MAAWF,EAAQ,UAEjBE,EAAM,OAAO,KAAKF,EAAQ,QAAS,QAAQ,EAAE,SAAS,OAAO,GAG/D,GAAIE,EAEF,OAAO,KAAK,SAAS,KAAMA,GAAO,EAAE,EAGtC,KAAK,SAAS,CAAE,QAAS,eAAgB,KAAM,aAAc,CAAC,CAChE",
6
+ "names": ["extractedInfoByFile", "stylePathToFilePath", "loader", "options", "sourcePath", "out", "pathKey", "info"]
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,20 +1,2 @@
1
- import path from "path";
2
- process.env.TAMAGUI_TARGET = process.env.TAMAGUI_TARGET || "web";
3
- process.env.TAMAGUI_COMPILE_PROCESS = "1";
4
- process.env.IS_STATIC = "is_static";
5
- export * from "./plugin";
6
- var src_default = require("./loader").loader;
7
- const shouldExclude = (filePath, projectRoot) => {
8
- if (filePath.includes(projectRoot) && filePath.endsWith("sx") || isTamaguiDistJSX(filePath)) {
9
- return false;
10
- }
11
- return true;
12
- };
13
- function isTamaguiDistJSX(filePath) {
14
- return filePath.includes("/dist/jsx/".replace(/\//g, path.sep));
15
- }
16
- export {
17
- src_default as default,
18
- shouldExclude
19
- };
1
+ import r from"path";process.env.TAMAGUI_TARGET=process.env.TAMAGUI_TARGET||"web",process.env.TAMAGUI_COMPILE_PROCESS="1",process.env.IS_STATIC="is_static";export*from"./plugin";var i=require("./loader").loader;const o=(e,s)=>!(e.includes(s)&&e.endsWith("sx")||t(e));function t(e){return e.includes("/dist/jsx/".replace(/\//g,r.sep))}export{i as default,o as shouldExclude};
20
2
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": ["import path from 'path'\n\nprocess.env.TAMAGUI_TARGET = process.env.TAMAGUI_TARGET || 'web'\nprocess.env.TAMAGUI_COMPILE_PROCESS = '1'\nprocess.env.IS_STATIC = 'is_static'\n\nexport * from './plugin'\n\nexport default require('./loader').loader\n\n// helper for webpack exclude specific to tamagui\n\nexport const shouldExclude = (filePath: string, projectRoot: string) => {\n if (\n (filePath.includes(projectRoot) && filePath.endsWith('sx')) ||\n isTamaguiDistJSX(filePath)\n ) {\n return false\n }\n return true\n}\n\nfunction isTamaguiDistJSX(filePath: string) {\n return filePath.includes('/dist/jsx/'.replace(/\\//g, path.sep))\n}\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AAEjB,QAAQ,IAAI,iBAAiB,QAAQ,IAAI,kBAAkB;AAC3D,QAAQ,IAAI,0BAA0B;AACtC,QAAQ,IAAI,YAAY;AAExB,cAAc;AAEd,IAAO,cAAQ,QAAQ,UAAU,EAAE;AAI5B,MAAM,gBAAgB,CAAC,UAAkB,gBAAwB;AACtE,MACG,SAAS,SAAS,WAAW,KAAK,SAAS,SAAS,IAAI,KACzD,iBAAiB,QAAQ,GACzB;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,iBAAiB,UAAkB;AAC1C,SAAO,SAAS,SAAS,aAAa,QAAQ,OAAO,KAAK,GAAG,CAAC;AAChE;",
6
- "names": []
5
+ "mappings": "AAAA,OAAOA,MAAU,OAEjB,QAAQ,IAAI,eAAiB,QAAQ,IAAI,gBAAkB,MAC3D,QAAQ,IAAI,wBAA0B,IACtC,QAAQ,IAAI,UAAY,YAExB,WAAc,WAEd,IAAOC,EAAQ,QAAQ,UAAU,EAAE,OAI5B,MAAMC,EAAgB,CAACC,EAAkBC,IAE3C,EAAAD,EAAS,SAASC,CAAW,GAAKD,EAAS,SAAS,IAAI,GACzDE,EAAiBF,CAAQ,GAO7B,SAASE,EAAiBF,EAAkB,CAC1C,OAAOA,EAAS,SAAS,aAAa,QAAQ,MAAOH,EAAK,GAAG,CAAC,CAChE",
6
+ "names": ["path", "src_default", "shouldExclude", "filePath", "projectRoot", "isTamaguiDistJSX"]
7
7
  }
@@ -1,20 +1,2 @@
1
- import path from "path";
2
- process.env.TAMAGUI_TARGET = process.env.TAMAGUI_TARGET || "web";
3
- process.env.TAMAGUI_COMPILE_PROCESS = "1";
4
- process.env.IS_STATIC = "is_static";
5
- export * from "./plugin";
6
- var src_default = require("./loader").loader;
7
- const shouldExclude = (filePath, projectRoot) => {
8
- if (filePath.includes(projectRoot) && filePath.endsWith("sx") || isTamaguiDistJSX(filePath)) {
9
- return false;
10
- }
11
- return true;
12
- };
13
- function isTamaguiDistJSX(filePath) {
14
- return filePath.includes("/dist/jsx/".replace(/\//g, path.sep));
15
- }
16
- export {
17
- src_default as default,
18
- shouldExclude
19
- };
1
+ import r from"path";process.env.TAMAGUI_TARGET=process.env.TAMAGUI_TARGET||"web",process.env.TAMAGUI_COMPILE_PROCESS="1",process.env.IS_STATIC="is_static";export*from"./plugin";var i=require("./loader").loader;const o=(e,s)=>!(e.includes(s)&&e.endsWith("sx")||t(e));function t(e){return e.includes("/dist/jsx/".replace(/\//g,r.sep))}export{i as default,o as shouldExclude};
20
2
  //# sourceMappingURL=index.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": ["import path from 'path'\n\nprocess.env.TAMAGUI_TARGET = process.env.TAMAGUI_TARGET || 'web'\nprocess.env.TAMAGUI_COMPILE_PROCESS = '1'\nprocess.env.IS_STATIC = 'is_static'\n\nexport * from './plugin'\n\nexport default require('./loader').loader\n\n// helper for webpack exclude specific to tamagui\n\nexport const shouldExclude = (filePath: string, projectRoot: string) => {\n if (\n (filePath.includes(projectRoot) && filePath.endsWith('sx')) ||\n isTamaguiDistJSX(filePath)\n ) {\n return false\n }\n return true\n}\n\nfunction isTamaguiDistJSX(filePath: string) {\n return filePath.includes('/dist/jsx/'.replace(/\\//g, path.sep))\n}\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AAEjB,QAAQ,IAAI,iBAAiB,QAAQ,IAAI,kBAAkB;AAC3D,QAAQ,IAAI,0BAA0B;AACtC,QAAQ,IAAI,YAAY;AAExB,cAAc;AAEd,IAAO,cAAQ,QAAQ,UAAU,EAAE;AAI5B,MAAM,gBAAgB,CAAC,UAAkB,gBAAwB;AACtE,MACG,SAAS,SAAS,WAAW,KAAK,SAAS,SAAS,IAAI,KACzD,iBAAiB,QAAQ,GACzB;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,iBAAiB,UAAkB;AAC1C,SAAO,SAAS,SAAS,aAAa,QAAQ,OAAO,KAAK,GAAG,CAAC;AAChE;",
6
- "names": []
5
+ "mappings": "AAAA,OAAOA,MAAU,OAEjB,QAAQ,IAAI,eAAiB,QAAQ,IAAI,gBAAkB,MAC3D,QAAQ,IAAI,wBAA0B,IACtC,QAAQ,IAAI,UAAY,YAExB,WAAc,WAEd,IAAOC,EAAQ,QAAQ,UAAU,EAAE,OAI5B,MAAMC,EAAgB,CAACC,EAAkBC,IAE3C,EAAAD,EAAS,SAASC,CAAW,GAAKD,EAAS,SAAS,IAAI,GACzDE,EAAiBF,CAAQ,GAO7B,SAASE,EAAiBF,EAAkB,CAC1C,OAAOA,EAAS,SAAS,aAAa,QAAQ,MAAOH,EAAK,GAAG,CAAC,CAChE",
6
+ "names": ["path", "src_default", "shouldExclude", "filePath", "projectRoot", "isTamaguiDistJSX"]
7
7
  }
@@ -1,75 +1,7 @@
1
- import { Color, colorLog } from "@tamagui/cli-color";
2
- import {
3
- createExtractor,
4
- extractToClassNames,
5
- getPragmaOptions
6
- } from "@tamagui/static";
7
- import { extractedInfoByFile, stylePathToFilePath } from "./css";
8
- Error.stackTraceLimit = Infinity;
9
- const CSS_LOADER_PATH = require.resolve("./css");
10
- Error.stackTraceLimit = Infinity;
11
- const extractor = createExtractor();
12
- let index = 0;
13
- process.env.TAMAGUI_TARGET = "web";
14
- const loader = async function loader2(sourceIn) {
15
- this.cacheable(true);
16
- const callback = this.async();
17
- const source = sourceIn.toString();
18
- try {
19
- const threaded = this.emitFile === void 0;
20
- const options = { ...this.getOptions() };
21
- const sourcePath = `${this.resourcePath}`;
22
- const { shouldDisable, shouldPrintDebug } = getPragmaOptions({
23
- source,
24
- path: sourcePath
25
- });
26
- if (shouldDisable) {
27
- if (shouldPrintDebug) {
28
- console.log("Disabling on file via pragma");
29
- }
30
- return callback(null, source);
31
- }
32
- const cssPath = threaded ? `${sourcePath}.tamagui.css` : `${sourcePath}.${index++}.tamagui.css`;
33
- const extracted = await extractToClassNames({
34
- extractor,
35
- source,
36
- sourcePath,
37
- options,
38
- shouldPrintDebug
39
- });
40
- if (!extracted) {
41
- return callback(null, source);
42
- }
43
- if (extracted.styles) {
44
- const cssQuery = threaded ? `cssData=${Buffer.from(extracted.styles).toString("base64")}` : `cssPath=${cssPath}`;
45
- const remReq = this.remainingRequest;
46
- const importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`;
47
- extracted.js = `${extracted.js}
1
+ import{Color as f,colorLog as h}from"@tamagui/cli-color";import{createExtractor as p,extractToClassNames as d,getPragmaOptions as y}from"@tamagui/static";import{extractedInfoByFile as $,stylePathToFilePath as b}from"./css";Error.stackTraceLimit=1/0;const T=require.resolve("./css");Error.stackTraceLimit=1/0;const P=p();let x=0;process.env.TAMAGUI_TARGET="web";const S=async function(c){this.cacheable(!0);const a=this.async(),o=c.toString();try{const e=this.emitFile===void 0,r={...this.getOptions()},s=`${this.resourcePath}`,{shouldDisable:l,shouldPrintDebug:i}=y({source:o,path:s});if(l)return i&&console.log("Disabling on file via pragma"),a(null,o);const n=e?`${s}.tamagui.css`:`${s}.${x++}.tamagui.css`,t=await d({extractor:P,source:o,sourcePath:s,options:r,shouldPrintDebug:i});if(!t)return a(null,o);if(t.styles){const u=e?`cssData=${Buffer.from(t.styles).toString("base64")}`:`cssPath=${n}`,m=this.remainingRequest,g=`${n}!=!${T}?${u}!${m}`;t.js=`${t.js}
48
2
 
49
- require(${JSON.stringify(importPath)})`;
50
- }
51
- extractedInfoByFile.set(sourcePath, extracted);
52
- if (!threaded) {
53
- if (extracted.stylesPath) {
54
- stylePathToFilePath.set(extracted.stylesPath, sourcePath);
55
- }
56
- }
57
- callback(null, extracted.js, extracted.map);
58
- } catch (err) {
59
- const message = err instanceof Error ? `${err.message}
60
- ${err.stack}` : String(err);
61
- console.error("Tamagui Webpack Loader Error:\n", ` ${message}
62
- `);
63
- if (message.includes("Cannot create proxy")) {
64
- console.log(
65
- "This is usually due to components not loading at build-time. Check for logs just below the line above:"
66
- );
67
- colorLog(Color.FgYellow, `"Tamagui built config and components"`);
68
- }
69
- return this.callback(null, source);
70
- }
71
- };
72
- export {
73
- loader
74
- };
3
+ require(${JSON.stringify(g)})`}$.set(s,t),e||t.stylesPath&&b.set(t.stylesPath,s),a(null,t.js,t.map)}catch(e){const r=e instanceof Error?`${e.message}
4
+ ${e.stack}`:String(e);return console.error(`Tamagui Webpack Loader Error:
5
+ `,` ${r}
6
+ `),r.includes("Cannot create proxy")&&(console.log("This is usually due to components not loading at build-time. Check for logs just below the line above:"),h(f.FgYellow,'"Tamagui built config and components"')),this.callback(null,o)}};export{S as loader};
75
7
  //# sourceMappingURL=loader.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/loader.ts"],
4
4
  "sourcesContent": ["import { Color, colorLog } from '@tamagui/cli-color'\nimport {\n TamaguiOptions,\n createExtractor,\n extractToClassNames,\n getPragmaOptions,\n} from '@tamagui/static'\nimport type { LoaderContext } from 'webpack'\n\nimport { extractedInfoByFile, stylePathToFilePath } from './css'\n\nError.stackTraceLimit = Infinity\n\n// pass loader as path\nconst CSS_LOADER_PATH = require.resolve('./css')\n\nError.stackTraceLimit = Infinity\nconst extractor = createExtractor()\n\nlet index = 0\n\nprocess.env.TAMAGUI_TARGET = 'web'\n\nexport const loader = async function loader(\n this: LoaderContext<TamaguiOptions>,\n sourceIn: Buffer | string\n) {\n this.cacheable(true)\n const callback = this.async()\n const source = sourceIn.toString()\n\n try {\n const threaded = this.emitFile === undefined\n const options: TamaguiOptions = { ...this.getOptions() }\n const sourcePath = `${this.resourcePath}`\n const { shouldDisable, shouldPrintDebug } = getPragmaOptions({\n source,\n path: sourcePath,\n })\n\n if (shouldDisable) {\n if (shouldPrintDebug) {\n // eslint-disable-next-line no-console\n console.log('Disabling on file via pragma')\n }\n return callback(null, source)\n }\n\n const cssPath = threaded\n ? `${sourcePath}.tamagui.css`\n : `${sourcePath}.${index++}.tamagui.css`\n\n const extracted = await extractToClassNames({\n extractor,\n source,\n sourcePath,\n options,\n shouldPrintDebug,\n })\n\n if (!extracted) {\n return callback(null, source)\n }\n\n // add import to css\n if (extracted.styles) {\n const cssQuery = threaded\n ? `cssData=${Buffer.from(extracted.styles).toString('base64')}`\n : `cssPath=${cssPath}`\n const remReq = this.remainingRequest\n const importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`\n extracted.js = `${extracted.js}\\n\\nrequire(${JSON.stringify(importPath)})`\n }\n\n extractedInfoByFile.set(sourcePath, extracted)\n\n if (!threaded) {\n if (extracted.stylesPath) {\n stylePathToFilePath.set(extracted.stylesPath, sourcePath)\n }\n }\n\n callback(null, extracted.js, extracted.map)\n } catch (err) {\n const message = err instanceof Error ? `${err.message}\\n${err.stack}` : String(err)\n\n // eslint-disable-next-line no-console\n console.error('Tamagui Webpack Loader Error:\\n', ` ${message}\\n`)\n\n if (message.includes('Cannot create proxy')) {\n // eslint-disable-next-line no-console\n console.log(\n 'This is usually due to components not loading at build-time. Check for logs just below the line above:'\n )\n colorLog(Color.FgYellow, `\"Tamagui built config and components\"`)\n }\n\n return this.callback(null, source)\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,OAAO,gBAAgB;AA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AAY,MAAMjB,EAAoB,CAC1C,UAAAK,EACA,OAAAK,EACA,WAAAG,EACA,QAAAD,EACA,iBAAAG,CACF,CAAC,EAED,GAAI,CAACE,EACH,OAAOR,EAAS,KAAMC,CAAM,EAI9B,GAAIO,EAAU,OAAQ,CACpB,MAAMC,EAAWP,EACb,WAAW,OAAO,KAAKM,EAAU,MAAM,EAAE,SAAS,QAAQ,IAC1D,WAAWD,IACTG,EAAS,KAAK,iBACdC,EAAa,GAAGJ,OAAaZ,KAAmBc,KAAYC,IAClEF,EAAU,GAAK,GAAGA,EAAU;AAAA;AAAA,UAAiB,KAAK,UAAUG,CAAU,IACxE,CAEAlB,EAAoB,IAAIW,EAAYI,CAAS,EAExCN,GACCM,EAAU,YACZd,EAAoB,IAAIc,EAAU,WAAYJ,CAAU,EAI5DJ,EAAS,KAAMQ,EAAU,GAAIA,EAAU,GAAG,CAC5C,OAASI,EAAP,CACA,MAAMC,EAAUD,aAAe,MAAQ,GAAGA,EAAI;AAAA,EAAYA,EAAI,QAAU,OAAOA,CAAG,EAGlF,eAAQ,MAAM;AAAA,EAAmC,KAAKC;AAAA,CAAW,EAE7DA,EAAQ,SAAS,qBAAqB,IAExC,QAAQ,IACN,wGACF,EACAxB,EAASD,EAAM,SAAU,uCAAuC,GAG3D,KAAK,SAAS,KAAMa,CAAM,CACnC,CACF",
6
+ "names": ["Color", "colorLog", "createExtractor", "extractToClassNames", "getPragmaOptions", "extractedInfoByFile", "stylePathToFilePath", "CSS_LOADER_PATH", "extractor", "index", "loader", "sourceIn", "callback", "source", "threaded", "options", "sourcePath", "shouldDisable", "shouldPrintDebug", "cssPath", "extracted", "cssQuery", "remReq", "importPath", "err", "message"]
7
7
  }
@@ -1,75 +1,7 @@
1
- import { Color, colorLog } from "@tamagui/cli-color";
2
- import {
3
- createExtractor,
4
- extractToClassNames,
5
- getPragmaOptions
6
- } from "@tamagui/static";
7
- import { extractedInfoByFile, stylePathToFilePath } from "./css";
8
- Error.stackTraceLimit = Infinity;
9
- const CSS_LOADER_PATH = require.resolve("./css");
10
- Error.stackTraceLimit = Infinity;
11
- const extractor = createExtractor();
12
- let index = 0;
13
- process.env.TAMAGUI_TARGET = "web";
14
- const loader = async function loader2(sourceIn) {
15
- this.cacheable(true);
16
- const callback = this.async();
17
- const source = sourceIn.toString();
18
- try {
19
- const threaded = this.emitFile === void 0;
20
- const options = { ...this.getOptions() };
21
- const sourcePath = `${this.resourcePath}`;
22
- const { shouldDisable, shouldPrintDebug } = getPragmaOptions({
23
- source,
24
- path: sourcePath
25
- });
26
- if (shouldDisable) {
27
- if (shouldPrintDebug) {
28
- console.log("Disabling on file via pragma");
29
- }
30
- return callback(null, source);
31
- }
32
- const cssPath = threaded ? `${sourcePath}.tamagui.css` : `${sourcePath}.${index++}.tamagui.css`;
33
- const extracted = await extractToClassNames({
34
- extractor,
35
- source,
36
- sourcePath,
37
- options,
38
- shouldPrintDebug
39
- });
40
- if (!extracted) {
41
- return callback(null, source);
42
- }
43
- if (extracted.styles) {
44
- const cssQuery = threaded ? `cssData=${Buffer.from(extracted.styles).toString("base64")}` : `cssPath=${cssPath}`;
45
- const remReq = this.remainingRequest;
46
- const importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`;
47
- extracted.js = `${extracted.js}
1
+ import{Color as f,colorLog as h}from"@tamagui/cli-color";import{createExtractor as p,extractToClassNames as d,getPragmaOptions as y}from"@tamagui/static";import{extractedInfoByFile as $,stylePathToFilePath as b}from"./css";Error.stackTraceLimit=1/0;const T=require.resolve("./css");Error.stackTraceLimit=1/0;const P=p();let x=0;process.env.TAMAGUI_TARGET="web";const S=async function(c){this.cacheable(!0);const a=this.async(),o=c.toString();try{const e=this.emitFile===void 0,r={...this.getOptions()},s=`${this.resourcePath}`,{shouldDisable:l,shouldPrintDebug:i}=y({source:o,path:s});if(l)return i&&console.log("Disabling on file via pragma"),a(null,o);const n=e?`${s}.tamagui.css`:`${s}.${x++}.tamagui.css`,t=await d({extractor:P,source:o,sourcePath:s,options:r,shouldPrintDebug:i});if(!t)return a(null,o);if(t.styles){const u=e?`cssData=${Buffer.from(t.styles).toString("base64")}`:`cssPath=${n}`,m=this.remainingRequest,g=`${n}!=!${T}?${u}!${m}`;t.js=`${t.js}
48
2
 
49
- require(${JSON.stringify(importPath)})`;
50
- }
51
- extractedInfoByFile.set(sourcePath, extracted);
52
- if (!threaded) {
53
- if (extracted.stylesPath) {
54
- stylePathToFilePath.set(extracted.stylesPath, sourcePath);
55
- }
56
- }
57
- callback(null, extracted.js, extracted.map);
58
- } catch (err) {
59
- const message = err instanceof Error ? `${err.message}
60
- ${err.stack}` : String(err);
61
- console.error("Tamagui Webpack Loader Error:\n", ` ${message}
62
- `);
63
- if (message.includes("Cannot create proxy")) {
64
- console.log(
65
- "This is usually due to components not loading at build-time. Check for logs just below the line above:"
66
- );
67
- colorLog(Color.FgYellow, `"Tamagui built config and components"`);
68
- }
69
- return this.callback(null, source);
70
- }
71
- };
72
- export {
73
- loader
74
- };
3
+ require(${JSON.stringify(g)})`}$.set(s,t),e||t.stylesPath&&b.set(t.stylesPath,s),a(null,t.js,t.map)}catch(e){const r=e instanceof Error?`${e.message}
4
+ ${e.stack}`:String(e);return console.error(`Tamagui Webpack Loader Error:
5
+ `,` ${r}
6
+ `),r.includes("Cannot create proxy")&&(console.log("This is usually due to components not loading at build-time. Check for logs just below the line above:"),h(f.FgYellow,'"Tamagui built config and components"')),this.callback(null,o)}};export{S as loader};
75
7
  //# sourceMappingURL=loader.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/loader.ts"],
4
4
  "sourcesContent": ["import { Color, colorLog } from '@tamagui/cli-color'\nimport {\n TamaguiOptions,\n createExtractor,\n extractToClassNames,\n getPragmaOptions,\n} from '@tamagui/static'\nimport type { LoaderContext } from 'webpack'\n\nimport { extractedInfoByFile, stylePathToFilePath } from './css'\n\nError.stackTraceLimit = Infinity\n\n// pass loader as path\nconst CSS_LOADER_PATH = require.resolve('./css')\n\nError.stackTraceLimit = Infinity\nconst extractor = createExtractor()\n\nlet index = 0\n\nprocess.env.TAMAGUI_TARGET = 'web'\n\nexport const loader = async function loader(\n this: LoaderContext<TamaguiOptions>,\n sourceIn: Buffer | string\n) {\n this.cacheable(true)\n const callback = this.async()\n const source = sourceIn.toString()\n\n try {\n const threaded = this.emitFile === undefined\n const options: TamaguiOptions = { ...this.getOptions() }\n const sourcePath = `${this.resourcePath}`\n const { shouldDisable, shouldPrintDebug } = getPragmaOptions({\n source,\n path: sourcePath,\n })\n\n if (shouldDisable) {\n if (shouldPrintDebug) {\n // eslint-disable-next-line no-console\n console.log('Disabling on file via pragma')\n }\n return callback(null, source)\n }\n\n const cssPath = threaded\n ? `${sourcePath}.tamagui.css`\n : `${sourcePath}.${index++}.tamagui.css`\n\n const extracted = await extractToClassNames({\n extractor,\n source,\n sourcePath,\n options,\n shouldPrintDebug,\n })\n\n if (!extracted) {\n return callback(null, source)\n }\n\n // add import to css\n if (extracted.styles) {\n const cssQuery = threaded\n ? `cssData=${Buffer.from(extracted.styles).toString('base64')}`\n : `cssPath=${cssPath}`\n const remReq = this.remainingRequest\n const importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`\n extracted.js = `${extracted.js}\\n\\nrequire(${JSON.stringify(importPath)})`\n }\n\n extractedInfoByFile.set(sourcePath, extracted)\n\n if (!threaded) {\n if (extracted.stylesPath) {\n stylePathToFilePath.set(extracted.stylesPath, sourcePath)\n }\n }\n\n callback(null, extracted.js, extracted.map)\n } catch (err) {\n const message = err instanceof Error ? `${err.message}\\n${err.stack}` : String(err)\n\n // eslint-disable-next-line no-console\n console.error('Tamagui Webpack Loader Error:\\n', ` ${message}\\n`)\n\n if (message.includes('Cannot create proxy')) {\n // eslint-disable-next-line no-console\n console.log(\n 'This is usually due to components not loading at build-time. Check for logs just below the line above:'\n )\n colorLog(Color.FgYellow, `\"Tamagui built config and components\"`)\n }\n\n return this.callback(null, source)\n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EAAUL,EACZ,GAAGE,gBACH,GAAGA,KAAcP,kBAEfW,EAAY,MAAMjB,EAAoB,CAC1C,UAAAK,EACA,OAAAK,EACA,WAAAG,EACA,QAAAD,EACA,iBAAAG,CACF,CAAC,EAED,GAAI,CAACE,EACH,OAAOR,EAAS,KAAMC,CAAM,EAI9B,GAAIO,EAAU,OAAQ,CACpB,MAAMC,EAAWP,EACb,WAAW,OAAO,KAAKM,EAAU,MAAM,EAAE,SAAS,QAAQ,IAC1D,WAAWD,IACTG,EAAS,KAAK,iBACdC,EAAa,GAAGJ,OAAaZ,KAAmBc,KAAYC,IAClEF,EAAU,GAAK,GAAGA,EAAU;AAAA;AAAA,UAAiB,KAAK,UAAUG,CAAU,IACxE,CAEAlB,EAAoB,IAAIW,EAAYI,CAAS,EAExCN,GACCM,EAAU,YACZd,EAAoB,IAAIc,EAAU,WAAYJ,CAAU,EAI5DJ,EAAS,KAAMQ,EAAU,GAAIA,EAAU,GAAG,CAC5C,OAASI,EAAP,CACA,MAAMC,EAAUD,aAAe,MAAQ,GAAGA,EAAI;AAAA,EAAYA,EAAI,QAAU,OAAOA,CAAG,EAGlF,eAAQ,MAAM;AAAA,EAAmC,KAAKC;AAAA,CAAW,EAE7DA,EAAQ,SAAS,qBAAqB,IAExC,QAAQ,IACN,wGACF,EACAxB,EAASD,EAAM,SAAU,uCAAuC,GAG3D,KAAK,SAAS,KAAMa,CAAM,CACnC,CACF",
6
+ "names": ["Color", "colorLog", "createExtractor", "extractToClassNames", "getPragmaOptions", "extractedInfoByFile", "stylePathToFilePath", "CSS_LOADER_PATH", "extractor", "index", "loader", "sourceIn", "callback", "source", "threaded", "options", "sourcePath", "shouldDisable", "shouldPrintDebug", "cssPath", "extracted", "cssQuery", "remReq", "importPath", "err", "message"]
7
7
  }
@@ -1,92 +1,2 @@
1
- class TamaguiPlugin {
2
- constructor(options = {
3
- components: ["@tamagui/core"]
4
- }) {
5
- this.options = options;
6
- this.pluginName = "TamaguiPlugin";
7
- }
8
- apply(compiler) {
9
- var _a;
10
- compiler.hooks.normalModuleFactory.tap(this.pluginName, (nmf) => {
11
- nmf.hooks.createModule.tap(
12
- this.pluginName,
13
- // @ts-expect-error CreateData is typed as 'object'...
14
- (createData) => {
15
- var _a2;
16
- if ((_a2 = createData.matchResource) == null ? void 0 : _a2.endsWith(".tamagui.css")) {
17
- createData.settings.sideEffects = true;
18
- }
19
- }
20
- );
21
- });
22
- compiler.options.resolve.extensions = [
23
- .../* @__PURE__ */ new Set([
24
- ".web.tsx",
25
- ".web.ts",
26
- ".web.js",
27
- ".ts",
28
- ".tsx",
29
- ".js",
30
- ...compiler.options.resolve.extensions || []
31
- ])
32
- ];
33
- const mainFields = compiler.options.resolve.mainFields;
34
- if (mainFields) {
35
- compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [mainFields];
36
- mainFields.unshift("module:jsx");
37
- }
38
- if (!compiler.options.module) {
39
- return;
40
- }
41
- const { jsLoader } = this.options;
42
- const existing = compiler.options.module.rules;
43
- const rules = ((_a = existing.find((x) => typeof x === "object" && "oneOf" in x ? x : null)) == null ? void 0 : _a.oneOf) ?? existing;
44
- const nextJsRules = rules.findIndex(
45
- (x) => (x == null ? void 0 : x.use) && x.use.loader === "next-swc-loader" && x.issuerLayer !== "api"
46
- );
47
- const startIndex = nextJsRules ? nextJsRules + 1 : 0;
48
- const existingLoader = nextJsRules ? rules[startIndex] : void 0;
49
- rules.splice(startIndex, 0, {
50
- test: this.options.test ?? /\.m?[jt]sx?$/,
51
- exclude: this.options.exclude,
52
- resolve: {
53
- fullySpecified: false
54
- },
55
- use: [
56
- ...jsLoader ? [jsLoader] : [],
57
- ...existingLoader && nextJsRules ? [].concat(existingLoader.use) : [],
58
- ...!(jsLoader || existingLoader) ? [
59
- {
60
- loader: require.resolve("esbuild-loader"),
61
- options: {
62
- target: "es2021",
63
- keepNames: true,
64
- loader: {
65
- ".tsx": "tsx",
66
- ".png": "copy",
67
- ".jpg": "copy",
68
- ".gif": "copy"
69
- },
70
- tsconfigRaw: {
71
- module: this.options.commonjs ? "commonjs" : "esnext",
72
- isolatedModules: true,
73
- jsx: "preserve",
74
- resolveJsonModule: true
75
- }
76
- }
77
- }
78
- ] : [],
79
- {
80
- loader: require.resolve("tamagui-loader"),
81
- options: {
82
- ...this.options
83
- }
84
- }
85
- ]
86
- });
87
- }
88
- }
89
- export {
90
- TamaguiPlugin
91
- };
1
+ class m{constructor(s={components:["@tamagui/core"]}){this.options=s;this.pluginName="TamaguiPlugin"}apply(s){var r;s.hooks.normalModuleFactory.tap(this.pluginName,e=>{e.hooks.createModule.tap(this.pluginName,p=>{var c;(c=p.matchResource)!=null&&c.endsWith(".tamagui.css")&&(p.settings.sideEffects=!0)})}),s.options.resolve.extensions=[...new Set([".web.tsx",".web.ts",".web.js",".ts",".tsx",".js",...s.options.resolve.extensions||[]])];const o=s.options.resolve.mainFields;if(o&&(s.options.resolve.mainFields=Array.isArray(o)?o:[o],o.unshift("module:jsx")),!s.options.module)return;const{jsLoader:n}=this.options,a=s.options.module.rules,i=((r=a.find(e=>typeof e=="object"&&"oneOf"in e?e:null))==null?void 0:r.oneOf)??a,t=i.findIndex(e=>(e==null?void 0:e.use)&&e.use.loader==="next-swc-loader"&&e.issuerLayer!=="api"),l=t?t+1:0,u=t?i[l]:void 0;i.splice(l,0,{test:this.options.test??/\.m?[jt]sx?$/,exclude:this.options.exclude,resolve:{fullySpecified:!1},use:[...n?[n]:[],...u&&t?[].concat(u.use):[],...n||u?[]:[{loader:require.resolve("esbuild-loader"),options:{target:"es2021",keepNames:!0,loader:{".tsx":"tsx",".png":"copy",".jpg":"copy",".gif":"copy"},tsconfigRaw:{module:this.options.commonjs?"commonjs":"esnext",isolatedModules:!0,jsx:"preserve",resolveJsonModule:!0}}}],{loader:require.resolve("tamagui-loader"),options:{...this.options}}]})}}export{m as TamaguiPlugin};
92
2
  //# sourceMappingURL=plugin.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/plugin.ts"],
4
4
  "sourcesContent": ["import type { TamaguiOptions } from '@tamagui/static'\nimport type { Compiler, RuleSetRule } from 'webpack'\n\ntype PluginOptions = TamaguiOptions & {\n commonjs?: boolean\n exclude?: RuleSetRule['exclude']\n test?: RuleSetRule['test']\n jsLoader?: any\n}\n\nexport class TamaguiPlugin {\n pluginName = 'TamaguiPlugin'\n\n constructor(\n public options: PluginOptions = {\n components: ['@tamagui/core'],\n }\n ) {}\n\n apply(compiler: Compiler) {\n // mark as side effect\n compiler.hooks.normalModuleFactory.tap(this.pluginName, (nmf) => {\n nmf.hooks.createModule.tap(\n this.pluginName,\n // @ts-expect-error CreateData is typed as 'object'...\n (createData: { matchResource?: string; settings: { sideEffects?: boolean } }) => {\n if (createData.matchResource?.endsWith('.tamagui.css')) {\n createData.settings.sideEffects = true\n }\n }\n )\n })\n\n compiler.options.resolve.extensions = [\n ...new Set([\n '.web.tsx',\n '.web.ts',\n '.web.js',\n '.ts',\n '.tsx',\n '.js',\n ...(compiler.options.resolve.extensions || []),\n ]),\n ]\n\n // look for compiled js with jsx intact as specified by module:jsx\n const mainFields = compiler.options.resolve.mainFields\n if (mainFields) {\n compiler.options.resolve.mainFields = Array.isArray(mainFields)\n ? mainFields\n : [mainFields]\n mainFields.unshift('module:jsx')\n }\n\n if (!compiler.options.module) {\n return\n }\n\n const { jsLoader } = this.options\n\n const existing = compiler.options.module.rules as any[]\n\n const rules =\n (existing.find((x) => (typeof x === 'object' && 'oneOf' in x ? x : null))\n ?.oneOf as any[]) ?? existing\n\n const nextJsRules = rules.findIndex(\n (x) => x?.use && x.use.loader === 'next-swc-loader' && x.issuerLayer !== 'api'\n )\n\n const startIndex = nextJsRules ? nextJsRules + 1 : 0\n const existingLoader = nextJsRules ? rules[startIndex] : undefined\n\n rules.splice(startIndex, 0, {\n test: this.options.test ?? /\\.m?[jt]sx?$/,\n exclude: this.options.exclude,\n resolve: {\n fullySpecified: false,\n },\n use: [\n ...(jsLoader ? [jsLoader] : []),\n ...(existingLoader && nextJsRules ? [].concat(existingLoader.use) : []),\n ...(!(jsLoader || existingLoader)\n ? [\n {\n loader: require.resolve('esbuild-loader'),\n options: {\n target: 'es2021',\n keepNames: true,\n loader: {\n '.tsx': 'tsx',\n '.png': 'copy',\n '.jpg': 'copy',\n '.gif': 'copy',\n },\n\n tsconfigRaw: {\n module: this.options.commonjs ? 'commonjs' : 'esnext',\n isolatedModules: true,\n jsx: 'preserve',\n resolveJsonModule: true,\n },\n },\n },\n ]\n : []),\n {\n loader: require.resolve('tamagui-loader'),\n options: {\n ...this.options,\n },\n },\n ],\n })\n }\n}\n"],
5
- "mappings": "AAUO,MAAM,cAAc;AAAA,EAGzB,YACS,UAAyB;AAAA,IAC9B,YAAY,CAAC,eAAe;AAAA,EAC9B,GACA;AAHO;AAHT,sBAAa;AAAA,EAMV;AAAA,EAEH,MAAM,UAAoB;AAnB5B;AAqBI,aAAS,MAAM,oBAAoB,IAAI,KAAK,YAAY,CAAC,QAAQ;AAC/D,UAAI,MAAM,aAAa;AAAA,QACrB,KAAK;AAAA;AAAA,QAEL,CAAC,eAAgF;AAzBzF,cAAAA;AA0BU,eAAIA,MAAA,WAAW,kBAAX,gBAAAA,IAA0B,SAAS,iBAAiB;AACtD,uBAAW,SAAS,cAAc;AAAA,UACpC;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,aAAS,QAAQ,QAAQ,aAAa;AAAA,MACpC,GAAG,oBAAI,IAAI;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAI,SAAS,QAAQ,QAAQ,cAAc,CAAC;AAAA,MAC9C,CAAC;AAAA,IACH;AAGA,UAAM,aAAa,SAAS,QAAQ,QAAQ;AAC5C,QAAI,YAAY;AACd,eAAS,QAAQ,QAAQ,aAAa,MAAM,QAAQ,UAAU,IAC1D,aACA,CAAC,UAAU;AACf,iBAAW,QAAQ,YAAY;AAAA,IACjC;AAEA,QAA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Q,MAAQ,eAC3B,QAAS,KAAK,QAAQ,QACtB,QAAS,CACP,eAAgB,EAClB,EACA,IAAK,CACH,GAAIL,EAAW,CAACA,CAAQ,EAAI,CAAC,EAC7B,GAAIM,GAAkBF,EAAc,CAAC,EAAE,OAAOE,EAAe,GAAG,EAAI,CAAC,EACrE,GAAMN,GAAYM,EAuBd,CAAC,EAtBD,CACE,CACE,OAAQ,gBAAgB,gBAAgB,EACxC,QAAS,CACP,OAAQ,SACR,UAAW,GACX,OAAQ,CACN,OAAQ,MACR,OAAQ,OACR,OAAQ,OACR,OAAQ,MACV,EAEA,YAAa,CACX,OAAQ,KAAK,QAAQ,SAAW,WAAa,SAC7C,gBAAiB,GACjB,IAAK,WACL,kBAAmB,EACrB,CACF,CACF,CACF,EAEJ,CACE,OAAQ,gBAAgB,gBAAgB,EACxC,QAAS,CACP,GAAG,KAAK,OACV,CACF,CACF,CACF,CAAC,CACH,CACF",
6
+ "names": ["TamaguiPlugin", "options", "compiler", "_a", "nmf", "createData", "mainFields", "jsLoader", "existing", "rules", "x", "nextJsRules", "startIndex", "existingLoader"]
7
7
  }
@@ -1,92 +1,2 @@
1
- class TamaguiPlugin {
2
- constructor(options = {
3
- components: ["@tamagui/core"]
4
- }) {
5
- this.options = options;
6
- this.pluginName = "TamaguiPlugin";
7
- }
8
- apply(compiler) {
9
- var _a;
10
- compiler.hooks.normalModuleFactory.tap(this.pluginName, (nmf) => {
11
- nmf.hooks.createModule.tap(
12
- this.pluginName,
13
- // @ts-expect-error CreateData is typed as 'object'...
14
- (createData) => {
15
- var _a2;
16
- if ((_a2 = createData.matchResource) == null ? void 0 : _a2.endsWith(".tamagui.css")) {
17
- createData.settings.sideEffects = true;
18
- }
19
- }
20
- );
21
- });
22
- compiler.options.resolve.extensions = [
23
- .../* @__PURE__ */ new Set([
24
- ".web.tsx",
25
- ".web.ts",
26
- ".web.js",
27
- ".ts",
28
- ".tsx",
29
- ".js",
30
- ...compiler.options.resolve.extensions || []
31
- ])
32
- ];
33
- const mainFields = compiler.options.resolve.mainFields;
34
- if (mainFields) {
35
- compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [mainFields];
36
- mainFields.unshift("module:jsx");
37
- }
38
- if (!compiler.options.module) {
39
- return;
40
- }
41
- const { jsLoader } = this.options;
42
- const existing = compiler.options.module.rules;
43
- const rules = ((_a = existing.find((x) => typeof x === "object" && "oneOf" in x ? x : null)) == null ? void 0 : _a.oneOf) ?? existing;
44
- const nextJsRules = rules.findIndex(
45
- (x) => (x == null ? void 0 : x.use) && x.use.loader === "next-swc-loader" && x.issuerLayer !== "api"
46
- );
47
- const startIndex = nextJsRules ? nextJsRules + 1 : 0;
48
- const existingLoader = nextJsRules ? rules[startIndex] : void 0;
49
- rules.splice(startIndex, 0, {
50
- test: this.options.test ?? /\.m?[jt]sx?$/,
51
- exclude: this.options.exclude,
52
- resolve: {
53
- fullySpecified: false
54
- },
55
- use: [
56
- ...jsLoader ? [jsLoader] : [],
57
- ...existingLoader && nextJsRules ? [].concat(existingLoader.use) : [],
58
- ...!(jsLoader || existingLoader) ? [
59
- {
60
- loader: require.resolve("esbuild-loader"),
61
- options: {
62
- target: "es2021",
63
- keepNames: true,
64
- loader: {
65
- ".tsx": "tsx",
66
- ".png": "copy",
67
- ".jpg": "copy",
68
- ".gif": "copy"
69
- },
70
- tsconfigRaw: {
71
- module: this.options.commonjs ? "commonjs" : "esnext",
72
- isolatedModules: true,
73
- jsx: "preserve",
74
- resolveJsonModule: true
75
- }
76
- }
77
- }
78
- ] : [],
79
- {
80
- loader: require.resolve("tamagui-loader"),
81
- options: {
82
- ...this.options
83
- }
84
- }
85
- ]
86
- });
87
- }
88
- }
89
- export {
90
- TamaguiPlugin
91
- };
1
+ class m{constructor(s={components:["@tamagui/core"]}){this.options=s;this.pluginName="TamaguiPlugin"}apply(s){var r;s.hooks.normalModuleFactory.tap(this.pluginName,e=>{e.hooks.createModule.tap(this.pluginName,p=>{var c;(c=p.matchResource)!=null&&c.endsWith(".tamagui.css")&&(p.settings.sideEffects=!0)})}),s.options.resolve.extensions=[...new Set([".web.tsx",".web.ts",".web.js",".ts",".tsx",".js",...s.options.resolve.extensions||[]])];const o=s.options.resolve.mainFields;if(o&&(s.options.resolve.mainFields=Array.isArray(o)?o:[o],o.unshift("module:jsx")),!s.options.module)return;const{jsLoader:n}=this.options,a=s.options.module.rules,i=((r=a.find(e=>typeof e=="object"&&"oneOf"in e?e:null))==null?void 0:r.oneOf)??a,t=i.findIndex(e=>(e==null?void 0:e.use)&&e.use.loader==="next-swc-loader"&&e.issuerLayer!=="api"),l=t?t+1:0,u=t?i[l]:void 0;i.splice(l,0,{test:this.options.test??/\.m?[jt]sx?$/,exclude:this.options.exclude,resolve:{fullySpecified:!1},use:[...n?[n]:[],...u&&t?[].concat(u.use):[],...n||u?[]:[{loader:require.resolve("esbuild-loader"),options:{target:"es2021",keepNames:!0,loader:{".tsx":"tsx",".png":"copy",".jpg":"copy",".gif":"copy"},tsconfigRaw:{module:this.options.commonjs?"commonjs":"esnext",isolatedModules:!0,jsx:"preserve",resolveJsonModule:!0}}}],{loader:require.resolve("tamagui-loader"),options:{...this.options}}]})}}export{m as TamaguiPlugin};
92
2
  //# sourceMappingURL=plugin.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/plugin.ts"],
4
4
  "sourcesContent": ["import type { TamaguiOptions } from '@tamagui/static'\nimport type { Compiler, RuleSetRule } from 'webpack'\n\ntype PluginOptions = TamaguiOptions & {\n commonjs?: boolean\n exclude?: RuleSetRule['exclude']\n test?: RuleSetRule['test']\n jsLoader?: any\n}\n\nexport class TamaguiPlugin {\n pluginName = 'TamaguiPlugin'\n\n constructor(\n public options: PluginOptions = {\n components: ['@tamagui/core'],\n }\n ) {}\n\n apply(compiler: Compiler) {\n // mark as side effect\n compiler.hooks.normalModuleFactory.tap(this.pluginName, (nmf) => {\n nmf.hooks.createModule.tap(\n this.pluginName,\n // @ts-expect-error CreateData is typed as 'object'...\n (createData: { matchResource?: string; settings: { sideEffects?: boolean } }) => {\n if (createData.matchResource?.endsWith('.tamagui.css')) {\n createData.settings.sideEffects = true\n }\n }\n )\n })\n\n compiler.options.resolve.extensions = [\n ...new Set([\n '.web.tsx',\n '.web.ts',\n '.web.js',\n '.ts',\n '.tsx',\n '.js',\n ...(compiler.options.resolve.extensions || []),\n ]),\n ]\n\n // look for compiled js with jsx intact as specified by module:jsx\n const mainFields = compiler.options.resolve.mainFields\n if (mainFields) {\n compiler.options.resolve.mainFields = Array.isArray(mainFields)\n ? mainFields\n : [mainFields]\n mainFields.unshift('module:jsx')\n }\n\n if (!compiler.options.module) {\n return\n }\n\n const { jsLoader } = this.options\n\n const existing = compiler.options.module.rules as any[]\n\n const rules =\n (existing.find((x) => (typeof x === 'object' && 'oneOf' in x ? x : null))\n ?.oneOf as any[]) ?? existing\n\n const nextJsRules = rules.findIndex(\n (x) => x?.use && x.use.loader === 'next-swc-loader' && x.issuerLayer !== 'api'\n )\n\n const startIndex = nextJsRules ? nextJsRules + 1 : 0\n const existingLoader = nextJsRules ? rules[startIndex] : undefined\n\n rules.splice(startIndex, 0, {\n test: this.options.test ?? /\\.m?[jt]sx?$/,\n exclude: this.options.exclude,\n resolve: {\n fullySpecified: false,\n },\n use: [\n ...(jsLoader ? [jsLoader] : []),\n ...(existingLoader && nextJsRules ? [].concat(existingLoader.use) : []),\n ...(!(jsLoader || existingLoader)\n ? [\n {\n loader: require.resolve('esbuild-loader'),\n options: {\n target: 'es2021',\n keepNames: true,\n loader: {\n '.tsx': 'tsx',\n '.png': 'copy',\n '.jpg': 'copy',\n '.gif': 'copy',\n },\n\n tsconfigRaw: {\n module: this.options.commonjs ? 'commonjs' : 'esnext',\n isolatedModules: true,\n jsx: 'preserve',\n resolveJsonModule: true,\n },\n },\n },\n ]\n : []),\n {\n loader: require.resolve('tamagui-loader'),\n options: {\n ...this.options,\n },\n },\n ],\n })\n }\n}\n"],
5
- "mappings": "AAUO,MAAM,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WAAa,SAC7C,gBAAiB,GACjB,IAAK,WACL,kBAAmB,EACrB,CACF,CACF,CACF,EAEJ,CACE,OAAQ,gBAAgB,gBAAgB,EACxC,QAAS,CACP,GAAG,KAAK,OACV,CACF,CACF,CACF,CAAC,CACH,CACF",
6
+ "names": ["TamaguiPlugin", "options", "compiler", "_a", "nmf", "createData", "mainFields", "jsLoader", "existing", "rules", "x", "nextJsRules", "startIndex", "existingLoader"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamagui-loader",
3
- "version": "1.13.2",
3
+ "version": "1.13.4",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -18,14 +18,14 @@
18
18
  "clean:build": "tamagui-build clean:build"
19
19
  },
20
20
  "dependencies": {
21
- "@tamagui/cli-color": "1.13.2",
22
- "@tamagui/static": "1.13.2",
21
+ "@tamagui/cli-color": "1.13.4",
22
+ "@tamagui/static": "1.13.4",
23
23
  "fs-extra": "^11.1.0",
24
24
  "loader-utils": "^3.2.1",
25
25
  "lodash": "^4.17.21"
26
26
  },
27
27
  "devDependencies": {
28
- "@tamagui/build": "1.13.2",
28
+ "@tamagui/build": "1.13.4",
29
29
  "webpack": "^5.74.0"
30
30
  },
31
31
  "publishConfig": {