tamagui-loader 1.0.0-alpha.2 → 1.0.0-alpha.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.
- package/dist/index.cjs +8 -6
- package/dist/index.cjs.map +2 -2
- package/dist/loader.js +7 -5
- package/dist/loader.js.map +2 -2
- package/package.json +4 -3
- package/src/loader.ts +12 -9
- package/types.d.ts +6 -0
package/dist/index.cjs
CHANGED
|
@@ -48,15 +48,16 @@ __export(loader_exports, {
|
|
|
48
48
|
function loader(source) {
|
|
49
49
|
this.cacheable();
|
|
50
50
|
const callback = this.async();
|
|
51
|
-
if (!process.env.TAMAGUI_DISABLE_RNW_PATCH) {
|
|
51
|
+
if (!process.env.TAMAGUI_DISABLE_RNW_PATCH && !hasPatched) {
|
|
52
52
|
(0, import_static.patchReactNativeWeb)();
|
|
53
|
+
hasPatched = true;
|
|
53
54
|
}
|
|
54
55
|
try {
|
|
55
56
|
const threaded = this.emitFile === void 0;
|
|
56
57
|
const options = __spreadValues({}, (0, import_loader_utils.getOptions)(this));
|
|
57
|
-
if (options.disableExtraction) {
|
|
58
|
+
if (options.disableExtraction && (options.disableDebugAttr || process.env.NODE_ENV !== "development")) {
|
|
58
59
|
if (!hasLogged) {
|
|
59
|
-
console.log("\u{1F95A} Tamagui disableExtraction set
|
|
60
|
+
console.log("\u{1F95A} Tamagui disableDebug & disableExtraction set, no parsing running");
|
|
60
61
|
hasLogged = true;
|
|
61
62
|
}
|
|
62
63
|
return callback(null, source);
|
|
@@ -71,8 +72,8 @@ function loader(source) {
|
|
|
71
72
|
}
|
|
72
73
|
return callback(null, out);
|
|
73
74
|
}
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
75
|
+
const ext = (0, import_path.extname)(sourcePath);
|
|
76
|
+
if (ext !== ".tsx" && ext !== ".jsx" || startsWithComment && (source.startsWith("// tamagui-ignore") || source.startsWith("//! tamagui-ignore"))) {
|
|
76
77
|
return callback(null, source);
|
|
77
78
|
}
|
|
78
79
|
const cssPath = threaded ? `${sourcePath}.module.css` : `${sourcePath}.${index++}.module.css`;
|
|
@@ -103,7 +104,7 @@ function loader(source) {
|
|
|
103
104
|
return callback(null, source);
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
var import_path, import_static, import_loader_utils, extractor, stylesByFile, stylePathToFilePath, index, hasLogged;
|
|
107
|
+
var import_path, import_static, import_loader_utils, extractor, stylesByFile, stylePathToFilePath, index, hasLogged, hasPatched;
|
|
107
108
|
var init_loader = __esm({
|
|
108
109
|
"src/loader.ts"() {
|
|
109
110
|
import_path = __toModule(require("path"));
|
|
@@ -115,6 +116,7 @@ var init_loader = __esm({
|
|
|
115
116
|
stylePathToFilePath = new Map();
|
|
116
117
|
index = 0;
|
|
117
118
|
hasLogged = false;
|
|
119
|
+
hasPatched = false;
|
|
118
120
|
process.env.TAMAGUI_TARGET = "web";
|
|
119
121
|
__name(loader, "loader");
|
|
120
122
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/loader.ts", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { extname } from 'path'\n\nimport {\n TamaguiOptions,\n createExtractor,\n extractToClassNames,\n patchReactNativeWeb,\n} from '@tamagui/static'\nimport { getOptions } from 'loader-utils'\n\nError.stackTraceLimit = Infinity\nconst extractor = createExtractor()\n\nconst stylesByFile = new Map<string, string>()\nconst stylePathToFilePath = new Map<string, string>()\n\nlet index = 0\nlet hasLogged = false\n\nprocess.env.TAMAGUI_TARGET = 'web'\n\nexport function loader(this: any, source: string) {\n this.cacheable()\n const callback = this.async()\n\n if (!process.env.TAMAGUI_DISABLE_RNW_PATCH) {\n patchReactNativeWeb()\n }\n\n try {\n const threaded = this.emitFile === undefined\n const options: TamaguiOptions = { ...getOptions(this) }\n\n if (options.disableExtraction) {\n if (!hasLogged) {\n console.log('\uD83E\uDD5A Tamagui disableExtraction set
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { extname } from 'path'\n\nimport {\n TamaguiOptions,\n createExtractor,\n extractToClassNames,\n patchReactNativeWeb,\n} from '@tamagui/static'\nimport { getOptions } from 'loader-utils'\n\nError.stackTraceLimit = Infinity\nconst extractor = createExtractor()\n\nconst stylesByFile = new Map<string, string>()\nconst stylePathToFilePath = new Map<string, string>()\n\nlet index = 0\nlet hasLogged = false\nlet hasPatched = false\n\nprocess.env.TAMAGUI_TARGET = 'web'\n\nexport function loader(this: any, source: string) {\n this.cacheable()\n const callback = this.async()\n\n if (!process.env.TAMAGUI_DISABLE_RNW_PATCH && !hasPatched) {\n patchReactNativeWeb()\n hasPatched = true\n }\n\n try {\n const threaded = this.emitFile === undefined\n const options: TamaguiOptions = { ...getOptions(this) }\n\n if (\n options.disableExtraction &&\n (options.disableDebugAttr || process.env.NODE_ENV !== 'development')\n ) {\n if (!hasLogged) {\n console.log('\uD83E\uDD5A Tamagui disableDebug & disableExtraction set, no parsing running')\n hasLogged = true\n }\n return callback(null, source)\n }\n\n const sourcePath = `${this.resourcePath}`\n const startsWithComment = source[0] === '/' && source[1] === '/'\n const shouldPrintDebug =\n (!!process.env.DEBUG &&\n (process.env.DEBUG_FILE ? sourcePath.includes(process.env.DEBUG_FILE) : true)) ||\n // supports esbuild style //! comments\n (startsWithComment && (source.startsWith('// debug') || source.startsWith('//! debug')))\n\n // if outputted css\n if (options.cssPath || options.cssData) {\n const out = options.cssData\n ? Buffer.from(options.cssData, 'base64').toString('utf-8')\n : stylesByFile.get(stylePathToFilePath.get(sourcePath) ?? sourcePath)\n if (!out) {\n console.warn(`no styles... ${stylesByFile.keys} ${sourcePath}`)\n }\n return callback(null, out)\n }\n\n // check if should ignore\n const ext = extname(sourcePath)\n if (\n (ext !== '.tsx' && ext !== '.jsx') ||\n (startsWithComment &&\n (source.startsWith('// tamagui-ignore') || source.startsWith('//! tamagui-ignore')))\n ) {\n return callback(null, source)\n }\n\n const cssPath = threaded ? `${sourcePath}.module.css` : `${sourcePath}.${index++}.module.css`\n const extracted = extractToClassNames({\n // @ts-ignore\n loader: this,\n extractor,\n source,\n threaded,\n sourcePath,\n cssPath,\n options,\n shouldPrintDebug,\n })\n\n if (!extracted) {\n return callback(null, source)\n }\n\n if (!threaded) {\n if (extracted.stylesPath) {\n stylePathToFilePath.set(extracted.stylesPath, sourcePath)\n }\n if (extracted.styles) {\n stylesByFile.set(sourcePath, extracted.styles)\n }\n }\n\n callback(null, extracted.js, extracted.map)\n } catch (err) {\n console.error('ERROR', err)\n return callback(null, source)\n }\n}\n", "process.env.TAMAGUI_TARGET = process.env.TAMAGUI_TARGET || 'web'\nprocess.env.TAMAGUI_COMPILE_PROCESS = '1'\n\nexport default require('./loader').loader\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAsBO,gBAA2B,QAAgB;AAChD,OAAK;AACL,QAAM,WAAW,KAAK;AAEtB,MAAI,CAAC,QAAQ,IAAI,6BAA6B,CAAC,YAAY;AACzD;AACA,iBAAa;AAAA;AAGf,MAAI;AACF,UAAM,WAAW,KAAK,aAAa;AACnC,UAAM,UAA0B,mBAAK,oCAAW;AAEhD,QACE,QAAQ,qBACP,SAAQ,oBAAoB,QAAQ,IAAI,aAAa,gBACtD;AACA,UAAI,CAAC,WAAW;AACd,gBAAQ,IAAI;AACZ,oBAAY;AAAA;AAEd,aAAO,SAAS,MAAM;AAAA;AAGxB,UAAM,aAAa,GAAG,KAAK;AAC3B,UAAM,oBAAoB,OAAO,OAAO,OAAO,OAAO,OAAO;AAC7D,UAAM,mBACH,CAAC,CAAC,QAAQ,IAAI,SACZ,SAAQ,IAAI,aAAa,WAAW,SAAS,QAAQ,IAAI,cAAc,SAEzE,qBAAsB,QAA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ACtBhB;AAAA;AAAA;AAAA,QAAQ,IAAI,iBAAiB,QAAQ,IAAI,kBAAkB;AAC3D,QAAQ,IAAI,0BAA0B;AAEtC,IAAO,cAAQ,gCAAoB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/loader.js
CHANGED
|
@@ -13,19 +13,21 @@ const stylesByFile = new Map();
|
|
|
13
13
|
const stylePathToFilePath = new Map();
|
|
14
14
|
let index = 0;
|
|
15
15
|
let hasLogged = false;
|
|
16
|
+
let hasPatched = false;
|
|
16
17
|
process.env.TAMAGUI_TARGET = "web";
|
|
17
18
|
function loader(source) {
|
|
18
19
|
this.cacheable();
|
|
19
20
|
const callback = this.async();
|
|
20
|
-
if (!process.env.TAMAGUI_DISABLE_RNW_PATCH) {
|
|
21
|
+
if (!process.env.TAMAGUI_DISABLE_RNW_PATCH && !hasPatched) {
|
|
21
22
|
patchReactNativeWeb();
|
|
23
|
+
hasPatched = true;
|
|
22
24
|
}
|
|
23
25
|
try {
|
|
24
26
|
const threaded = this.emitFile === void 0;
|
|
25
27
|
const options = { ...getOptions(this) };
|
|
26
|
-
if (options.disableExtraction) {
|
|
28
|
+
if (options.disableExtraction && (options.disableDebugAttr || process.env.NODE_ENV !== "development")) {
|
|
27
29
|
if (!hasLogged) {
|
|
28
|
-
console.log("\u{1F95A} Tamagui disableExtraction set
|
|
30
|
+
console.log("\u{1F95A} Tamagui disableDebug & disableExtraction set, no parsing running");
|
|
29
31
|
hasLogged = true;
|
|
30
32
|
}
|
|
31
33
|
return callback(null, source);
|
|
@@ -40,8 +42,8 @@ function loader(source) {
|
|
|
40
42
|
}
|
|
41
43
|
return callback(null, out);
|
|
42
44
|
}
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
+
const ext = extname(sourcePath);
|
|
46
|
+
if (ext !== ".tsx" && ext !== ".jsx" || startsWithComment && (source.startsWith("// tamagui-ignore") || source.startsWith("//! tamagui-ignore"))) {
|
|
45
47
|
return callback(null, source);
|
|
46
48
|
}
|
|
47
49
|
const cssPath = threaded ? `${sourcePath}.module.css` : `${sourcePath}.${index++}.module.css`;
|
package/dist/loader.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/loader.ts"],
|
|
4
|
-
"sourcesContent": ["import { extname } from 'path'\n\nimport {\n TamaguiOptions,\n createExtractor,\n extractToClassNames,\n patchReactNativeWeb,\n} from '@tamagui/static'\nimport { getOptions } from 'loader-utils'\n\nError.stackTraceLimit = Infinity\nconst extractor = createExtractor()\n\nconst stylesByFile = new Map<string, string>()\nconst stylePathToFilePath = new Map<string, string>()\n\nlet index = 0\nlet hasLogged = false\n\nprocess.env.TAMAGUI_TARGET = 'web'\n\nexport function loader(this: any, source: string) {\n this.cacheable()\n const callback = this.async()\n\n if (!process.env.TAMAGUI_DISABLE_RNW_PATCH) {\n patchReactNativeWeb()\n }\n\n try {\n const threaded = this.emitFile === undefined\n const options: TamaguiOptions = { ...getOptions(this) }\n\n if (options.disableExtraction) {\n if (!hasLogged) {\n console.log('\uD83E\uDD5A Tamagui disableExtraction set
|
|
5
|
-
"mappings": ";;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAMA;AAEA,MAAM,kBAAkB;AACxB,MAAM,YAAY;AAElB,MAAM,eAAe,IAAI;AACzB,MAAM,sBAAsB,IAAI;AAEhC,IAAI,QAAQ;AACZ,IAAI,YAAY;
|
|
4
|
+
"sourcesContent": ["import { extname } from 'path'\n\nimport {\n TamaguiOptions,\n createExtractor,\n extractToClassNames,\n patchReactNativeWeb,\n} from '@tamagui/static'\nimport { getOptions } from 'loader-utils'\n\nError.stackTraceLimit = Infinity\nconst extractor = createExtractor()\n\nconst stylesByFile = new Map<string, string>()\nconst stylePathToFilePath = new Map<string, string>()\n\nlet index = 0\nlet hasLogged = false\nlet hasPatched = false\n\nprocess.env.TAMAGUI_TARGET = 'web'\n\nexport function loader(this: any, source: string) {\n this.cacheable()\n const callback = this.async()\n\n if (!process.env.TAMAGUI_DISABLE_RNW_PATCH && !hasPatched) {\n patchReactNativeWeb()\n hasPatched = true\n }\n\n try {\n const threaded = this.emitFile === undefined\n const options: TamaguiOptions = { ...getOptions(this) }\n\n if (\n options.disableExtraction &&\n (options.disableDebugAttr || process.env.NODE_ENV !== 'development')\n ) {\n if (!hasLogged) {\n console.log('\uD83E\uDD5A Tamagui disableDebug & disableExtraction set, no parsing running')\n hasLogged = true\n }\n return callback(null, source)\n }\n\n const sourcePath = `${this.resourcePath}`\n const startsWithComment = source[0] === '/' && source[1] === '/'\n const shouldPrintDebug =\n (!!process.env.DEBUG &&\n (process.env.DEBUG_FILE ? sourcePath.includes(process.env.DEBUG_FILE) : true)) ||\n // supports esbuild style //! comments\n (startsWithComment && (source.startsWith('// debug') || source.startsWith('//! debug')))\n\n // if outputted css\n if (options.cssPath || options.cssData) {\n const out = options.cssData\n ? Buffer.from(options.cssData, 'base64').toString('utf-8')\n : stylesByFile.get(stylePathToFilePath.get(sourcePath) ?? sourcePath)\n if (!out) {\n console.warn(`no styles... ${stylesByFile.keys} ${sourcePath}`)\n }\n return callback(null, out)\n }\n\n // check if should ignore\n const ext = extname(sourcePath)\n if (\n (ext !== '.tsx' && ext !== '.jsx') ||\n (startsWithComment &&\n (source.startsWith('// tamagui-ignore') || source.startsWith('//! tamagui-ignore')))\n ) {\n return callback(null, source)\n }\n\n const cssPath = threaded ? `${sourcePath}.module.css` : `${sourcePath}.${index++}.module.css`\n const extracted = extractToClassNames({\n // @ts-ignore\n loader: this,\n extractor,\n source,\n threaded,\n sourcePath,\n cssPath,\n options,\n shouldPrintDebug,\n })\n\n if (!extracted) {\n return callback(null, source)\n }\n\n if (!threaded) {\n if (extracted.stylesPath) {\n stylePathToFilePath.set(extracted.stylesPath, sourcePath)\n }\n if (extracted.styles) {\n stylesByFile.set(sourcePath, extracted.styles)\n }\n }\n\n callback(null, extracted.js, extracted.map)\n } catch (err) {\n console.error('ERROR', err)\n return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S,MAAM;AAAA;AAGxB,UAAM,UAAU,WAAW,GAAG,0BAA0B,GAAG,cAAc;AACzE,UAAM,YAAY,oBAAoB;AAAA,MAEpC,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAGF,QAAI,CAAC,WAAW;AACd,aAAO,SAAS,MAAM;AAAA;AAGxB,QAAI,CAAC,UAAU;AACb,UAAI,UAAU,YAAY;AACxB,4BAAoB,IAAI,UAAU,YAAY;AAAA;AAEhD,UAAI,UAAU,QAAQ;AACpB,qBAAa,IAAI,YAAY,UAAU;AAAA;AAAA;AAI3C,aAAS,MAAM,UAAU,IAAI,UAAU;AAAA,WAChC,KAAP;AACA,YAAQ,MAAM,SAAS;AACvB,WAAO,SAAS,MAAM;AAAA;AAAA;AAlFV;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamagui-loader",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"typings": "types.d.ts",
|
|
8
8
|
"files": [
|
|
9
|
+
"types.d.ts",
|
|
9
10
|
"dist",
|
|
10
11
|
"src"
|
|
11
12
|
],
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
"watch": "tamagui-build --watch"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
|
-
"@tamagui/static": "^1.0.0-alpha.
|
|
18
|
+
"@tamagui/static": "^1.0.0-alpha.6",
|
|
18
19
|
"fs-extra": "^9.1.0",
|
|
19
20
|
"loader-utils": "^2.0.0",
|
|
20
21
|
"lodash": "^4.17.21"
|
|
@@ -25,5 +26,5 @@
|
|
|
25
26
|
"publishConfig": {
|
|
26
27
|
"access": "public"
|
|
27
28
|
},
|
|
28
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "18a942d7a08109c8f5b8692a2adb20c69d56a7e1"
|
|
29
30
|
}
|
package/src/loader.ts
CHANGED
|
@@ -16,6 +16,7 @@ const stylePathToFilePath = new Map<string, string>()
|
|
|
16
16
|
|
|
17
17
|
let index = 0
|
|
18
18
|
let hasLogged = false
|
|
19
|
+
let hasPatched = false
|
|
19
20
|
|
|
20
21
|
process.env.TAMAGUI_TARGET = 'web'
|
|
21
22
|
|
|
@@ -23,17 +24,21 @@ export function loader(this: any, source: string) {
|
|
|
23
24
|
this.cacheable()
|
|
24
25
|
const callback = this.async()
|
|
25
26
|
|
|
26
|
-
if (!process.env.TAMAGUI_DISABLE_RNW_PATCH) {
|
|
27
|
+
if (!process.env.TAMAGUI_DISABLE_RNW_PATCH && !hasPatched) {
|
|
27
28
|
patchReactNativeWeb()
|
|
29
|
+
hasPatched = true
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
try {
|
|
31
33
|
const threaded = this.emitFile === undefined
|
|
32
34
|
const options: TamaguiOptions = { ...getOptions(this) }
|
|
33
35
|
|
|
34
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
options.disableExtraction &&
|
|
38
|
+
(options.disableDebugAttr || process.env.NODE_ENV !== 'development')
|
|
39
|
+
) {
|
|
35
40
|
if (!hasLogged) {
|
|
36
|
-
console.log('🥚 Tamagui disableExtraction set
|
|
41
|
+
console.log('🥚 Tamagui disableDebug & disableExtraction set, no parsing running')
|
|
37
42
|
hasLogged = true
|
|
38
43
|
}
|
|
39
44
|
return callback(null, source)
|
|
@@ -59,13 +64,11 @@ export function loader(this: any, source: string) {
|
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
// check if should ignore
|
|
62
|
-
const
|
|
63
|
-
|
|
67
|
+
const ext = extname(sourcePath)
|
|
64
68
|
if (
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
(
|
|
68
|
-
(source.startsWith('// tamagui-ignore') || source.startsWith('//! tamagui-ignore'))))
|
|
69
|
+
(ext !== '.tsx' && ext !== '.jsx') ||
|
|
70
|
+
(startsWithComment &&
|
|
71
|
+
(source.startsWith('// tamagui-ignore') || source.startsWith('//! tamagui-ignore')))
|
|
69
72
|
) {
|
|
70
73
|
return callback(null, source)
|
|
71
74
|
}
|