@tamagui/metro-plugin 1.113.1 → 1.113.2
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/esm/index.native.js
CHANGED
|
@@ -2,15 +2,19 @@ import { createExtractor, loadTamaguiBuildConfigSync } from "@tamagui/static";
|
|
|
2
2
|
import { withCssInterop } from "react-native-css-interop/metro";
|
|
3
3
|
function withTamagui(metroConfig, optionsIn) {
|
|
4
4
|
var options = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
extractor = createExtractor();
|
|
5
|
+
...optionsIn,
|
|
6
|
+
...loadTamaguiBuildConfigSync(optionsIn)
|
|
7
|
+
}, extractor = createExtractor();
|
|
9
8
|
options.disable || extractor.loadTamagui(options), options.disableCSSInterop ? metroConfig.resolver = {
|
|
10
9
|
...metroConfig.resolver,
|
|
11
|
-
sourceExts: [
|
|
10
|
+
sourceExts: [
|
|
11
|
+
...metroConfig.resolver.sourceExts,
|
|
12
|
+
"css"
|
|
13
|
+
]
|
|
12
14
|
} : metroConfig = withCssInterop(metroConfig, {
|
|
13
|
-
ignorePropertyWarningRegex: [
|
|
15
|
+
ignorePropertyWarningRegex: [
|
|
16
|
+
"^--"
|
|
17
|
+
]
|
|
14
18
|
});
|
|
15
19
|
var ogTransformPath = metroConfig.transformerPath;
|
|
16
20
|
return metroConfig.transformerPath = require.resolve("./transformer"), metroConfig.transformer = {
|
|
@@ -22,5 +26,7 @@ function withTamagui(metroConfig, optionsIn) {
|
|
|
22
26
|
}
|
|
23
27
|
}, metroConfig;
|
|
24
28
|
}
|
|
25
|
-
export {
|
|
26
|
-
|
|
29
|
+
export {
|
|
30
|
+
withTamagui
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/compiler/metro-plugin/src/index.ts"],
|
|
4
|
+
"mappings": "AAAA,SACEA,iBACAC,kCAEK;AACP,SACEC,sBAEK;AAEA,SAASC,YACdC,aACAC,WAEC;AAED,MAAMC,UAAU;IACd,GAAGD;IACH,GAAGJ,2BAA2BI,SAAAA;EAChC,GAGME,YAAYP,gBAAAA;AAGlB,EAAKM,QAAQE,WACND,UAAUE,YAAYH,OAAAA,GAGxBA,QAAQI,oBAOXN,YAAYO,WAAW;IACrB,GAAGP,YAAYO;IACfC,YAAY;SAAIR,YAAYO,SAASC;MAAY;;EACnD,IATAR,cAAcF,eAAeE,aAAa;IACxCS,4BAA4B;MAAC;;EAE/B,CAAA;AASF,MAAMC,kBAAkBV,YAAYW;AACpCX,qBAAYW,kBAAkBC,gBAAgB,eAAA,GAC9CZ,YAAYa,cAAc;IACxB,GAAGb,YAAYa;IACfH;IACAI,SAAS;MACP,GAAGZ;MACHa,qBAAqB;IACvB;EACF,GAEOf;AACT;",
|
|
5
|
+
"names": ["createExtractor", "loadTamaguiBuildConfigSync", "withCssInterop", "withTamagui", "metroConfig", "optionsIn", "options", "extractor", "disable", "loadTamagui", "disableCSSInterop", "resolver", "sourceExts", "ignorePropertyWarningRegex", "ogTransformPath", "transformerPath", "require", "transformer", "tamagui", "disableInitialBuild"]
|
|
6
|
+
}
|
|
@@ -4,29 +4,26 @@ import { join, posix, sep } from "node:path";
|
|
|
4
4
|
import { createExtractor, extractToClassNames } from "@tamagui/static";
|
|
5
5
|
var extractor = createExtractor();
|
|
6
6
|
async function transform(config, projectRoot, filename, data, options) {
|
|
7
|
-
var ogPath = config.ogTransformPath || config.transformerPath,
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var ogPath = config.ogTransformPath || config.transformerPath, transformer = ogPath ? require(ogPath).transform : worker.transform;
|
|
8
|
+
if (config.tamagui.disable || options.platform !== "web" || options.type === "asset" || filename.includes("node_modules"))
|
|
9
|
+
return transformer(config, projectRoot, filename, data, options);
|
|
10
10
|
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
11
|
+
// could by a styled() call:
|
|
12
|
+
filename.endsWith(".ts") || filename.endsWith(".tsx") || filename.endsWith(".jsx")
|
|
13
|
+
) {
|
|
14
|
+
var sourcePath = toPosixPath(join(projectRoot, filename)), source = `${data}`, out = await extractToClassNames({
|
|
15
|
+
extractor,
|
|
16
|
+
options: {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
platform: "web",
|
|
19
|
+
...config.tamagui
|
|
20
|
+
},
|
|
21
|
+
shouldPrintDebug: source.startsWith("// debug-verbose") ? "verbose" : source.startsWith("// debug"),
|
|
22
|
+
source,
|
|
23
|
+
sourcePath
|
|
24
|
+
});
|
|
26
25
|
if (out?.styles) {
|
|
27
|
-
var _process_env_DEBUG,
|
|
28
|
-
tmpDir = join(projectRoot, ".tamagui", "css"),
|
|
29
|
-
outStylePath = toPosixPath(join(tmpDir, `${filename}`.replace(/[^a-zA-Z0-9]/gi, "") + ".css"));
|
|
26
|
+
var _process_env_DEBUG, tmpDir = join(projectRoot, ".tamagui", "css"), outStylePath = toPosixPath(join(tmpDir, `${filename}`.replace(/[^a-zA-Z0-9]/gi, "") + ".css"));
|
|
30
27
|
if (!((_process_env_DEBUG = process.env.DEBUG) === null || _process_env_DEBUG === void 0) && _process_env_DEBUG.includes("tamagui") && console.info(" Outputting CSS file:", outStylePath), process.env.TAMAGUI_METRO_INLINE_CSS !== "0") {
|
|
31
28
|
var cssInjectionCode = `
|
|
32
29
|
(function() {
|
|
@@ -43,9 +40,9 @@ async function transform(config, projectRoot, filename, data, options) {
|
|
|
43
40
|
${cssInjectionCode}`, "utf-8"), options);
|
|
44
41
|
}
|
|
45
42
|
var existsAlready = await pathExists(outStylePath);
|
|
46
|
-
return await outputFile(outStylePath, out.styles, "utf-8"), existsAlready ||
|
|
43
|
+
return await outputFile(outStylePath, out.styles, "utf-8"), existsAlready || await new Promise(function(res) {
|
|
47
44
|
return setTimeout(res, process.env.TAMAGUI_METRO_CSS_EMIT_DELAY ? +process.env.TAMAGUI_METRO_CSS_EMIT_DELAY : 1e3);
|
|
48
|
-
})
|
|
45
|
+
}), transformer(config, projectRoot, filename, Buffer.from(`${out.js}
|
|
49
46
|
require("${outStylePath}")`, "utf-8"), options);
|
|
50
47
|
}
|
|
51
48
|
}
|
|
@@ -54,5 +51,7 @@ require("${outStylePath}")`, "utf-8"), options);
|
|
|
54
51
|
function toPosixPath(path) {
|
|
55
52
|
return path.split(sep).join(posix.sep);
|
|
56
53
|
}
|
|
57
|
-
export {
|
|
58
|
-
|
|
54
|
+
export {
|
|
55
|
+
transform
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=transformer.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/compiler/metro-plugin/src/transformer.ts"],
|
|
4
|
+
"mappings": "AAAA,SAASA,YAAYC,kBAAkB;AAMvC,OAAOC,YAAY;AACnB,SAASC,MAAMC,OAAOC,WAAW;AAGjC,SAASC,iBAAiBC,2BAA2B;AAOrD,IAAMC,YAAYF,gBAAAA;AAElB,eAAsBG,UACpBC,QACAC,aACAC,UACAC,MACAC,SAA2B;AAE3B,MAAMC,SAASL,OAAO,mBAAsBA,OAAOM,iBAC7CC,cAAcF,SAASG,QAAQH,MAAAA,EAAQN,YAAYP,OAAOO;AAEhE,MACEC,OAAOS,QAAQC,WACfN,QAAQO,aAAa,SACrBP,QAAQQ,SAAS,WACjBV,SAASW,SAAS,cAAA;AAElB,WAAON,YAAYP,QAAQC,aAAaC,UAAUC,MAAMC,OAAAA;AAG1D;;IAEEF,SAASY,SAAS,KAAA,KAClBZ,SAASY,SAAS,MAAA,K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UAAUC,MAAMC,OAAAA;AAC1D;AAEA,SAASY,YAAY0B,MAAY;AAC/B,SAAOA,KAAKC,MAAMhD,GAAAA,EAAKF,KAAKC,MAAMC,GAAG;AACvC;",
|
|
5
|
+
"names": ["outputFile", "pathExists", "worker", "join", "posix", "sep", "createExtractor", "extractToClassNames", "extractor", "transform", "config", "projectRoot", "filename", "data", "options", "ogPath", "transformerPath", "transformer", "require", "tamagui", "disable", "platform", "type", "includes", "endsWith", "sourcePath", "toPosixPath", "source", "out", "shouldPrintDebug", "startsWith", "styles", "process", "tmpDir", "outStylePath", "replace", "env", "DEBUG", "console", "info", "TAMAGUI_METRO_INLINE_CSS", "cssInjectionCode", "JSON", "stringify", "Buffer", "from", "js", "existsAlready", "Promise", "res", "setTimeout", "TAMAGUI_METRO_CSS_EMIT_DELAY", "path", "split"]
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/metro-plugin",
|
|
3
|
-
"version": "1.113.
|
|
3
|
+
"version": "1.113.2",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"clean:build": "tamagui-build clean:build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tamagui/static": "1.113.
|
|
26
|
+
"@tamagui/static": "1.113.2",
|
|
27
27
|
"fs-extra": "^11.2.0",
|
|
28
28
|
"metro-config": "^0.80.4",
|
|
29
29
|
"metro-transform-worker": "^0.80.4",
|
|
30
30
|
"react-native-css-interop": "~0.0.21"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "1.113.
|
|
33
|
+
"@tamagui/build": "1.113.2"
|
|
34
34
|
}
|
|
35
35
|
}
|