@tamagui/static 1.0.1-beta.196 → 1.0.1-beta.198
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/extractor/createExtractor.js +0 -1
- package/dist/extractor/createExtractor.js.map +2 -2
- package/dist/extractor/loadTamagui.js +5 -15
- package/dist/extractor/loadTamagui.js.map +2 -2
- package/dist/require.js +15 -26
- package/dist/require.js.map +2 -2
- package/package.json +21 -21
- package/src/extractor/createExtractor.ts +0 -2
- package/src/extractor/loadTamagui.ts +5 -17
- package/src/require.ts +18 -31
- package/types/extractor/loadTamagui.d.ts +0 -1
- package/types/require.d.ts +1 -1
- package/types/constants.d.ts.map +0 -1
- package/types/extractor/accessSafe.d.ts.map +0 -1
- package/types/extractor/babelParse.d.ts.map +0 -1
- package/types/extractor/buildClassName.d.ts.map +0 -1
- package/types/extractor/bundle.d.ts.map +0 -1
- package/types/extractor/createEvaluator.d.ts.map +0 -1
- package/types/extractor/createExtractor.d.ts.map +0 -1
- package/types/extractor/ensureImportingConcat.d.ts.map +0 -1
- package/types/extractor/evaluateAstNode.d.ts.map +0 -1
- package/types/extractor/extractHelpers.d.ts.map +0 -1
- package/types/extractor/extractMediaStyle.d.ts.map +0 -1
- package/types/extractor/extractToClassNames.d.ts.map +0 -1
- package/types/extractor/findTopmostFunction.d.ts.map +0 -1
- package/types/extractor/generatedUid.d.ts.map +0 -1
- package/types/extractor/getPrefixLogs.d.ts.map +0 -1
- package/types/extractor/getPropValueFromAttributes.d.ts.map +0 -1
- package/types/extractor/getSourceModule.d.ts.map +0 -1
- package/types/extractor/getStaticBindingsForScope.d.ts.map +0 -1
- package/types/extractor/hoistClassNames.d.ts.map +0 -1
- package/types/extractor/literalToAst.d.ts.map +0 -1
- package/types/extractor/loadFile.d.ts.map +0 -1
- package/types/extractor/loadTamagui.d.ts.map +0 -1
- package/types/extractor/logLines.d.ts.map +0 -1
- package/types/extractor/normalizeTernaries.d.ts.map +0 -1
- package/types/extractor/removeUnusedHooks.d.ts.map +0 -1
- package/types/extractor/timer.d.ts.map +0 -1
- package/types/extractor/validHTMLAttributes.d.ts.map +0 -1
- package/types/getPragmaOptions.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/require.d.ts.map +0 -1
- package/types/types.d.ts.map +0 -1
- package/types/webpackPlugin.d.ts.map +0 -1
|
@@ -104,7 +104,7 @@ Tamagui built config and components:`
|
|
|
104
104
|
})
|
|
105
105
|
]);
|
|
106
106
|
try {
|
|
107
|
-
(0, import_require.registerRequire)(
|
|
107
|
+
(0, import_require.registerRequire)();
|
|
108
108
|
const out = require(configOutPath);
|
|
109
109
|
const config = out.default || out;
|
|
110
110
|
if (!config) {
|
|
@@ -171,8 +171,9 @@ function loadTamaguiSync(props) {
|
|
|
171
171
|
}
|
|
172
172
|
const { unregister } = require("esbuild-register/dist/node").register(esbuildOptions);
|
|
173
173
|
try {
|
|
174
|
-
(0, import_require.registerRequire)(
|
|
174
|
+
(0, import_require.registerRequire)();
|
|
175
175
|
process.env.IS_STATIC = "is_static";
|
|
176
|
+
const devValueOG = globalThis["__DEV__"];
|
|
176
177
|
globalThis["__DEV__"] = process.env.NODE_ENV === "development";
|
|
177
178
|
try {
|
|
178
179
|
let tamaguiConfig = null;
|
|
@@ -195,7 +196,7 @@ function loadTamaguiSync(props) {
|
|
|
195
196
|
console.log(`components`, components);
|
|
196
197
|
}
|
|
197
198
|
process.env.IS_STATIC = void 0;
|
|
198
|
-
|
|
199
|
+
globalThis["__DEV__"] = devValueOG;
|
|
199
200
|
if (props.config && tamaguiConfig) {
|
|
200
201
|
(0, import_core_node.createTamagui)(tamaguiConfig);
|
|
201
202
|
}
|
|
@@ -205,9 +206,6 @@ function loadTamaguiSync(props) {
|
|
|
205
206
|
nameToPaths: (0, import_require.getNameToPaths)()
|
|
206
207
|
};
|
|
207
208
|
} catch (err) {
|
|
208
|
-
if (props.bubbleErrors) {
|
|
209
|
-
throw err;
|
|
210
|
-
}
|
|
211
209
|
if (err instanceof Error) {
|
|
212
210
|
console.warn(
|
|
213
211
|
`Error loading tamagui.config.ts (set DEBUG=tamagui to see full stack), running tamagui without custom config`
|
|
@@ -230,11 +228,6 @@ function loadTamaguiSync(props) {
|
|
|
230
228
|
};
|
|
231
229
|
}
|
|
232
230
|
return cache[key];
|
|
233
|
-
} catch (err) {
|
|
234
|
-
if (!props.bubbleErrors) {
|
|
235
|
-
console.log("Error loading Tamagui", err);
|
|
236
|
-
}
|
|
237
|
-
throw err;
|
|
238
231
|
} finally {
|
|
239
232
|
unregister();
|
|
240
233
|
(0, import_require.unregisterRequire)();
|
|
@@ -383,9 +376,6 @@ writeTmp: `,
|
|
|
383
376
|
cacheComponents[key] = info;
|
|
384
377
|
return info;
|
|
385
378
|
} catch (err) {
|
|
386
|
-
if (props.bubbleErrors) {
|
|
387
|
-
throw err;
|
|
388
|
-
}
|
|
389
379
|
console.log(`Tamagui error bundling components`, err.message, err.stack);
|
|
390
380
|
return null;
|
|
391
381
|
}
|
|
@@ -399,7 +389,7 @@ function getComponentStaticConfigByName(name, exported) {
|
|
|
399
389
|
for (const key in exported) {
|
|
400
390
|
const found = getTamaguiComponent(key, exported[key]);
|
|
401
391
|
if (found) {
|
|
402
|
-
const { Component,
|
|
392
|
+
const { Component, ...sc } = found.staticConfig;
|
|
403
393
|
components[key] = { staticConfig: sc };
|
|
404
394
|
}
|
|
405
395
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/extractor/loadTamagui.ts"],
|
|
4
|
-
"sourcesContent": ["import { readFileSync } from 'fs'\n/* eslint-disable no-console */\nimport { basename, dirname, extname, join, relative, sep } from 'path'\n\nimport generate from '@babel/generator'\nimport traverse from '@babel/traverse'\nimport * as t from '@babel/types'\nimport { Color, colorLog } from '@tamagui/cli-color'\nimport { getDefaultTamaguiConfig } from '@tamagui/config-default-node'\nimport type { StaticConfigParsed, TamaguiInternalConfig } from '@tamagui/core-node'\nimport { createTamagui } from '@tamagui/core-node'\nimport esbuild from 'esbuild'\nimport { ensureDir, existsSync, removeSync, writeFileSync } from 'fs-extra'\n\nimport { SHOULD_DEBUG } from '../constants.js'\nimport { getNameToPaths, registerRequire, unregisterRequire } from '../require.js'\nimport { babelParse } from './babelParse'\nimport { bundle } from './bundle'\n\ntype NameToPaths = {\n [key: string]: Set<string>\n}\n\nexport type LoadedComponents = {\n moduleName: string\n nameToInfo: Record<\n string,\n {\n staticConfig: StaticConfigParsed\n }\n >\n}\n\nexport type TamaguiProjectInfo = {\n components: LoadedComponents[]\n tamaguiConfig: TamaguiInternalConfig\n nameToPaths: NameToPaths\n}\n\ntype Props = {\n components: string[]\n config?: string\n forceExports?: boolean\n bubbleErrors?: boolean\n}\n\nconst cache = {}\n\n// TODO needs a plugin for webpack / vite to run this once at startup and not again until changed...\n\nexport async function loadTamagui(props: Props): Promise<TamaguiProjectInfo> {\n const key = JSON.stringify(props)\n if (cache[key]) {\n if (cache[key] instanceof Promise) {\n return await cache[key]\n }\n return cache[key]\n }\n\n let resolver: Function = () => {}\n cache[key] = new Promise((res) => {\n resolver = res\n })\n\n const tmpDir = join(process.cwd(), '.tamagui', 'tamagui-node')\n const configOutPath = join(tmpDir, `tamagui.config.js`)\n const baseComponents = props.components.filter((x) => x !== '@tamagui/core')\n const componentOutPaths = baseComponents.map((componentModule) =>\n join(\n tmpDir,\n `${componentModule\n .split(sep)\n .join('-')\n .replace(/[^a-z0-9]+/gi, '')}-components.config.js`\n )\n )\n\n const external = ['@tamagui/core', '@tamagui/core-node', 'react', 'react-dom', 'react-native-svg']\n const configEntry = props.config ? join(process.cwd(), props.config) : ''\n\n if (process.env.NODE_ENV === 'development' && process.env.DEBUG?.startsWith('tamagui')) {\n console.log(`Building config entry`, configEntry)\n }\n\n // build them to node-compat versions\n try {\n await ensureDir(tmpDir)\n } catch {\n //\n }\n\n colorLog(\n Color.FgYellow,\n `\nTamagui built config and components:`\n )\n colorLog(\n Color.Dim,\n `\n - Config: .${sep}${relative(process.cwd(), configOutPath)}\n - Components: .${sep}${relative(process.cwd(), componentOutPaths.join(', '))}\n`\n )\n\n await Promise.all([\n props.config\n ? bundle({\n entryPoints: [configEntry],\n external,\n outfile: configOutPath,\n })\n : null,\n ...baseComponents.map((componentModule, i) => {\n return bundle({\n entryPoints: [componentModule],\n resolvePlatformSpecificEntries: true,\n external,\n outfile: componentOutPaths[i],\n })\n }),\n ])\n\n try {\n registerRequire(props.bubbleErrors)\n const out = require(configOutPath)\n const config = out.default || out\n\n if (!config) {\n throw new Error(`No config: ${config}`)\n }\n\n let components = loadComponents({\n ...props,\n components: componentOutPaths,\n })\n\n if (!components) {\n throw new Error(`No components found: ${componentOutPaths.join(', ')}`)\n }\n\n // map from built back to original module names\n for (const component of components) {\n component.moduleName = baseComponents[componentOutPaths.indexOf(component.moduleName)]\n if (!component.moduleName) {\n throw new Error(`Tamagui internal err`)\n }\n }\n\n // always load core so we can optimize if directly importing\n const coreComponents = loadComponents({\n ...props,\n components: ['@tamagui/core-node'],\n })\n if (coreComponents) {\n coreComponents[0].moduleName = '@tamagui/core'\n components = [...components, ...coreComponents]\n }\n\n if (process.env.NODE_ENV === 'development' && process.env.DEBUG?.startsWith('tamagui')) {\n console.log('Loaded components', components)\n }\n\n cache[key] = {\n components,\n nameToPaths: {},\n tamaguiConfig: config,\n }\n\n // init core-node\n createTamagui(cache[key].tamaguiConfig)\n\n resolver(cache[key])\n\n return cache[key]\n } finally {\n unregisterRequire()\n }\n}\n\nexport function resolveWebOrNativeSpecificEntry(entry: string) {\n const resolved = require.resolve(entry)\n const ext = extname(resolved)\n const fileName = basename(resolved).replace(ext, '')\n const specificExt = process.env.TAMAGUI_TARGET === 'web' ? 'web' : 'native'\n const specificFile = join(dirname(resolved), fileName + '.' + specificExt + ext)\n if (existsSync(specificFile)) {\n return specificFile\n }\n return entry\n}\n\nconst esbuildOptions = {\n loader: 'tsx',\n target: 'es2018',\n format: 'cjs',\n jsx: 'transform',\n platform: 'node',\n} as const\n\n// loads in-process using esbuild-register\nexport function loadTamaguiSync(props: Props): TamaguiProjectInfo {\n const key = JSON.stringify(props)\n if (cache[key]) {\n return cache[key]\n }\n\n const { unregister } = require('esbuild-register/dist/node').register(esbuildOptions)\n\n try {\n registerRequire(props.bubbleErrors)\n\n // lets shim require and avoid importing react-native + react-native-web\n // we just need to read the config around them\n process.env.IS_STATIC = 'is_static'\n globalThis['__DEV__' as any] = process.env.NODE_ENV === 'development'\n\n try {\n // config\n let tamaguiConfig: TamaguiInternalConfig | null = null\n if (props.config) {\n const configPath = join(process.cwd(), props.config)\n const exp = require(configPath)\n tamaguiConfig = (exp['default'] || exp) as TamaguiInternalConfig\n if (!tamaguiConfig || !tamaguiConfig.parsed) {\n const confPath = require.resolve(configPath)\n throw new Error(`Can't find valid config in ${confPath}:\n \n Be sure you \"export default\" the config.`)\n }\n }\n\n // components\n const components = loadComponents(props)\n if (!components) {\n throw new Error(`No components loaded`)\n }\n if (process.env.DEBUG === 'tamagui') {\n console.log(`components`, components)\n }\n\n // undo shims\n process.env.IS_STATIC = undefined\n delete globalThis['__DEV__' as any]\n\n // set up core-node\n if (props.config && tamaguiConfig) {\n createTamagui(tamaguiConfig as any)\n }\n\n cache[key] = {\n components,\n tamaguiConfig,\n nameToPaths: getNameToPaths(),\n }\n } catch (err) {\n if (props.bubbleErrors) {\n throw err\n }\n\n if (err instanceof Error) {\n console.warn(\n `Error loading tamagui.config.ts (set DEBUG=tamagui to see full stack), running tamagui without custom config`\n )\n console.log(`\\n\\n ${err.message}\\n\\n`)\n if (SHOULD_DEBUG) {\n console.log(err.stack)\n }\n } else {\n console.error(`Error loading tamagui.config.ts`, err)\n }\n return {\n components: [],\n tamaguiConfig: getDefaultTamaguiConfig(),\n nameToPaths: {},\n }\n }\n\n return cache[key]\n } catch (err) {\n if (!props.bubbleErrors) {\n console.log('Error loading Tamagui', err)\n }\n throw err\n } finally {\n unregister()\n unregisterRequire()\n }\n}\n\nfunction interopDefaultExport(mod: any) {\n return mod?.default ?? mod\n}\n\nconst cacheComponents: Record<string, LoadedComponents[]> = {}\n\nfunction transformAddExports(ast: t.File) {\n const usedNames = new Set<string>()\n\n // avoid clobbering\n traverse(ast, {\n ExportNamedDeclaration(nodePath) {\n if (nodePath.node.specifiers) {\n for (const spec of nodePath.node.specifiers) {\n usedNames.add(t.isIdentifier(spec.exported) ? spec.exported.name : spec.exported.value)\n }\n }\n },\n })\n\n traverse(ast, {\n VariableDeclaration(nodePath) {\n // top level only\n if (!t.isProgram(nodePath.parent)) return\n const decs = nodePath.node.declarations\n if (decs.length > 1) return\n const [dec] = decs\n if (!t.isIdentifier(dec.id)) return\n if (!dec.init) return\n if (usedNames.has(dec.id.name)) return\n usedNames.add(dec.id.name)\n nodePath.replaceWith(\n t.exportNamedDeclaration(t.variableDeclaration('let', [dec]), [\n t.exportSpecifier(t.identifier(dec.id.name), t.identifier(dec.id.name)),\n ])\n )\n },\n })\n\n return generate(ast as any, {\n concise: false,\n filename: 'test.tsx',\n retainLines: false,\n sourceMaps: false,\n }).code\n}\n\nfunction loadComponents(props: Props): null | LoadedComponents[] {\n const componentsModules = props.components\n const key = componentsModules.join('')\n if (cacheComponents[key]) {\n return cacheComponents[key]\n }\n try {\n const info: LoadedComponents[] = componentsModules.flatMap((name) => {\n const extension = extname(name)\n const isLocal = Boolean(extension)\n // during props.config pass we are passing in pre-bundled stuff\n const writeTmp = isLocal && !props.config\n const fileContents = writeTmp ? readFileSync(name, 'utf-8') : ''\n const loadModule = writeTmp\n ? join(dirname(name), `.tamagui-dynamic-eval-${basename(name)}.tsx`)\n : name\n let writtenContents = fileContents\n let didBabel = false\n\n const esbuildit = (src: string, target?: 'modern') =>\n esbuild.transformSync(src, {\n ...esbuildOptions,\n ...(target === 'modern' && {\n target: 'es2022',\n jsx: 'transform',\n loader: 'tsx',\n platform: 'neutral',\n format: 'esm',\n }),\n }).code\n\n function attemptLoad({ forceExports = false } = {}) {\n // need to write to tsx to enable reading it properly (:/ esbuild-register)\n if (writeTmp) {\n writtenContents = forceExports\n ? esbuildit(transformAddExports(babelParse(esbuildit(fileContents, 'modern'))))\n : esbuildit(fileContents)\n\n writeFileSync(loadModule, writtenContents)\n }\n return {\n moduleName: name,\n nameToInfo: getComponentStaticConfigByName(\n name,\n interopDefaultExport(require(loadModule))\n ),\n }\n }\n\n const dispose = () => {\n writeTmp && removeSync(loadModule)\n }\n\n try {\n const res = attemptLoad({\n forceExports: true,\n })\n didBabel = true\n return res\n } catch (err) {\n console.log('babel err', err, writtenContents)\n // ok\n writtenContents = fileContents\n if (process.env.DEBUG?.startsWith('tamagui')) {\n console.log(`Error parsing babel likely`, err)\n }\n } finally {\n dispose()\n }\n\n try {\n return attemptLoad({\n forceExports: false,\n })\n } catch (err) {\n if (!process.env.TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD) {\n console.log(`\n\nTamagui attempted but failed to dynamically load components in:\n ${name}\n\nThis will leave some styled() tags unoptimized.\nDisable this file (or dynamic loading altogether):\n\n disableExtractFoundComponents: ['${name}'] | true\n\nQuiet this warning with environment variable:\n \n TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD=1\n\n`)\n console.log(err)\n console.log(\n `At: ${loadModule}`,\n `\\ndidBabel: ${didBabel}`,\n `\\nIn:`,\n writtenContents,\n `\\nwriteTmp: `,\n writeTmp\n )\n }\n return []\n } finally {\n dispose()\n }\n })\n cacheComponents[key] = info\n return info\n } catch (err: any) {\n if (props.bubbleErrors) {\n throw err\n }\n console.log(`Tamagui error bundling components`, err.message, err.stack)\n return null\n }\n}\n\nfunction getComponentStaticConfigByName(name: string, exported: any) {\n if (!exported || typeof exported !== 'object' || Array.isArray(exported)) {\n throw new Error(`Invalid export from package ${name}: ${typeof exported}`)\n }\n const components: Record<string, { staticConfig: StaticConfigParsed }> = {}\n try {\n for (const key in exported) {\n const found = getTamaguiComponent(key, exported[key])\n if (found) {\n // remove non-stringifyable\n const { Component, reactNativeWebComponent, ...sc } = found.staticConfig\n components[key] = { staticConfig: sc }\n }\n }\n } catch (err) {\n console.error(`Tamagui failed getting components`)\n if (err instanceof Error) {\n console.error(err.message, err.stack)\n } else {\n console.error(err)\n }\n }\n return components\n}\n\nfunction getTamaguiComponent(\n name: string,\n Component: any\n): undefined | { staticConfig: StaticConfigParsed } {\n if (name[0].toUpperCase() !== name[0]) {\n return\n }\n const staticConfig = Component?.staticConfig as StaticConfigParsed | undefined\n if (staticConfig) {\n return Component\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA6B;AAE7B,kBAAgE;AAEhE,uBAAqB;AACrB,sBAAqB;AACrB,QAAmB;AACnB,uBAAgC;AAChC,iCAAwC;AAExC,uBAA8B;AAC9B,qBAAoB;AACpB,sBAAiE;AAEjE,uBAA6B;AAC7B,qBAAmE;AACnE,wBAA2B;AAC3B,oBAAuB;
|
|
4
|
+
"sourcesContent": ["import { readFileSync } from 'fs'\n/* eslint-disable no-console */\nimport { basename, dirname, extname, join, relative, sep } from 'path'\n\nimport generate from '@babel/generator'\nimport traverse from '@babel/traverse'\nimport * as t from '@babel/types'\nimport { Color, colorLog } from '@tamagui/cli-color'\nimport { getDefaultTamaguiConfig } from '@tamagui/config-default-node'\nimport type { StaticConfigParsed, TamaguiInternalConfig } from '@tamagui/core-node'\nimport { createTamagui } from '@tamagui/core-node'\nimport esbuild from 'esbuild'\nimport { ensureDir, existsSync, removeSync, writeFileSync } from 'fs-extra'\n\nimport { SHOULD_DEBUG } from '../constants.js'\nimport { getNameToPaths, registerRequire, unregisterRequire } from '../require.js'\nimport { babelParse } from './babelParse'\nimport { bundle } from './bundle'\n\ntype NameToPaths = {\n [key: string]: Set<string>\n}\n\nexport type LoadedComponents = {\n moduleName: string\n nameToInfo: Record<\n string,\n {\n staticConfig: StaticConfigParsed\n }\n >\n}\n\nexport type TamaguiProjectInfo = {\n components: LoadedComponents[]\n tamaguiConfig: TamaguiInternalConfig\n nameToPaths: NameToPaths\n}\n\ntype Props = {\n components: string[]\n config?: string\n forceExports?: boolean\n}\n\nconst cache = {}\n\n// TODO needs a plugin for webpack / vite to run this once at startup and not again until changed...\n\nexport async function loadTamagui(props: Props): Promise<TamaguiProjectInfo> {\n const key = JSON.stringify(props)\n if (cache[key]) {\n if (cache[key] instanceof Promise) {\n return await cache[key]\n }\n return cache[key]\n }\n\n let resolver: Function = () => {}\n cache[key] = new Promise((res) => {\n resolver = res\n })\n\n const tmpDir = join(process.cwd(), '.tamagui', 'tamagui-node')\n const configOutPath = join(tmpDir, `tamagui.config.js`)\n const baseComponents = props.components.filter((x) => x !== '@tamagui/core')\n const componentOutPaths = baseComponents.map((componentModule) =>\n join(\n tmpDir,\n `${componentModule\n .split(sep)\n .join('-')\n .replace(/[^a-z0-9]+/gi, '')}-components.config.js`\n )\n )\n\n const external = ['@tamagui/core', '@tamagui/core-node', 'react', 'react-dom', 'react-native-svg']\n const configEntry = props.config ? join(process.cwd(), props.config) : ''\n\n if (process.env.NODE_ENV === 'development' && process.env.DEBUG?.startsWith('tamagui')) {\n console.log(`Building config entry`, configEntry)\n }\n\n // build them to node-compat versions\n try {\n await ensureDir(tmpDir)\n } catch {\n //\n }\n\n colorLog(\n Color.FgYellow,\n `\nTamagui built config and components:`\n )\n colorLog(\n Color.Dim,\n `\n - Config: .${sep}${relative(process.cwd(), configOutPath)}\n - Components: .${sep}${relative(process.cwd(), componentOutPaths.join(', '))}\n`\n )\n\n await Promise.all([\n props.config\n ? bundle({\n entryPoints: [configEntry],\n external,\n outfile: configOutPath,\n })\n : null,\n ...baseComponents.map((componentModule, i) => {\n return bundle({\n entryPoints: [componentModule],\n resolvePlatformSpecificEntries: true,\n external,\n outfile: componentOutPaths[i],\n })\n }),\n ])\n\n try {\n registerRequire()\n const out = require(configOutPath)\n const config = out.default || out\n\n if (!config) {\n throw new Error(`No config: ${config}`)\n }\n\n let components = loadComponents({\n ...props,\n components: componentOutPaths,\n })\n\n if (!components) {\n throw new Error(`No components found: ${componentOutPaths.join(', ')}`)\n }\n\n // map from built back to original module names\n for (const component of components) {\n component.moduleName = baseComponents[componentOutPaths.indexOf(component.moduleName)]\n if (!component.moduleName) {\n throw new Error(`Tamagui internal err`)\n }\n }\n\n // always load core so we can optimize if directly importing\n const coreComponents = loadComponents({\n ...props,\n components: ['@tamagui/core-node'],\n })\n if (coreComponents) {\n coreComponents[0].moduleName = '@tamagui/core'\n components = [...components, ...coreComponents]\n }\n\n if (process.env.NODE_ENV === 'development' && process.env.DEBUG?.startsWith('tamagui')) {\n console.log('Loaded components', components)\n }\n\n cache[key] = {\n components,\n nameToPaths: {},\n tamaguiConfig: config,\n }\n\n // init core-node\n createTamagui(cache[key].tamaguiConfig)\n\n resolver(cache[key])\n\n return cache[key]\n } finally {\n unregisterRequire()\n }\n}\n\nexport function resolveWebOrNativeSpecificEntry(entry: string) {\n const resolved = require.resolve(entry)\n const ext = extname(resolved)\n const fileName = basename(resolved).replace(ext, '')\n const specificExt = process.env.TAMAGUI_TARGET === 'web' ? 'web' : 'native'\n const specificFile = join(dirname(resolved), fileName + '.' + specificExt + ext)\n if (existsSync(specificFile)) {\n return specificFile\n }\n return entry\n}\n\nconst esbuildOptions = {\n loader: 'tsx',\n target: 'es2018',\n format: 'cjs',\n jsx: 'transform',\n platform: 'node',\n} as const\n\n// loads in-process using esbuild-register\nexport function loadTamaguiSync(props: Props): TamaguiProjectInfo {\n const key = JSON.stringify(props)\n if (cache[key]) {\n return cache[key]\n }\n\n const { unregister } = require('esbuild-register/dist/node').register(esbuildOptions)\n\n try {\n registerRequire()\n\n // lets shim require and avoid importing react-native + react-native-web\n // we just need to read the config around them\n process.env.IS_STATIC = 'is_static'\n const devValueOG = globalThis['__DEV__' as any]\n globalThis['__DEV__' as any] = process.env.NODE_ENV === 'development'\n\n try {\n // config\n let tamaguiConfig: TamaguiInternalConfig | null = null\n if (props.config) {\n const configPath = join(process.cwd(), props.config)\n const exp = require(configPath)\n tamaguiConfig = (exp['default'] || exp) as TamaguiInternalConfig\n if (!tamaguiConfig || !tamaguiConfig.parsed) {\n const confPath = require.resolve(configPath)\n throw new Error(`Can't find valid config in ${confPath}:\n \n Be sure you \"export default\" the config.`)\n }\n }\n\n // components\n const components = loadComponents(props)\n if (!components) {\n throw new Error(`No components loaded`)\n }\n if (process.env.DEBUG === 'tamagui') {\n console.log(`components`, components)\n }\n\n // undo shims\n process.env.IS_STATIC = undefined\n globalThis['__DEV__' as any] = devValueOG\n\n // set up core-node\n if (props.config && tamaguiConfig) {\n createTamagui(tamaguiConfig as any)\n }\n\n cache[key] = {\n components,\n tamaguiConfig,\n nameToPaths: getNameToPaths(),\n }\n } catch (err) {\n if (err instanceof Error) {\n console.warn(\n `Error loading tamagui.config.ts (set DEBUG=tamagui to see full stack), running tamagui without custom config`\n )\n console.log(`\\n\\n ${err.message}\\n\\n`)\n if (SHOULD_DEBUG) {\n console.log(err.stack)\n }\n } else {\n console.error(`Error loading tamagui.config.ts`, err)\n }\n return {\n components: [],\n tamaguiConfig: getDefaultTamaguiConfig(),\n nameToPaths: {},\n }\n }\n\n return cache[key]\n } finally {\n unregister()\n unregisterRequire()\n }\n}\n\nfunction interopDefaultExport(mod: any) {\n return mod?.default ?? mod\n}\n\nconst cacheComponents: Record<string, LoadedComponents[]> = {}\n\nfunction transformAddExports(ast: t.File) {\n const usedNames = new Set<string>()\n\n // avoid clobbering\n traverse(ast, {\n ExportNamedDeclaration(nodePath) {\n if (nodePath.node.specifiers) {\n for (const spec of nodePath.node.specifiers) {\n usedNames.add(t.isIdentifier(spec.exported) ? spec.exported.name : spec.exported.value)\n }\n }\n },\n })\n\n traverse(ast, {\n VariableDeclaration(nodePath) {\n // top level only\n if (!t.isProgram(nodePath.parent)) return\n const decs = nodePath.node.declarations\n if (decs.length > 1) return\n const [dec] = decs\n if (!t.isIdentifier(dec.id)) return\n if (!dec.init) return\n if (usedNames.has(dec.id.name)) return\n usedNames.add(dec.id.name)\n nodePath.replaceWith(\n t.exportNamedDeclaration(t.variableDeclaration('let', [dec]), [\n t.exportSpecifier(t.identifier(dec.id.name), t.identifier(dec.id.name)),\n ])\n )\n },\n })\n\n return generate(ast as any, {\n concise: false,\n filename: 'test.tsx',\n retainLines: false,\n sourceMaps: false,\n }).code\n}\n\nfunction loadComponents(props: Props): null | LoadedComponents[] {\n const componentsModules = props.components\n const key = componentsModules.join('')\n if (cacheComponents[key]) {\n return cacheComponents[key]\n }\n try {\n const info: LoadedComponents[] = componentsModules.flatMap((name) => {\n const extension = extname(name)\n const isLocal = Boolean(extension)\n // during props.config pass we are passing in pre-bundled stuff\n const writeTmp = isLocal && !props.config\n const fileContents = writeTmp ? readFileSync(name, 'utf-8') : ''\n const loadModule = writeTmp\n ? join(dirname(name), `.tamagui-dynamic-eval-${basename(name)}.tsx`)\n : name\n let writtenContents = fileContents\n let didBabel = false\n\n const esbuildit = (src: string, target?: 'modern') =>\n esbuild.transformSync(src, {\n ...esbuildOptions,\n ...(target === 'modern' && {\n target: 'es2022',\n jsx: 'transform',\n loader: 'tsx',\n platform: 'neutral',\n format: 'esm',\n }),\n }).code\n\n function attemptLoad({ forceExports = false } = {}) {\n // need to write to tsx to enable reading it properly (:/ esbuild-register)\n if (writeTmp) {\n writtenContents = forceExports\n ? esbuildit(transformAddExports(babelParse(esbuildit(fileContents, 'modern'))))\n : esbuildit(fileContents)\n\n writeFileSync(loadModule, writtenContents)\n }\n return {\n moduleName: name,\n nameToInfo: getComponentStaticConfigByName(\n name,\n interopDefaultExport(require(loadModule))\n ),\n }\n }\n\n const dispose = () => {\n writeTmp && removeSync(loadModule)\n }\n\n try {\n const res = attemptLoad({\n forceExports: true,\n })\n didBabel = true\n return res\n } catch (err) {\n console.log('babel err', err, writtenContents)\n // ok\n writtenContents = fileContents\n if (process.env.DEBUG?.startsWith('tamagui')) {\n console.log(`Error parsing babel likely`, err)\n }\n } finally {\n dispose()\n }\n\n try {\n return attemptLoad({\n forceExports: false,\n })\n } catch (err) {\n if (!process.env.TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD) {\n console.log(`\n\nTamagui attempted but failed to dynamically load components in:\n ${name}\n\nThis will leave some styled() tags unoptimized.\nDisable this file (or dynamic loading altogether):\n\n disableExtractFoundComponents: ['${name}'] | true\n\nQuiet this warning with environment variable:\n \n TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD=1\n\n`)\n console.log(err)\n console.log(\n `At: ${loadModule}`,\n `\\ndidBabel: ${didBabel}`,\n `\\nIn:`,\n writtenContents,\n `\\nwriteTmp: `,\n writeTmp\n )\n }\n return []\n } finally {\n dispose()\n }\n })\n cacheComponents[key] = info\n return info\n } catch (err: any) {\n console.log(`Tamagui error bundling components`, err.message, err.stack)\n return null\n }\n}\n\nfunction getComponentStaticConfigByName(name: string, exported: any) {\n if (!exported || typeof exported !== 'object' || Array.isArray(exported)) {\n throw new Error(`Invalid export from package ${name}: ${typeof exported}`)\n }\n const components: Record<string, { staticConfig: StaticConfigParsed }> = {}\n try {\n for (const key in exported) {\n const found = getTamaguiComponent(key, exported[key])\n if (found) {\n // remove non-stringifyable\n const { Component, ...sc } = found.staticConfig\n components[key] = { staticConfig: sc }\n }\n }\n } catch (err) {\n console.error(`Tamagui failed getting components`)\n if (err instanceof Error) {\n console.error(err.message, err.stack)\n } else {\n console.error(err)\n }\n }\n return components\n}\n\nfunction getTamaguiComponent(\n name: string,\n Component: any\n): undefined | { staticConfig: StaticConfigParsed } {\n if (name[0].toUpperCase() !== name[0]) {\n return\n }\n const staticConfig = Component?.staticConfig as StaticConfigParsed | undefined\n if (staticConfig) {\n return Component\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA6B;AAE7B,kBAAgE;AAEhE,uBAAqB;AACrB,sBAAqB;AACrB,QAAmB;AACnB,uBAAgC;AAChC,iCAAwC;AAExC,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,7 @@ const Module = require("module");
|
|
|
30
30
|
const og = Module.prototype.require;
|
|
31
31
|
globalThis["ogRequire"] = og;
|
|
32
32
|
const getNameToPaths = () => nameToPaths;
|
|
33
|
-
|
|
34
|
-
setInterval(() => {
|
|
35
|
-
tries = 0;
|
|
36
|
-
}, 50);
|
|
37
|
-
function registerRequire(bubbleErrors) {
|
|
33
|
+
function registerRequire() {
|
|
38
34
|
if (Module.prototype.require !== globalThis["ogRequire"]) {
|
|
39
35
|
console.warn("didnt unregister before re-registering");
|
|
40
36
|
process.exit(1);
|
|
@@ -43,6 +39,7 @@ function registerRequire(bubbleErrors) {
|
|
|
43
39
|
const rnw = require("react-native-web");
|
|
44
40
|
const core = require("@tamagui/core-node");
|
|
45
41
|
Module.prototype.require = function(path) {
|
|
42
|
+
var _a;
|
|
46
43
|
if (import_constants.SHOULD_DEBUG) {
|
|
47
44
|
console.log("tamagui:require", path);
|
|
48
45
|
}
|
|
@@ -62,29 +59,21 @@ function registerRequire(bubbleErrors) {
|
|
|
62
59
|
const out = og.apply(this, arguments);
|
|
63
60
|
return out;
|
|
64
61
|
} catch (err) {
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
`
|
|
79
|
-
);
|
|
80
|
-
const max = process.env.TAMAGUI_MAX_ERRORS ? +process.env.TAMAGUI_MAX_ERRORS : 50;
|
|
81
|
-
if (++tries > max) {
|
|
82
|
-
console.log(
|
|
83
|
-
`Too many errors loading design system, exiting (set TAMAGUI_MAX_ERRORS to override)..`
|
|
62
|
+
if ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui")) {
|
|
63
|
+
console.error(
|
|
64
|
+
`Tamagui failed loading the pre-built tamagui.config.ts
|
|
65
|
+
|
|
66
|
+
${err.message}
|
|
67
|
+
${err.stack}
|
|
68
|
+
|
|
69
|
+
You can see if it loads in the node repl:
|
|
70
|
+
|
|
71
|
+
require("./${(0, import_path.relative)(process.cwd(), path)}").default
|
|
72
|
+
|
|
73
|
+
`
|
|
84
74
|
);
|
|
85
|
-
process.exit(1);
|
|
86
75
|
}
|
|
87
|
-
return
|
|
76
|
+
return proxyWorm;
|
|
88
77
|
}
|
|
89
78
|
};
|
|
90
79
|
return Module.prototype.require;
|
package/dist/require.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/require.ts"],
|
|
4
|
-
"sourcesContent": ["import { relative, sep } from 'path'\n\nimport { SHOULD_DEBUG } from './constants.js'\n\nconst nameToPaths = {}\nconst Module = require('module')\nconst og = Module.prototype.require\nglobalThis['ogRequire'] = og\n\nexport const getNameToPaths = () => nameToPaths\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA8B;AAE9B,uBAA6B;AAE7B,MAAM,cAAc,CAAC;AACrB,MAAM,SAAS,QAAQ,QAAQ;AAC/B,MAAM,KAAK,OAAO,UAAU;AAC5B,WAAW,eAAe;AAEnB,MAAM,iBAAiB,MAAM;
|
|
4
|
+
"sourcesContent": ["import { relative, sep } from 'path'\n\nimport { SHOULD_DEBUG } from './constants.js'\n\nconst nameToPaths = {}\nconst Module = require('module')\nconst og = Module.prototype.require\nglobalThis['ogRequire'] = og\n\nexport const getNameToPaths = () => nameToPaths\n\nexport function registerRequire() {\n if (Module.prototype.require !== globalThis['ogRequire']) {\n // eslint-disable-next-line no-console\n console.warn('didnt unregister before re-registering')\n process.exit(1)\n }\n\n const proxyWorm = require('@tamagui/proxy-worm')\n // TODO can swap with react-native-web-lite\n const rnw = require('react-native-web')\n const core = require('@tamagui/core-node')\n\n Module.prototype.require = function (path: string) {\n if (SHOULD_DEBUG) {\n // eslint-disable-next-line no-console\n console.log('tamagui:require', path)\n }\n if (/\\.(gif|jpe?g|png|svg|ttf|otf|woff2?|bmp|webp)$/.test(path)) {\n return {}\n }\n if (\n path === '@gorhom/bottom-sheet' ||\n path.startsWith('react-native-reanimated') ||\n path === 'expo-linear-gradient' ||\n path === '@expo/vector-icons'\n ) {\n return proxyWorm\n }\n if (\n path.startsWith('react-native') &&\n // allow our rnw.tsx imports through\n !path.startsWith('react-native-web/dist/cjs/exports'.replace(/\\//g, sep))\n ) {\n return rnw\n }\n if (path === '@tamagui/core') {\n return core\n }\n try {\n const out = og.apply(this, arguments)\n // only for studio disable for now\n // if (!nameToPaths[path]) {\n // if (out && typeof out === 'object') {\n // for (const key in out) {\n // try {\n // const conf = out[key]?.staticConfig as StaticConfig\n // if (conf) {\n // if (conf.componentName) {\n // nameToPaths[conf.componentName] ??= new Set()\n // const fullName = path.startsWith('.')\n // ? join(`${this.path.replace(/dist(\\/cjs)?/, 'src')}`, path)\n // : path\n // nameToPaths[conf.componentName].add(fullName)\n // } else {\n // // console.log('no name component', path)\n // }\n // }\n // } catch {\n // // ok\n // }\n // }\n // }\n // }\n return out\n } catch (err: any) {\n /**\n * Allow errors to happen, we're just reading config and components but sometimes external modules cause problems\n * We can't fix every problem, so just swap them out with proxyWorm which is a sort of generic object that can be read.\n */\n\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.error(\n `Tamagui failed loading the pre-built tamagui.config.ts\n \n ${err.message}\n ${err.stack}\n \n You can see if it loads in the node repl:\n \n require(\"./${relative(process.cwd(), path)}\").default\n \n `\n )\n }\n\n return proxyWorm\n }\n }\n\n return Module.prototype.require\n}\n\nexport function unregisterRequire() {\n Module.prototype.require = og\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA8B;AAE9B,uBAA6B;AAE7B,MAAM,cAAc,CAAC;AACrB,MAAM,SAAS,QAAQ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GED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.198",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist",
|
|
@@ -28,23 +28,23 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@babel/core": "^7.
|
|
32
|
-
"@babel/generator": "^7.
|
|
33
|
-
"@babel/helper-plugin-utils": "^7.
|
|
34
|
-
"@babel/parser": "^7.
|
|
35
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
|
36
|
-
"@babel/runtime": "^7.
|
|
37
|
-
"@babel/traverse": "^7.
|
|
31
|
+
"@babel/core": "^7.19.6",
|
|
32
|
+
"@babel/generator": "^7.19.6",
|
|
33
|
+
"@babel/helper-plugin-utils": "^7.19.0",
|
|
34
|
+
"@babel/parser": "^7.19.6",
|
|
35
|
+
"@babel/plugin-transform-react-jsx": "^7.19.0",
|
|
36
|
+
"@babel/runtime": "^7.19.4",
|
|
37
|
+
"@babel/traverse": "^7.19.6",
|
|
38
38
|
"@expo/match-media": "^0.3.0",
|
|
39
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
40
|
-
"@tamagui/cli-color": "^1.0.1-beta.
|
|
41
|
-
"@tamagui/config-default-node": "^1.0.1-beta.
|
|
42
|
-
"@tamagui/core-node": "^1.0.1-beta.
|
|
43
|
-
"@tamagui/fake-react-native": "^1.0.1-beta.
|
|
44
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
45
|
-
"@tamagui/helpers-node": "^1.0.1-beta.
|
|
46
|
-
"@tamagui/proxy-worm": "^1.0.1-beta.
|
|
47
|
-
"@tamagui/shorthands": "^1.0.1-beta.
|
|
39
|
+
"@tamagui/build": "^1.0.1-beta.198",
|
|
40
|
+
"@tamagui/cli-color": "^1.0.1-beta.198",
|
|
41
|
+
"@tamagui/config-default-node": "^1.0.1-beta.198",
|
|
42
|
+
"@tamagui/core-node": "^1.0.1-beta.198",
|
|
43
|
+
"@tamagui/fake-react-native": "^1.0.1-beta.198",
|
|
44
|
+
"@tamagui/helpers": "^1.0.1-beta.198",
|
|
45
|
+
"@tamagui/helpers-node": "^1.0.1-beta.198",
|
|
46
|
+
"@tamagui/proxy-worm": "^1.0.1-beta.198",
|
|
47
|
+
"@tamagui/shorthands": "^1.0.1-beta.198",
|
|
48
48
|
"babel-literal-to-ast": "^2.1.0",
|
|
49
49
|
"esbuild": "^0.15.11",
|
|
50
50
|
"esbuild-register": "^3.3.3",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"fs-extra": "^10.1.0",
|
|
54
54
|
"invariant": "^2.2.4",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
|
-
"react-native-web-internals": "^1.0.1-beta.
|
|
57
|
-
"react-native-web-lite": "^1.0.1-beta.
|
|
56
|
+
"react-native-web-internals": "^1.0.1-beta.198",
|
|
57
|
+
"react-native-web-lite": "^1.0.1-beta.198"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@babel/plugin-syntax-typescript": "^7.18.6",
|
|
61
61
|
"@babel/types": "^7.19.4",
|
|
62
62
|
"@dish/babel-preset": "^0.0.6",
|
|
63
|
-
"@tamagui/test-design-system": "^1.0.1-beta.
|
|
63
|
+
"@tamagui/test-design-system": "^1.0.1-beta.198",
|
|
64
64
|
"@testing-library/react": "^13.3.0",
|
|
65
65
|
"@types/babel__generator": "^7.6.4",
|
|
66
66
|
"@types/babel__traverse": "^7.18.2",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"react-test-renderer": "^18.2.0",
|
|
80
80
|
"style-loader": "^3.3.1",
|
|
81
81
|
"typescript": "^4.7.4",
|
|
82
|
-
"vitest": "^0.
|
|
82
|
+
"vitest": "^0.24.3",
|
|
83
83
|
"webpack": "^5.74.0"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
@@ -418,9 +418,7 @@ export function createExtractor({ logger = console }: ExtractorOptions = { logge
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
const out = loadTamaguiSync({
|
|
421
|
-
// TODO would extract more, is NO-OP for now..
|
|
422
421
|
forceExports: true,
|
|
423
|
-
bubbleErrors: true,
|
|
424
422
|
components: [sourcePath],
|
|
425
423
|
})
|
|
426
424
|
|
|
@@ -41,7 +41,6 @@ type Props = {
|
|
|
41
41
|
components: string[]
|
|
42
42
|
config?: string
|
|
43
43
|
forceExports?: boolean
|
|
44
|
-
bubbleErrors?: boolean
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
const cache = {}
|
|
@@ -121,7 +120,7 @@ Tamagui built config and components:`
|
|
|
121
120
|
])
|
|
122
121
|
|
|
123
122
|
try {
|
|
124
|
-
registerRequire(
|
|
123
|
+
registerRequire()
|
|
125
124
|
const out = require(configOutPath)
|
|
126
125
|
const config = out.default || out
|
|
127
126
|
|
|
@@ -207,11 +206,12 @@ export function loadTamaguiSync(props: Props): TamaguiProjectInfo {
|
|
|
207
206
|
const { unregister } = require('esbuild-register/dist/node').register(esbuildOptions)
|
|
208
207
|
|
|
209
208
|
try {
|
|
210
|
-
registerRequire(
|
|
209
|
+
registerRequire()
|
|
211
210
|
|
|
212
211
|
// lets shim require and avoid importing react-native + react-native-web
|
|
213
212
|
// we just need to read the config around them
|
|
214
213
|
process.env.IS_STATIC = 'is_static'
|
|
214
|
+
const devValueOG = globalThis['__DEV__' as any]
|
|
215
215
|
globalThis['__DEV__' as any] = process.env.NODE_ENV === 'development'
|
|
216
216
|
|
|
217
217
|
try {
|
|
@@ -240,7 +240,7 @@ export function loadTamaguiSync(props: Props): TamaguiProjectInfo {
|
|
|
240
240
|
|
|
241
241
|
// undo shims
|
|
242
242
|
process.env.IS_STATIC = undefined
|
|
243
|
-
|
|
243
|
+
globalThis['__DEV__' as any] = devValueOG
|
|
244
244
|
|
|
245
245
|
// set up core-node
|
|
246
246
|
if (props.config && tamaguiConfig) {
|
|
@@ -253,10 +253,6 @@ export function loadTamaguiSync(props: Props): TamaguiProjectInfo {
|
|
|
253
253
|
nameToPaths: getNameToPaths(),
|
|
254
254
|
}
|
|
255
255
|
} catch (err) {
|
|
256
|
-
if (props.bubbleErrors) {
|
|
257
|
-
throw err
|
|
258
|
-
}
|
|
259
|
-
|
|
260
256
|
if (err instanceof Error) {
|
|
261
257
|
console.warn(
|
|
262
258
|
`Error loading tamagui.config.ts (set DEBUG=tamagui to see full stack), running tamagui without custom config`
|
|
@@ -276,11 +272,6 @@ export function loadTamaguiSync(props: Props): TamaguiProjectInfo {
|
|
|
276
272
|
}
|
|
277
273
|
|
|
278
274
|
return cache[key]
|
|
279
|
-
} catch (err) {
|
|
280
|
-
if (!props.bubbleErrors) {
|
|
281
|
-
console.log('Error loading Tamagui', err)
|
|
282
|
-
}
|
|
283
|
-
throw err
|
|
284
275
|
} finally {
|
|
285
276
|
unregister()
|
|
286
277
|
unregisterRequire()
|
|
@@ -443,9 +434,6 @@ Quiet this warning with environment variable:
|
|
|
443
434
|
cacheComponents[key] = info
|
|
444
435
|
return info
|
|
445
436
|
} catch (err: any) {
|
|
446
|
-
if (props.bubbleErrors) {
|
|
447
|
-
throw err
|
|
448
|
-
}
|
|
449
437
|
console.log(`Tamagui error bundling components`, err.message, err.stack)
|
|
450
438
|
return null
|
|
451
439
|
}
|
|
@@ -461,7 +449,7 @@ function getComponentStaticConfigByName(name: string, exported: any) {
|
|
|
461
449
|
const found = getTamaguiComponent(key, exported[key])
|
|
462
450
|
if (found) {
|
|
463
451
|
// remove non-stringifyable
|
|
464
|
-
const { Component,
|
|
452
|
+
const { Component, ...sc } = found.staticConfig
|
|
465
453
|
components[key] = { staticConfig: sc }
|
|
466
454
|
}
|
|
467
455
|
}
|
package/src/require.ts
CHANGED
|
@@ -9,13 +9,7 @@ globalThis['ogRequire'] = og
|
|
|
9
9
|
|
|
10
10
|
export const getNameToPaths = () => nameToPaths
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
let tries = 0
|
|
14
|
-
setInterval(() => {
|
|
15
|
-
tries = 0
|
|
16
|
-
}, 50)
|
|
17
|
-
|
|
18
|
-
export function registerRequire(bubbleErrors?: boolean) {
|
|
12
|
+
export function registerRequire() {
|
|
19
13
|
if (Module.prototype.require !== globalThis['ogRequire']) {
|
|
20
14
|
// eslint-disable-next-line no-console
|
|
21
15
|
console.warn('didnt unregister before re-registering')
|
|
@@ -80,35 +74,28 @@ export function registerRequire(bubbleErrors?: boolean) {
|
|
|
80
74
|
// }
|
|
81
75
|
return out
|
|
82
76
|
} catch (err: any) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// eslint-disable-next-line no-console
|
|
88
|
-
console.error(
|
|
89
|
-
`Tamagui failed loading the pre-built tamagui.config.ts
|
|
90
|
-
|
|
91
|
-
${err.message}
|
|
92
|
-
${err.stack}
|
|
77
|
+
/**
|
|
78
|
+
* Allow errors to happen, we're just reading config and components but sometimes external modules cause problems
|
|
79
|
+
* We can't fix every problem, so just swap them out with proxyWorm which is a sort of generic object that can be read.
|
|
80
|
+
*/
|
|
93
81
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
require("./${relative(process.cwd(), path)}").default
|
|
97
|
-
|
|
98
|
-
`
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
const max = process.env.TAMAGUI_MAX_ERRORS ? +process.env.TAMAGUI_MAX_ERRORS : 50
|
|
102
|
-
if (++tries > max) {
|
|
82
|
+
if (process.env.DEBUG?.startsWith('tamagui')) {
|
|
103
83
|
// eslint-disable-next-line no-console
|
|
104
|
-
console.
|
|
105
|
-
`
|
|
84
|
+
console.error(
|
|
85
|
+
`Tamagui failed loading the pre-built tamagui.config.ts
|
|
86
|
+
|
|
87
|
+
${err.message}
|
|
88
|
+
${err.stack}
|
|
89
|
+
|
|
90
|
+
You can see if it loads in the node repl:
|
|
91
|
+
|
|
92
|
+
require("./${relative(process.cwd(), path)}").default
|
|
93
|
+
|
|
94
|
+
`
|
|
106
95
|
)
|
|
107
|
-
// avoid infinite loops
|
|
108
|
-
process.exit(1)
|
|
109
96
|
}
|
|
110
97
|
|
|
111
|
-
return
|
|
98
|
+
return proxyWorm
|
|
112
99
|
}
|
|
113
100
|
}
|
|
114
101
|
|
|
@@ -17,7 +17,6 @@ declare type Props = {
|
|
|
17
17
|
components: string[];
|
|
18
18
|
config?: string;
|
|
19
19
|
forceExports?: boolean;
|
|
20
|
-
bubbleErrors?: boolean;
|
|
21
20
|
};
|
|
22
21
|
export declare function loadTamagui(props: Props): Promise<TamaguiProjectInfo>;
|
|
23
22
|
export declare function resolveWebOrNativeSpecificEntry(entry: string): string;
|
package/types/require.d.ts
CHANGED
package/types/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gBAAgB,CAAA;AAI1C,eAAO,MAAM,SAAS,MAAM,CAAA;AAG5B,eAAO,MAAM,QAAQ,KAAkD,CAAA;AAEvE,eAAO,MAAM,WAAW,eAA8B,CAAA;AAEtD,eAAO,MAAM,YAAY,qBAAwE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessSafe.d.ts","sourceRoot":"","sources":["../../src/extractor/accessSafe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAIjC,wBAAgB,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,iBAAiB,CAajF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"babelParse.d.ts","sourceRoot":"","sources":["../../src/extractor/babelParse.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,WAAW,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAiBjC,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,aAGtC,CAAA;AAIF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,CAExD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildClassName.d.ts","sourceRoot":"","sources":["../../src/extractor/buildClassName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAGjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,aAAK,OAAO,GAAG,CACb,OAAO,EAAE,eAAe,EAAE,EAC1B,MAAM,CAAC,EAAE,MAAM,KACZ,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,aAAa,GAAG,IAAI,CAAA;AAE1C,eAAO,MAAM,cAAc,EAAE,OAU5B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,OAsDjC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/extractor/bundle.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B;;GAEG;AAEH,aAAK,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,GAAG;IAChE,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,CAAA;AA6DD,wBAAsB,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,gCAG1E;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,uBAExE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createEvaluator.d.ts","sourceRoot":"","sources":["../../src/extractor/createEvaluator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAKjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAIxD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,0BAA0B,CAAA;IACjC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACrC,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC,OAkCY,MAAM,SAGlB;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,GAAG,OACtD,MAAM,SAOlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAGA,OAAiB,EAAE,QAAQ,EAAmB,MAAM,iBAAiB,CAAA;AACrE,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAejC,OAAO,KAAK,EAIV,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EAGf,MAAM,aAAa,CAAA;AAcpB,OAAO,EAAE,iBAAiB,EAA6B,MAAM,gCAAgC,CAAA;AAE7F,OAAO,EAEL,kBAAkB,EAGnB,MAAM,kBAAkB,CAAA;AAiCzB,oBAAY,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAE1D,aAAK,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAI9C,wBAAgB,eAAe,CAAC,EAAE,MAAgB,EAAE,GAAE,gBAAsC;;;;;yBAyB/D,cAAc;6BAPhB,cAAc;;;;;;;;;;;;;;mBAwBtB,UAAU,SAAS,mBAAmB;;;;;;;eAIpC,UAAU,SAAS,mBAAmB;;;;;;;EA89D1D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ensureImportingConcat.d.ts","sourceRoot":"","sources":["../../src/extractor/ensureImportingConcat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAIjC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QA0B9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluateAstNode.d.ts","sourceRoot":"","sources":["../../src/extractor/evaluateAstNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAEjC,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,GAAG,IAAI,EACnC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,GAAG,EAC9B,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,GACrC,GAAG,CAkHL"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractHelpers.d.ts","sourceRoot":"","sources":["../../src/extractor/extractHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAIjC,OAAO,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAA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AAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC,CAAA;AAED,wBAAsB,mBAAmB,CAAC,EACxC,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAwY9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findTopmostFunction.d.ts","sourceRoot":"","sources":["../../src/extractor/findTopmostFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAEjC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,wBAkBlE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generatedUid.d.ts","sourceRoot":"","sources":["../../src/extractor/generatedUid.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,cAAc,CAAC;IAC5B,SAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACpD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAiC5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPrefixLogs.d.ts","sourceRoot":"","sources":["../../src/extractor/getPrefixLogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,UAGrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPropValueFromAttributes.d.ts","sourceRoot":"","sources":["../../src/extractor/getPropValueFromAttributes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAIjC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,kBAAkB,CAAC,EAAE,GAC/C,CAAC,CAAC,UAAU,GAAG,IAAI,CAmErB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSourceModule.d.ts","sourceRoot":"","sources":["../../src/extractor/getSourceModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAEjC,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,CAAA;CACpC,GACA,YAAY,GAAG,IAAI,CAoFrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getStaticBindingsForScope.d.ts","sourceRoot":"","sources":["../../src/extractor/getStaticBindingsForScope.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAmCjC,wBAAgB,iBAAiB,SAOhC;AAiCD,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,EACtC,SAAS,sBAAe,EACxB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EAC3C,gBAAgB,EAAE,OAAO,GAAG,SAAS,GACpC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CA6I9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hoistClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/hoistClassNames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAEjC,wBAAgB,eAAe,CAC7B,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,EAC5B,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,CAAA;CAAE,EACzC,IAAI,EAAE,CAAC,CAAC,UAAU,OAsCnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"literalToAst.d.ts","sourceRoot":"","sources":["../../src/extractor/literalToAst.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAEjC,wBAAgB,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,CAAC,UAAU,CA6BvD;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,OA4BrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadFile.d.ts","sourceRoot":"","sources":["../../src/extractor/loadFile.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadTamagui.d.ts","sourceRoot":"","sources":["../../src/extractor/loadTamagui.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAUnF,aAAK,WAAW,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAC3B,CAAA;AAED,oBAAY,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAChB,MAAM,EACN;QACE,YAAY,EAAE,kBAAkB,CAAA;KACjC,CACF,CAAA;CACF,CAAA;AAED,oBAAY,kBAAkB,GAAG;IAC/B,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,aAAa,EAAE,qBAAqB,CAAA;IACpC,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,aAAK,KAAK,GAAG;IACX,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAMD,wBAAsB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA+H3E;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,UAU5D;AAWD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB,CAuFhE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logLines.d.ts","sourceRoot":"","sources":["../../src/extractor/logLines.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,QAAS,MAAM,iCAanC,CAAA"}
|