@tamagui/static 3.0.0-beta.1216.1 → 3.0.0-beta.1309.1
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/exports.cjs +2 -0
- package/dist/cjs/extractor/esbuildTsconfigPaths.cjs +44 -47
- package/dist/esm/exports.mjs +2 -1
- package/dist/esm/extractor/esbuildTsconfigPaths.mjs +44 -47
- package/dist/esm/extractor/esbuildTsconfigPaths.mjs.map +1 -1
- package/dist/esm/extractor/generateConfigMarkdown.mjs +1 -6
- package/package.json +20 -19
- package/src/exports.ts +1 -0
- package/src/extractor/esbuildTsconfigPaths.ts +63 -80
- package/types/exports.d.ts +1 -0
- package/types/exports.d.ts.map +1 -1
- package/types/extractor/esbuildTsconfigPaths.d.ts +3 -7
- package/types/extractor/esbuildTsconfigPaths.d.ts.map +1 -1
package/dist/cjs/exports.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
var exports_exports = {};
|
|
23
23
|
__export(exports_exports, {
|
|
24
24
|
clearFormatCache: () => import_detectModuleFormat.clearFormatCache,
|
|
25
|
+
createTsconfigPathsMatcher: () => import_esbuildTsconfigPaths.createTsconfigPathsMatcher,
|
|
25
26
|
detectModuleFormat: () => import_detectModuleFormat.detectModuleFormat,
|
|
26
27
|
esbundleTamaguiConfig: () => import_bundle.esbundleTamaguiConfig,
|
|
27
28
|
evaluateComponentModule: () => import_bundleConfig.evaluateComponentModule,
|
|
@@ -41,6 +42,7 @@ __reExport(exports_exports, require("./extractor/watchTamaguiConfig.cjs"), modul
|
|
|
41
42
|
__reExport(exports_exports, require("./registerRequire.cjs"), module.exports);
|
|
42
43
|
var import_detectModuleFormat = require("./extractor/detectModuleFormat.cjs");
|
|
43
44
|
var import_bundle = require("./extractor/bundle.cjs");
|
|
45
|
+
var import_esbuildTsconfigPaths = require("./extractor/esbuildTsconfigPaths.cjs");
|
|
44
46
|
__reExport(exports_exports, require("./getPragmaOptions.cjs"), module.exports);
|
|
45
47
|
__reExport(exports_exports, require("./zero/index.cjs"), module.exports);
|
|
46
48
|
var import_generateConfigMarkdown = require("./extractor/generateConfigMarkdown.cjs");
|
|
@@ -27,65 +27,62 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
27
27
|
var esbuildTsconfigPaths_exports = {};
|
|
28
28
|
__export(esbuildTsconfigPaths_exports, {
|
|
29
29
|
TsconfigPathsPlugin: () => TsconfigPathsPlugin,
|
|
30
|
-
|
|
30
|
+
createTsconfigPathsMatcher: () => createTsconfigPathsMatcher
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(esbuildTsconfigPaths_exports);
|
|
33
33
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
34
34
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
|
-
var
|
|
35
|
+
var import_get_tsconfig = require("get-tsconfig");
|
|
36
36
|
const name = "tsconfig-paths";
|
|
37
|
+
function loadTsconfig(tsconfig, cwd = process.cwd()) {
|
|
38
|
+
if (!tsconfig) {
|
|
39
|
+
return (0, import_get_tsconfig.getTsconfig)(cwd) || (0, import_get_tsconfig.getTsconfig)(cwd, "jsconfig.json");
|
|
40
|
+
}
|
|
41
|
+
if (typeof tsconfig === "string") {
|
|
42
|
+
const configPath = import_node_path.default.resolve(cwd, tsconfig);
|
|
43
|
+
if (!import_node_fs.default.existsSync(configPath)) {
|
|
44
|
+
throw new Error(`Specified tsconfig file not found: ${configPath}`);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
path: configPath,
|
|
48
|
+
config: (0, import_get_tsconfig.parseTsconfig)(configPath)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
path: import_node_path.default.join(cwd, "tsconfig.json"),
|
|
53
|
+
config: tsconfig
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function createTsconfigPathsMatcher(tsconfig, cwd = process.cwd()) {
|
|
57
|
+
const loaded = loadTsconfig(tsconfig, cwd);
|
|
58
|
+
return loaded ? (0, import_get_tsconfig.createPathsMatcher)(loaded) : null;
|
|
59
|
+
}
|
|
37
60
|
function TsconfigPathsPlugin() {
|
|
38
|
-
const
|
|
61
|
+
const pathsMatcher = createTsconfigPathsMatcher();
|
|
39
62
|
return {
|
|
40
63
|
name,
|
|
41
|
-
setup(
|
|
42
|
-
onResolve({ filter: /.*/ }, (args) => {
|
|
43
|
-
if (args.path.startsWith("@tamagui/")) {
|
|
64
|
+
setup(build) {
|
|
65
|
+
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
66
|
+
if (!pathsMatcher || args.path.startsWith("@tamagui/") || args.pluginData?.tamaguiTsconfigPaths) {
|
|
44
67
|
return null;
|
|
45
68
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
for (const candidate of pathsMatcher(args.path)) {
|
|
70
|
+
const resolved = await build.resolve(candidate, {
|
|
71
|
+
importer: args.importer,
|
|
72
|
+
kind: args.kind,
|
|
73
|
+
namespace: args.namespace,
|
|
74
|
+
resolveDir: args.resolveDir,
|
|
75
|
+
pluginData: {
|
|
76
|
+
...args.pluginData,
|
|
77
|
+
tamaguiTsconfigPaths: true
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
if (resolved.errors.length === 0 && resolved.path && !resolved.path.endsWith(".d.ts")) {
|
|
81
|
+
return resolved;
|
|
82
|
+
}
|
|
54
83
|
}
|
|
55
|
-
|
|
56
|
-
if (!resolvedFileName || resolvedFileName.endsWith(".d.ts")) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
return { path: resolvedFileName };
|
|
84
|
+
return null;
|
|
60
85
|
});
|
|
61
86
|
}
|
|
62
87
|
};
|
|
63
88
|
}
|
|
64
|
-
function loadCompilerOptionsFromTsconfig(tsconfig) {
|
|
65
|
-
if (!tsconfig) {
|
|
66
|
-
const configPath = (0, import_typescript.findConfigFile)(process.cwd(), import_typescript.sys.fileExists, "tsconfig.json") || (0, import_typescript.findConfigFile)(process.cwd(), import_typescript.sys.fileExists, "jsconfig.json");
|
|
67
|
-
if (configPath) {
|
|
68
|
-
return parseTsconfig(configPath);
|
|
69
|
-
}
|
|
70
|
-
return {};
|
|
71
|
-
}
|
|
72
|
-
if (typeof tsconfig === "string") {
|
|
73
|
-
if (import_node_fs.default.existsSync(tsconfig)) {
|
|
74
|
-
return parseTsconfig(tsconfig);
|
|
75
|
-
} else {
|
|
76
|
-
throw new Error(`Specified tsconfig file not found: ${tsconfig}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const baseDir = process.cwd();
|
|
80
|
-
const parsed = (0, import_typescript.parseJsonConfigFileContent)(tsconfig, import_typescript.sys, baseDir);
|
|
81
|
-
return parsed.options;
|
|
82
|
-
}
|
|
83
|
-
function parseTsconfig(configFilePath) {
|
|
84
|
-
const configFile = (0, import_typescript.readConfigFile)(configFilePath, import_typescript.sys.readFile);
|
|
85
|
-
if (configFile.error) {
|
|
86
|
-
throw new Error(`Error reading tsconfig file '${configFilePath}': ${configFile.error.messageText}`);
|
|
87
|
-
}
|
|
88
|
-
const baseDir = import_node_path.default.dirname(configFilePath);
|
|
89
|
-
const parsed = (0, import_typescript.parseJsonConfigFileContent)(configFile.config, import_typescript.sys, baseDir);
|
|
90
|
-
return parsed.options;
|
|
91
|
-
}
|
package/dist/esm/exports.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { evaluateComponentModule } from "./extractor/bundleConfig.mjs";
|
|
2
2
|
import { clearFormatCache, detectModuleFormat } from "./extractor/detectModuleFormat.mjs";
|
|
3
3
|
import { esbundleTamaguiConfig } from "./extractor/bundle.mjs";
|
|
4
|
+
import { createTsconfigPathsMatcher } from "./extractor/esbuildTsconfigPaths.mjs";
|
|
4
5
|
import { generateConfigMarkdown } from "./extractor/generateConfigMarkdown.mjs";
|
|
5
6
|
|
|
6
7
|
export * from "./checkDeps.mjs"
|
|
@@ -27,4 +28,4 @@ export * from "./getPragmaOptions.mjs"
|
|
|
27
28
|
|
|
28
29
|
export * from "./zero/index.mjs"
|
|
29
30
|
|
|
30
|
-
export { clearFormatCache, detectModuleFormat, esbundleTamaguiConfig, evaluateComponentModule, generateConfigMarkdown };
|
|
31
|
+
export { clearFormatCache, createTsconfigPathsMatcher, detectModuleFormat, esbundleTamaguiConfig, evaluateComponentModule, generateConfigMarkdown };
|
|
@@ -1,63 +1,60 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { createPathsMatcher, getTsconfig, parseTsconfig } from "get-tsconfig";
|
|
4
4
|
|
|
5
5
|
const name = "tsconfig-paths";
|
|
6
|
+
function loadTsconfig(tsconfig, cwd = process.cwd()) {
|
|
7
|
+
if (!tsconfig) {
|
|
8
|
+
return getTsconfig(cwd) || getTsconfig(cwd, "jsconfig.json");
|
|
9
|
+
}
|
|
10
|
+
if (typeof tsconfig === "string") {
|
|
11
|
+
const configPath = path.resolve(cwd, tsconfig);
|
|
12
|
+
if (!fs.existsSync(configPath)) {
|
|
13
|
+
throw new Error(`Specified tsconfig file not found: ${configPath}`);
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
path: configPath,
|
|
17
|
+
config: parseTsconfig(configPath)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
path: path.join(cwd, "tsconfig.json"),
|
|
22
|
+
config: tsconfig
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function createTsconfigPathsMatcher(tsconfig, cwd = process.cwd()) {
|
|
26
|
+
const loaded = loadTsconfig(tsconfig, cwd);
|
|
27
|
+
return loaded ? createPathsMatcher(loaded) : null;
|
|
28
|
+
}
|
|
6
29
|
function TsconfigPathsPlugin() {
|
|
7
|
-
const
|
|
30
|
+
const pathsMatcher = createTsconfigPathsMatcher();
|
|
8
31
|
return {
|
|
9
32
|
name,
|
|
10
|
-
setup(
|
|
11
|
-
onResolve({ filter: /.*/ }, (args) => {
|
|
12
|
-
if (args.path.startsWith("@tamagui/")) {
|
|
33
|
+
setup(build) {
|
|
34
|
+
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
35
|
+
if (!pathsMatcher || args.path.startsWith("@tamagui/") || args.pluginData?.tamaguiTsconfigPaths) {
|
|
13
36
|
return null;
|
|
14
37
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
38
|
+
for (const candidate of pathsMatcher(args.path)) {
|
|
39
|
+
const resolved = await build.resolve(candidate, {
|
|
40
|
+
importer: args.importer,
|
|
41
|
+
kind: args.kind,
|
|
42
|
+
namespace: args.namespace,
|
|
43
|
+
resolveDir: args.resolveDir,
|
|
44
|
+
pluginData: {
|
|
45
|
+
...args.pluginData,
|
|
46
|
+
tamaguiTsconfigPaths: true
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (resolved.errors.length === 0 && resolved.path && !resolved.path.endsWith(".d.ts")) {
|
|
50
|
+
return resolved;
|
|
51
|
+
}
|
|
23
52
|
}
|
|
24
|
-
|
|
25
|
-
if (!resolvedFileName || resolvedFileName.endsWith(".d.ts")) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return { path: resolvedFileName };
|
|
53
|
+
return null;
|
|
29
54
|
});
|
|
30
55
|
}
|
|
31
56
|
};
|
|
32
57
|
}
|
|
33
|
-
function loadCompilerOptionsFromTsconfig(tsconfig) {
|
|
34
|
-
if (!tsconfig) {
|
|
35
|
-
const configPath = findConfigFile(process.cwd(), sys.fileExists, "tsconfig.json") || findConfigFile(process.cwd(), sys.fileExists, "jsconfig.json");
|
|
36
|
-
if (configPath) {
|
|
37
|
-
return parseTsconfig(configPath);
|
|
38
|
-
}
|
|
39
|
-
return {};
|
|
40
|
-
}
|
|
41
|
-
if (typeof tsconfig === "string") {
|
|
42
|
-
if (fs.existsSync(tsconfig)) {
|
|
43
|
-
return parseTsconfig(tsconfig);
|
|
44
|
-
} else {
|
|
45
|
-
throw new Error(`Specified tsconfig file not found: ${tsconfig}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const baseDir = process.cwd();
|
|
49
|
-
const parsed = parseJsonConfigFileContent(tsconfig, sys, baseDir);
|
|
50
|
-
return parsed.options;
|
|
51
|
-
}
|
|
52
|
-
function parseTsconfig(configFilePath) {
|
|
53
|
-
const configFile = readConfigFile(configFilePath, sys.readFile);
|
|
54
|
-
if (configFile.error) {
|
|
55
|
-
throw new Error(`Error reading tsconfig file '${configFilePath}': ${configFile.error.messageText}`);
|
|
56
|
-
}
|
|
57
|
-
const baseDir = path.dirname(configFilePath);
|
|
58
|
-
const parsed = parseJsonConfigFileContent(configFile.config, sys, baseDir);
|
|
59
|
-
return parsed.options;
|
|
60
|
-
}
|
|
61
58
|
|
|
62
|
-
export { TsconfigPathsPlugin,
|
|
59
|
+
export { TsconfigPathsPlugin, createTsconfigPathsMatcher };
|
|
63
60
|
//# sourceMappingURL=esbuildTsconfigPaths.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuildTsconfigPaths.js","names":[],"sources":["esm/extractor/esbuildTsconfigPaths.js"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"esbuildTsconfigPaths.js","names":[],"sources":["esm/extractor/esbuildTsconfigPaths.js"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n createPathsMatcher,\n getTsconfig,\n parseTsconfig\n} from \"get-tsconfig\";\nconst name = \"tsconfig-paths\";\nfunction loadTsconfig(tsconfig, cwd = process.cwd()) {\n if (!tsconfig) {\n return getTsconfig(cwd) || getTsconfig(cwd, \"jsconfig.json\");\n }\n if (typeof tsconfig === \"string\") {\n const configPath = path.resolve(cwd, tsconfig);\n if (!fs.existsSync(configPath)) {\n throw new Error(`Specified tsconfig file not found: ${configPath}`);\n }\n return { path: configPath, config: parseTsconfig(configPath) };\n }\n return {\n path: path.join(cwd, \"tsconfig.json\"),\n config: tsconfig\n };\n}\nfunction createTsconfigPathsMatcher(tsconfig, cwd = process.cwd()) {\n const loaded = loadTsconfig(tsconfig, cwd);\n return loaded ? createPathsMatcher(loaded) : null;\n}\nfunction TsconfigPathsPlugin() {\n const pathsMatcher = createTsconfigPathsMatcher();\n return {\n name,\n setup(build) {\n build.onResolve({ filter: /.*/ }, async (args) => {\n if (!pathsMatcher || args.path.startsWith(\"@tamagui/\") || args.pluginData?.tamaguiTsconfigPaths) {\n return null;\n }\n for (const candidate of pathsMatcher(args.path)) {\n const resolved = await build.resolve(candidate, {\n importer: args.importer,\n kind: args.kind,\n namespace: args.namespace,\n resolveDir: args.resolveDir,\n pluginData: {\n ...args.pluginData,\n tamaguiTsconfigPaths: true\n }\n });\n if (resolved.errors.length === 0 && resolved.path && !resolved.path.endsWith(\".d.ts\")) {\n return resolved;\n }\n }\n return null;\n });\n }\n };\n}\nexport {\n TsconfigPathsPlugin,\n createTsconfigPathsMatcher\n};\n//# sourceMappingURL=esbuildTsconfigPaths.js.map\n"],"mappings":";;;;;AAOA,MAAM,OAAO;AACb,SAAS,aAAa,UAAU,MAAM,QAAQ,IAAI,GAAG;CACnD,IAAI,CAAC,UAAU;EACb,OAAO,YAAY,GAAG,KAAK,YAAY,KAAK,eAAe;CAC7D;CACA,IAAI,OAAO,aAAa,UAAU;EAChC,MAAM,aAAa,KAAK,QAAQ,KAAK,QAAQ;EAC7C,IAAI,CAAC,GAAG,WAAW,UAAU,GAAG;GAC9B,MAAM,IAAI,MAAM,sCAAsC,YAAY;EACpE;EACA,OAAO;GAAE,MAAM;GAAY,QAAQ,cAAc,UAAU;EAAE;CAC/D;CACA,OAAO;EACL,MAAM,KAAK,KAAK,KAAK,eAAe;EACpC,QAAQ;CACV;AACF;AACA,SAAS,2BAA2B,UAAU,MAAM,QAAQ,IAAI,GAAG;CACjE,MAAM,SAAS,aAAa,UAAU,GAAG;CACzC,OAAO,SAAS,mBAAmB,MAAM,IAAI;AAC/C;AACA,SAAS,sBAAsB;CAC7B,MAAM,eAAe,2BAA2B;CAChD,OAAO;EACL;EACA,MAAM,OAAO;GACX,MAAM,UAAU,EAAE,QAAQ,KAAK,GAAG,OAAO,SAAS;IAChD,IAAI,CAAC,gBAAgB,KAAK,KAAK,WAAW,WAAW,KAAK,KAAK,YAAY,sBAAsB;KAC/F,OAAO;IACT;IACA,KAAK,MAAM,aAAa,aAAa,KAAK,IAAI,GAAG;KAC/C,MAAM,WAAW,MAAM,MAAM,QAAQ,WAAW;MAC9C,UAAU,KAAK;MACf,MAAM,KAAK;MACX,WAAW,KAAK;MAChB,YAAY,KAAK;MACjB,YAAY;OACV,GAAG,KAAK;OACR,sBAAsB;MACxB;KACF,CAAC;KACD,IAAI,SAAS,OAAO,WAAW,KAAK,SAAS,QAAQ,CAAC,SAAS,KAAK,SAAS,OAAO,GAAG;MACrF,OAAO;KACT;IACF;IACA,OAAO;GACT,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
2
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
3
|
-
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
4
|
-
});
|
|
5
|
-
|
|
6
1
|
function generateConfigMarkdown(config, options) {
|
|
7
2
|
const sections = [];
|
|
8
3
|
sections.push("# Tamagui Configuration\n\n");
|
|
@@ -397,7 +392,7 @@ function generateConfigMarkdown(config, options) {
|
|
|
397
392
|
for (const modName of candidateModules) {
|
|
398
393
|
if (!modName) continue;
|
|
399
394
|
try {
|
|
400
|
-
const mod =
|
|
395
|
+
const mod = require(modName);
|
|
401
396
|
for (const [key, val] of Object.entries(mod)) {
|
|
402
397
|
if (/^[A-Z]/.test(key) && (typeof val === "function" || typeof val === "object" && val !== null)) {
|
|
403
398
|
if (!key.endsWith("Context") && !key.endsWith("Provider") && key !== "Fragment") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.1309.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -45,22 +45,22 @@
|
|
|
45
45
|
"clean:build": "tamagui-build clean:build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@tamagui/animation-helpers": "3.0.0-beta.
|
|
49
|
-
"@tamagui/cli-color": "3.0.0-beta.
|
|
50
|
-
"@tamagui/compiler-core": "3.0.0-beta.
|
|
51
|
-
"@tamagui/config-default": "3.0.0-beta.
|
|
52
|
-
"@tamagui/core": "3.0.0-beta.
|
|
53
|
-
"@tamagui/dom": "3.0.0-beta.
|
|
54
|
-
"@tamagui/fake-react-native": "3.0.0-beta.
|
|
55
|
-
"@tamagui/generate-themes": "3.0.0-beta.
|
|
56
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
57
|
-
"@tamagui/helpers-node": "3.0.0-beta.
|
|
58
|
-
"@tamagui/react-native-web-internals": "3.0.0-beta.
|
|
59
|
-
"@tamagui/react-native-web-lite": "3.0.0-beta.
|
|
60
|
-
"@tamagui/shorthands": "3.0.0-beta.
|
|
61
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
62
|
-
"@tamagui/types": "3.0.0-beta.
|
|
63
|
-
"@tamagui/web": "3.0.0-beta.
|
|
48
|
+
"@tamagui/animation-helpers": "3.0.0-beta.1309.1",
|
|
49
|
+
"@tamagui/cli-color": "3.0.0-beta.1309.1",
|
|
50
|
+
"@tamagui/compiler-core": "3.0.0-beta.1309.1",
|
|
51
|
+
"@tamagui/config-default": "3.0.0-beta.1309.1",
|
|
52
|
+
"@tamagui/core": "3.0.0-beta.1309.1",
|
|
53
|
+
"@tamagui/dom": "3.0.0-beta.1309.1",
|
|
54
|
+
"@tamagui/fake-react-native": "3.0.0-beta.1309.1",
|
|
55
|
+
"@tamagui/generate-themes": "3.0.0-beta.1309.1",
|
|
56
|
+
"@tamagui/helpers": "3.0.0-beta.1309.1",
|
|
57
|
+
"@tamagui/helpers-node": "3.0.0-beta.1309.1",
|
|
58
|
+
"@tamagui/react-native-web-internals": "3.0.0-beta.1309.1",
|
|
59
|
+
"@tamagui/react-native-web-lite": "3.0.0-beta.1309.1",
|
|
60
|
+
"@tamagui/shorthands": "3.0.0-beta.1309.1",
|
|
61
|
+
"@tamagui/style-grammar": "3.0.0-beta.1309.1",
|
|
62
|
+
"@tamagui/types": "3.0.0-beta.1309.1",
|
|
63
|
+
"@tamagui/web": "3.0.0-beta.1309.1",
|
|
64
64
|
"browserslist": "^4.28.1",
|
|
65
65
|
"check-dependency-version-consistency": "^4.1.0",
|
|
66
66
|
"esbuild": "0.28.1",
|
|
@@ -68,11 +68,12 @@
|
|
|
68
68
|
"fast-glob": "^3.2.11",
|
|
69
69
|
"find-root": "^1.1.0",
|
|
70
70
|
"fs-extra": "^11.2.0",
|
|
71
|
+
"get-tsconfig": "^4.14.0",
|
|
71
72
|
"js-yaml": "^4.1.0",
|
|
72
73
|
"react-native-web": "~0.21.0"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
|
-
"@tamagui/build": "3.0.0-beta.
|
|
76
|
+
"@tamagui/build": "3.0.0-beta.1309.1",
|
|
76
77
|
"@types/find-root": "^1.1.2",
|
|
77
78
|
"@types/node": "^22.1.0",
|
|
78
79
|
"@types/webpack": "^4.41.26",
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
"null-loader": "^4.0.1",
|
|
81
82
|
"react": "19.2.3",
|
|
82
83
|
"react-native": "0.86.2",
|
|
83
|
-
"typescript": "
|
|
84
|
+
"typescript": "7.0.2"
|
|
84
85
|
},
|
|
85
86
|
"peerDependencies": {
|
|
86
87
|
"react": ">=19"
|
package/src/exports.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './extractor/watchTamaguiConfig'
|
|
|
11
11
|
export * from './registerRequire'
|
|
12
12
|
export { detectModuleFormat, clearFormatCache } from './extractor/detectModuleFormat'
|
|
13
13
|
export { esbundleTamaguiConfig } from './extractor/bundle'
|
|
14
|
+
export { createTsconfigPathsMatcher } from './extractor/esbuildTsconfigPaths'
|
|
14
15
|
export * from './getPragmaOptions'
|
|
15
16
|
export * from './zero'
|
|
16
17
|
|
|
@@ -2,102 +2,85 @@ import type { Plugin } from 'esbuild'
|
|
|
2
2
|
import fs from 'node:fs'
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from '
|
|
5
|
+
createPathsMatcher,
|
|
6
|
+
getTsconfig,
|
|
7
|
+
parseTsconfig,
|
|
8
|
+
type TsConfigJsonResolved,
|
|
9
|
+
type TsConfigResult,
|
|
10
|
+
} from 'get-tsconfig'
|
|
11
11
|
|
|
12
12
|
const name = 'tsconfig-paths'
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
type Tsconfig = Pick<TsConfigJsonResolved, 'compilerOptions'>
|
|
15
|
+
|
|
16
|
+
function loadTsconfig(
|
|
17
|
+
tsconfig?: Tsconfig | string,
|
|
18
|
+
cwd = process.cwd()
|
|
19
|
+
): TsConfigResult | null {
|
|
20
|
+
if (!tsconfig) {
|
|
21
|
+
return getTsconfig(cwd) || getTsconfig(cwd, 'jsconfig.json')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (typeof tsconfig === 'string') {
|
|
25
|
+
const configPath = path.resolve(cwd, tsconfig)
|
|
26
|
+
if (!fs.existsSync(configPath)) {
|
|
27
|
+
throw new Error(`Specified tsconfig file not found: ${configPath}`)
|
|
28
|
+
}
|
|
29
|
+
return { path: configPath, config: parseTsconfig(configPath) }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
path: path.join(cwd, 'tsconfig.json'),
|
|
34
|
+
config: tsconfig,
|
|
18
35
|
}
|
|
19
36
|
}
|
|
20
37
|
|
|
38
|
+
export function createTsconfigPathsMatcher(
|
|
39
|
+
tsconfig?: Tsconfig | string,
|
|
40
|
+
cwd = process.cwd()
|
|
41
|
+
): ((specifier: string) => string[]) | null {
|
|
42
|
+
const loaded = loadTsconfig(tsconfig, cwd)
|
|
43
|
+
return loaded ? createPathsMatcher(loaded) : null
|
|
44
|
+
}
|
|
45
|
+
|
|
21
46
|
export function TsconfigPathsPlugin(): Plugin {
|
|
22
|
-
const
|
|
47
|
+
const pathsMatcher = createTsconfigPathsMatcher()
|
|
23
48
|
|
|
24
49
|
return {
|
|
25
50
|
name,
|
|
26
|
-
setup(
|
|
27
|
-
onResolve({ filter: /.*/ }, (args) => {
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
setup(build) {
|
|
52
|
+
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
53
|
+
if (
|
|
54
|
+
!pathsMatcher ||
|
|
55
|
+
args.path.startsWith('@tamagui/') ||
|
|
56
|
+
(args.pluginData as { tamaguiTsconfigPaths?: boolean } | undefined)
|
|
57
|
+
?.tamaguiTsconfigPaths
|
|
58
|
+
) {
|
|
30
59
|
return null
|
|
31
60
|
}
|
|
32
61
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
62
|
+
for (const candidate of pathsMatcher(args.path)) {
|
|
63
|
+
const resolved = await build.resolve(candidate, {
|
|
64
|
+
importer: args.importer,
|
|
65
|
+
kind: args.kind,
|
|
66
|
+
namespace: args.namespace,
|
|
67
|
+
resolveDir: args.resolveDir,
|
|
68
|
+
pluginData: {
|
|
69
|
+
...(args.pluginData as object | undefined),
|
|
70
|
+
tamaguiTsconfigPaths: true,
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
if (
|
|
74
|
+
resolved.errors.length === 0 &&
|
|
75
|
+
resolved.path &&
|
|
76
|
+
!resolved.path.endsWith('.d.ts')
|
|
77
|
+
) {
|
|
78
|
+
return resolved
|
|
79
|
+
}
|
|
40
80
|
}
|
|
41
81
|
|
|
42
|
-
|
|
43
|
-
args.path,
|
|
44
|
-
args.importer,
|
|
45
|
-
compilerOptions,
|
|
46
|
-
sys
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
if (!resolvedModule) {
|
|
50
|
-
return null
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const { resolvedFileName } = resolvedModule
|
|
54
|
-
|
|
55
|
-
if (!resolvedFileName || resolvedFileName.endsWith('.d.ts')) {
|
|
56
|
-
return null
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
path: resolvedFileName,
|
|
61
|
-
}
|
|
82
|
+
return null
|
|
62
83
|
})
|
|
63
84
|
},
|
|
64
85
|
}
|
|
65
86
|
}
|
|
66
|
-
|
|
67
|
-
export function loadCompilerOptionsFromTsconfig(tsconfig?: Tsconfig | string) {
|
|
68
|
-
if (!tsconfig) {
|
|
69
|
-
const configPath =
|
|
70
|
-
findConfigFile(process.cwd(), sys.fileExists, 'tsconfig.json') ||
|
|
71
|
-
findConfigFile(process.cwd(), sys.fileExists, 'jsconfig.json')
|
|
72
|
-
|
|
73
|
-
if (configPath) {
|
|
74
|
-
return parseTsconfig(configPath)
|
|
75
|
-
}
|
|
76
|
-
return {}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (typeof tsconfig === 'string') {
|
|
80
|
-
if (fs.existsSync(tsconfig)) {
|
|
81
|
-
return parseTsconfig(tsconfig)
|
|
82
|
-
} else {
|
|
83
|
-
throw new Error(`Specified tsconfig file not found: ${tsconfig}`)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const baseDir = process.cwd()
|
|
88
|
-
const parsed = parseJsonConfigFileContent(tsconfig, sys, baseDir)
|
|
89
|
-
return parsed.options
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function parseTsconfig(configFilePath: string) {
|
|
93
|
-
const configFile = readConfigFile(configFilePath, sys.readFile)
|
|
94
|
-
if (configFile.error) {
|
|
95
|
-
throw new Error(
|
|
96
|
-
`Error reading tsconfig file '${configFilePath}': ${configFile.error.messageText}`
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const baseDir = path.dirname(configFilePath)
|
|
101
|
-
const parsed = parseJsonConfigFileContent(configFile.config, sys, baseDir)
|
|
102
|
-
return parsed.options
|
|
103
|
-
}
|
package/types/exports.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './extractor/watchTamaguiConfig';
|
|
|
11
11
|
export * from './registerRequire';
|
|
12
12
|
export { detectModuleFormat, clearFormatCache } from './extractor/detectModuleFormat';
|
|
13
13
|
export { esbundleTamaguiConfig } from './extractor/bundle';
|
|
14
|
+
export { createTsconfigPathsMatcher } from './extractor/esbuildTsconfigPaths';
|
|
14
15
|
export * from './getPragmaOptions';
|
|
15
16
|
export * from './zero';
|
|
16
17
|
export { generateConfigMarkdown } from './extractor/generateConfigMarkdown';
|
package/types/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AAEtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA"}
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAC7E,cAAc,oBAAoB,CAAA;AAClC,cAAc,QAAQ,CAAA;AAEtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from 'esbuild';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
paths?: Record<string, string[]>;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
2
|
+
import { type TsConfigJsonResolved } from 'get-tsconfig';
|
|
3
|
+
type Tsconfig = Pick<TsConfigJsonResolved, 'compilerOptions'>;
|
|
4
|
+
export declare function createTsconfigPathsMatcher(tsconfig?: Tsconfig | string, cwd?: string): ((specifier: string) => string[]) | null;
|
|
8
5
|
export declare function TsconfigPathsPlugin(): Plugin;
|
|
9
|
-
export declare function loadCompilerOptionsFromTsconfig(tsconfig?: Tsconfig | string): import("typescript").CompilerOptions;
|
|
10
6
|
export {};
|
|
11
7
|
//# sourceMappingURL=esbuildTsconfigPaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuildTsconfigPaths.d.ts","sourceRoot":"","sources":["../../src/extractor/esbuildTsconfigPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"esbuildTsconfigPaths.d.ts","sourceRoot":"","sources":["../../src/extractor/esbuildTsconfigPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,EAIL,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAA;AAIrB,KAAK,QAAQ,GAAG,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAA;AAwB7D,wBAAgB,0BAA0B,CACxC,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,EAC5B,GAAG,SAAgB,GAClB,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC,GAAG,IAAI,CAG1C;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAwC5C"}
|