@tamagui/vite-plugin 1.13.3 → 1.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/extensions.js +1 -39
- package/dist/cjs/extensions.js.map +2 -2
- package/dist/cjs/extract.js +6 -185
- package/dist/cjs/extract.js.map +2 -2
- package/dist/cjs/index.js +1 -21
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/native.js +5 -228
- package/dist/cjs/native.js.map +2 -2
- package/dist/cjs/nativePrebuild.js +1 -133
- package/dist/cjs/nativePrebuild.js.map +2 -2
- package/dist/cjs/plugin.js +1 -125
- package/dist/cjs/plugin.js.map +2 -2
- package/dist/esm/extensions.js +1 -15
- package/dist/esm/extensions.js.map +2 -2
- package/dist/esm/extensions.mjs +1 -15
- package/dist/esm/extensions.mjs.map +2 -2
- package/dist/esm/extract.js +6 -151
- package/dist/esm/extract.js.map +2 -2
- package/dist/esm/extract.mjs +6 -151
- package/dist/esm/extract.mjs.map +2 -2
- package/dist/esm/index.js +1 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -4
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/native.js +5 -203
- package/dist/esm/native.js.map +2 -2
- package/dist/esm/native.mjs +5 -203
- package/dist/esm/native.mjs.map +2 -2
- package/dist/esm/nativePrebuild.js +1 -99
- package/dist/esm/nativePrebuild.js.map +2 -2
- package/dist/esm/nativePrebuild.mjs +1 -99
- package/dist/esm/nativePrebuild.mjs.map +2 -2
- package/dist/esm/plugin.js +1 -101
- package/dist/esm/plugin.js.map +2 -2
- package/dist/esm/plugin.mjs +1 -101
- package/dist/esm/plugin.mjs.map +2 -2
- package/package.json +6 -6
package/dist/cjs/native.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/native.ts"],
|
|
4
4
|
"sourcesContent": ["import { readFile } from 'fs/promises'\nimport { join } from 'path'\n\nimport { esbuildFlowPlugin } from '@bunchtogether/vite-plugin-flow'\nimport { OutputOptions } from 'rollup'\nimport type { Plugin } from 'vite'\n\nimport { extensions } from './extensions.js'\n\nexport function nativePlugin(): Plugin {\n return {\n name: 'tamagui-native',\n enforce: 'post',\n\n config: (config) => {\n if (!config.build) config.build = {}\n\n config.build.modulePreload = { polyfill: false }\n // Ensures that even very large assets are inlined in your JavaScript.\n config.build.assetsInlineLimit = 100000000\n // Avoid warnings about large chunks.\n config.build.chunkSizeWarningLimit = 100000000\n // Emit all CSS as a single file, which `vite-plugin-singlefile` can then inline.\n config.build.cssCodeSplit = false\n // Avoids the extra step of testing Brotli compression, which isn't really pertinent to a file served locally.\n config.build.reportCompressedSize = false\n // Subfolder bases are not supported, and shouldn't be needed because we're embedding everything.\n config.base = undefined\n\n config.resolve ??= {}\n\n config.resolve.extensions = extensions\n\n config.resolve.alias ??= {}\n config.resolve.alias = {\n ...config.resolve.alias,\n 'react-native/Libraries/Renderer/shims/ReactFabric':\n 'react-native/Libraries/Renderer/shims/ReactFabric',\n 'react-native/Libraries/Utilities/codegenNativeComponent':\n 'react-native/Libraries/Utilities/codegenNativeComponent',\n 'react-native-svg': 'react-native-svg',\n 'react-native-web': 'react-native',\n 'react-native': 'react-native',\n }\n\n config.optimizeDeps ??= {}\n config.optimizeDeps.esbuildOptions ??= {}\n config.optimizeDeps.esbuildOptions.resolveExtensions = extensions\n\n config.optimizeDeps.esbuildOptions.plugins ??= []\n config.optimizeDeps.esbuildOptions.plugins.push(\n esbuildFlowPlugin(\n /node_modules\\/(react-native\\/|@react-native\\/assets)/,\n (_) => 'jsx'\n )\n )\n // config.optimizeDeps.esbuildOptions.plugins.push(esbuildCommonjs(['react-native']))\n\n config.optimizeDeps.include ??= []\n config.optimizeDeps.include.push('react-native')\n\n config.optimizeDeps.esbuildOptions.loader ??= {}\n config.optimizeDeps.esbuildOptions.loader['.js'] = 'jsx'\n\n config.optimizeDeps.esbuildOptions.plugins.push({\n name: 'react-native-assets',\n setup(build) {\n build.onResolve(\n {\n filter: /\\.(png|jpg|gif|webp)$/,\n },\n async ({ path, namespace }) => {\n return {\n path: '',\n external: true,\n }\n }\n )\n },\n })\n\n config.build.rollupOptions ??= {}\n\n config.build.rollupOptions.input =\n '/Users/n8/tamagui/apps/kitchen-sink/src/index.tsx'\n\n config.build.rollupOptions.output ??= {}\n\n config.build.rollupOptions.plugins ??= []\n\n config.build.rollupOptions.external = ['react-native', 'react', 'react/jsx-runtime']\n\n if (!Array.isArray(config.build.rollupOptions.plugins)) {\n throw `x`\n }\n\n if (process.env.DEBUG) {\n console.log('config..', config)\n }\n\n config.build.commonjsOptions = {\n include: /node_modules\\/react\\//,\n }\n\n config.build.rollupOptions.plugins.push({\n name: `swap-react-native`,\n async load(id) {\n if (id.endsWith('react-native/index.js')) {\n const bundled = await readFile(\n join(process.cwd(), 'react-native.js'),\n 'utf-8'\n )\n const code = bundled\n return {\n code: `\nconst run = () => { \n ${bundled.replace(\n `module.exports = require_react_native();`,\n `return require_react_native();`\n )}\n}\n\nconst RN = run()\n\n${RNExportNames.map(\n (name) =>\n // adding exports\n `export const ${name} = RN.${name}`\n).join('\\n')}\n\n`,\n }\n }\n },\n })\n\n const updateOutputOptions = (out: OutputOptions) => {\n // Ensure that as many resources as possible are inlined.\n out.inlineDynamicImports = true\n\n // added by me (nate):\n out.manualChunks = undefined\n }\n\n if (Array.isArray(config.build.rollupOptions.output)) {\n for (const o in config.build.rollupOptions.output)\n updateOutputOptions(o as OutputOptions)\n } else {\n updateOutputOptions(config.build.rollupOptions.output as OutputOptions)\n }\n },\n }\n}\n\nconst RNExportNames = [\n 'AccessibilityInfo',\n 'ActivityIndicator',\n 'Button',\n 'DatePickerIOS',\n 'DrawerLayoutAndroid',\n 'FlatList',\n 'Image',\n 'ImageBackground',\n 'InputAccessoryView',\n 'KeyboardAvoidingView',\n 'MaskedViewIOS',\n 'Modal',\n 'Pressable',\n 'ProgressBarAndroid',\n 'ProgressViewIOS',\n 'RefreshControl',\n 'SafeAreaView',\n 'ScrollView',\n 'SectionList',\n 'Slider',\n 'StatusBar',\n 'Switch',\n 'Text',\n 'TextInput',\n 'Touchable',\n 'TouchableHighlight',\n 'TouchableNativeFeedback',\n 'TouchableOpacity',\n 'TouchableWithoutFeedback',\n 'View',\n 'VirtualizedList',\n 'VirtualizedSectionList',\n 'ActionSheetIOS',\n 'Alert',\n 'Animated',\n 'Appearance',\n 'AppRegistry',\n 'AppState',\n 'AsyncStorage',\n 'BackHandler',\n 'Clipboard',\n 'DeviceInfo',\n 'DevSettings',\n 'Dimensions',\n 'Easing',\n 'findNodeHandle',\n 'I18nManager',\n 'ImagePickerIOS',\n 'InteractionManager',\n 'Keyboard',\n 'LayoutAnimation',\n 'Linking',\n 'LogBox',\n 'NativeDialogManagerAndroid',\n 'NativeEventEmitter',\n 'Networking',\n 'PanResponder',\n 'PermissionsAndroid',\n 'PixelRatio',\n // 'PushNotificationIOS',\n 'Settings',\n 'Share',\n 'StyleSheet',\n 'Systrace',\n 'ToastAndroid',\n 'TurboModuleRegistry',\n 'UIManager',\n 'unstable_batchedUpdates',\n 'useColorScheme',\n 'useWindowDimensions',\n 'UTFSequence',\n 'Vibration',\n 'YellowBox',\n 'DeviceEventEmitter',\n 'DynamicColorIOS',\n 'NativeAppEventEmitter',\n 'NativeModules',\n 'Platform',\n 'PlatformColor',\n 'processColor',\n 'requireNativeComponent',\n 'RootTagContext',\n // 'unstable_enableLogBox',\n // 'ColorPropType',\n // 'EdgeInsetsPropType',\n // 'PointPropType',\n // 'ViewPropTypes',\n]\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["native_exports", "__export", "nativePlugin", "__toCommonJS", "import_promises", "import_path", "import_vite_plugin_flow", "import_extensions", "config", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_", "build", "path", "namespace", "id", "bundled", "code", "RNExportNames", "name", "updateOutputOptions", "out", "o"]
|
|
7
7
|
}
|
|
@@ -1,134 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var nativePrebuild_exports = {};
|
|
30
|
-
__export(nativePrebuild_exports, {
|
|
31
|
-
nativePrebuild: () => nativePrebuild
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(nativePrebuild_exports);
|
|
34
|
-
var import_promises = require("fs/promises");
|
|
35
|
-
var import_esbuild = require("esbuild");
|
|
36
|
-
var import_flow_remove_types = __toESM(require("flow-remove-types"));
|
|
37
|
-
var import_extensions = require("./extensions.js");
|
|
38
|
-
async function nativePrebuild() {
|
|
39
|
-
console.log(`Prebuilding React Native (one time cost...)`);
|
|
40
|
-
await Promise.all([
|
|
41
|
-
// react
|
|
42
|
-
(0, import_esbuild.build)({
|
|
43
|
-
bundle: true,
|
|
44
|
-
entryPoints: ["react"],
|
|
45
|
-
outfile: "react.js",
|
|
46
|
-
format: "cjs",
|
|
47
|
-
target: "node14",
|
|
48
|
-
jsx: "transform",
|
|
49
|
-
jsxFactory: "react",
|
|
50
|
-
allowOverwrite: true,
|
|
51
|
-
platform: "node",
|
|
52
|
-
define: {
|
|
53
|
-
__DEV__: "true",
|
|
54
|
-
"process.env.NODE_ENV": `"development"`
|
|
55
|
-
},
|
|
56
|
-
logLevel: "warning",
|
|
57
|
-
resolveExtensions: import_extensions.extensions
|
|
58
|
-
}),
|
|
59
|
-
// react-jsx-runtime
|
|
60
|
-
(0, import_esbuild.build)({
|
|
61
|
-
bundle: true,
|
|
62
|
-
entryPoints: ["react/jsx-runtime"],
|
|
63
|
-
outfile: "react-jsx-runtime.js",
|
|
64
|
-
format: "cjs",
|
|
65
|
-
target: "node14",
|
|
66
|
-
jsx: "transform",
|
|
67
|
-
jsxFactory: "react",
|
|
68
|
-
external: ["react"],
|
|
69
|
-
allowOverwrite: true,
|
|
70
|
-
platform: "node",
|
|
71
|
-
define: {
|
|
72
|
-
// metro serves this in production mode
|
|
73
|
-
__DEV__: "false",
|
|
74
|
-
"process.env.NODE_ENV": `"production"`
|
|
75
|
-
},
|
|
76
|
-
logLevel: "warning",
|
|
77
|
-
resolveExtensions: import_extensions.extensions
|
|
78
|
-
}),
|
|
79
|
-
// react native
|
|
80
|
-
(0, import_esbuild.build)({
|
|
81
|
-
bundle: true,
|
|
82
|
-
entryPoints: ["/Users/n8/tamagui/node_modules/react-native/index.js"],
|
|
83
|
-
outfile: "react-native.js",
|
|
84
|
-
format: "cjs",
|
|
85
|
-
target: "node14",
|
|
86
|
-
jsx: "transform",
|
|
87
|
-
jsxFactory: "react",
|
|
88
|
-
allowOverwrite: true,
|
|
89
|
-
platform: "node",
|
|
90
|
-
loader: {
|
|
91
|
-
".png": "dataurl",
|
|
92
|
-
".jpg": "dataurl",
|
|
93
|
-
".jpeg": "dataurl",
|
|
94
|
-
".gif": "dataurl"
|
|
95
|
-
},
|
|
96
|
-
define: {
|
|
97
|
-
__DEV__: "true",
|
|
98
|
-
"process.env.NODE_ENV": `"development"`
|
|
99
|
-
},
|
|
100
|
-
logLevel: "warning",
|
|
101
|
-
resolveExtensions: import_extensions.extensions,
|
|
102
|
-
external: ["react", "react/jsx-runtime.js", "react/jsx-runtime"],
|
|
103
|
-
plugins: [
|
|
104
|
-
{
|
|
105
|
-
name: "remove-flow",
|
|
106
|
-
setup(build2) {
|
|
107
|
-
build2.onLoad(
|
|
108
|
-
{
|
|
109
|
-
filter: /.*.js/
|
|
110
|
-
},
|
|
111
|
-
async (input) => {
|
|
112
|
-
if (!input.path.includes("react-native")) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const code = await (0, import_promises.readFile)(input.path, "utf-8");
|
|
116
|
-
const output = (0, import_flow_remove_types.default)(code, { pretty: true });
|
|
117
|
-
const contents = output.toString().replace(/static\s+\+/g, "static ");
|
|
118
|
-
return {
|
|
119
|
-
contents,
|
|
120
|
-
loader: "jsx"
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
})
|
|
128
|
-
]);
|
|
129
|
-
}
|
|
130
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
131
|
-
0 && (module.exports = {
|
|
132
|
-
nativePrebuild
|
|
133
|
-
});
|
|
1
|
+
"use strict";var d=Object.create;var n=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},l=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!j.call(e,o)&&o!==r&&n(e,o,{get:()=>t[o],enumerable:!(i=m(t,o))||i.enumerable});return e};var g=(e,t,r)=>(r=e!=null?d(p(e)):{},l(t||!e||!e.__esModule?n(r,"default",{value:e,enumerable:!0}):r,e)),x=e=>l(n({},"__esModule",{value:!0}),e);var w={};v(w,{nativePrebuild:()=>_});module.exports=x(w);var c=require("fs/promises"),a=require("esbuild"),u=g(require("flow-remove-types")),s=require("./extensions.js");async function _(){console.log("Prebuilding React Native (one time cost...)"),await Promise.all([(0,a.build)({bundle:!0,entryPoints:["react"],outfile:"react.js",format:"cjs",target:"node14",jsx:"transform",jsxFactory:"react",allowOverwrite:!0,platform:"node",define:{__DEV__:"true","process.env.NODE_ENV":'"development"'},logLevel:"warning",resolveExtensions:s.extensions}),(0,a.build)({bundle:!0,entryPoints:["react/jsx-runtime"],outfile:"react-jsx-runtime.js",format:"cjs",target:"node14",jsx:"transform",jsxFactory:"react",external:["react"],allowOverwrite:!0,platform:"node",define:{__DEV__:"false","process.env.NODE_ENV":'"production"'},logLevel:"warning",resolveExtensions:s.extensions}),(0,a.build)({bundle:!0,entryPoints:["/Users/n8/tamagui/node_modules/react-native/index.js"],outfile:"react-native.js",format:"cjs",target:"node14",jsx:"transform",jsxFactory:"react",allowOverwrite:!0,platform:"node",loader:{".png":"dataurl",".jpg":"dataurl",".jpeg":"dataurl",".gif":"dataurl"},define:{__DEV__:"true","process.env.NODE_ENV":'"development"'},logLevel:"warning",resolveExtensions:s.extensions,external:["react","react/jsx-runtime.js","react/jsx-runtime"],plugins:[{name:"remove-flow",setup(e){e.onLoad({filter:/.*.js/},async t=>{if(!t.path.includes("react-native"))return;const r=await(0,c.readFile)(t.path,"utf-8");return{contents:(0,u.default)(r,{pretty:!0}).toString().replace(/static\s+\+/g,"static "),loader:"jsx"}})}}]})])}0&&(module.exports={nativePrebuild});
|
|
134
2
|
//# sourceMappingURL=nativePrebuild.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/nativePrebuild.ts"],
|
|
4
4
|
"sourcesContent": ["import { readFile } from 'fs/promises'\n\nimport { build } from 'esbuild'\nimport flowRemoveTypes from 'flow-remove-types'\n\nimport { extensions } from './extensions.js'\n\nexport async function nativePrebuild() {\n console.log(`Prebuilding React Native (one time cost...)`)\n await Promise.all([\n // react\n build({\n bundle: true,\n entryPoints: ['react'],\n outfile: 'react.js',\n format: 'cjs',\n target: 'node14',\n jsx: 'transform',\n jsxFactory: 'react',\n allowOverwrite: true,\n platform: 'node',\n define: {\n __DEV__: 'true',\n 'process.env.NODE_ENV': `\"development\"`,\n },\n logLevel: 'warning',\n resolveExtensions: extensions,\n }),\n // react-jsx-runtime\n build({\n bundle: true,\n entryPoints: ['react/jsx-runtime'],\n outfile: 'react-jsx-runtime.js',\n format: 'cjs',\n target: 'node14',\n jsx: 'transform',\n jsxFactory: 'react',\n external: ['react'],\n allowOverwrite: true,\n platform: 'node',\n define: {\n // metro serves this in production mode\n __DEV__: 'false',\n 'process.env.NODE_ENV': `\"production\"`,\n },\n logLevel: 'warning',\n resolveExtensions: extensions,\n }),\n // react native\n build({\n bundle: true,\n entryPoints: ['/Users/n8/tamagui/node_modules/react-native/index.js'],\n outfile: 'react-native.js',\n format: 'cjs',\n target: 'node14',\n jsx: 'transform',\n jsxFactory: 'react',\n allowOverwrite: true,\n platform: 'node',\n loader: {\n '.png': 'dataurl',\n '.jpg': 'dataurl',\n '.jpeg': 'dataurl',\n '.gif': 'dataurl',\n },\n define: {\n __DEV__: 'true',\n 'process.env.NODE_ENV': `\"development\"`,\n },\n logLevel: 'warning',\n resolveExtensions: extensions,\n external: ['react', 'react/jsx-runtime.js', 'react/jsx-runtime'],\n plugins: [\n {\n name: 'remove-flow',\n setup(build) {\n build.onLoad(\n {\n filter: /.*.js/,\n },\n async (input) => {\n if (!input.path.includes('react-native')) {\n return\n }\n const code = await readFile(input.path, 'utf-8')\n const output = flowRemoveTypes(code, { pretty: true })\n const contents = output.toString().replace(/static\\s+\\+/g, 'static ')\n return {\n contents,\n loader: 'jsx',\n }\n }\n )\n },\n },\n ],\n }),\n ])\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["build", "flowRemoveTypes"]
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyB,uBAEzBC,EAAsB,mBACtBC,EAA4B,gCAE5BC,EAA2B,2BAE3B,eAAsBL,GAAiB,CACrC,QAAQ,IAAI,6CAA6C,EACzD,MAAM,QAAQ,IAAI,IAEhB,SAAM,CACJ,OAAQ,GACR,YAAa,CAAC,OAAO,EACrB,QAAS,WACT,OAAQ,MACR,OAAQ,SACR,IAAK,YACL,WAAY,QACZ,eAAgB,GAChB,SAAU,OACV,OAAQ,CACN,QAAS,OACT,uBAAwB,eAC1B,EACA,SAAU,UACV,kBAAmB,YACrB,CAAC,KAED,SAAM,CACJ,OAAQ,GACR,YAAa,CAAC,mBAAmB,EACjC,QAAS,uBACT,OAAQ,MACR,OAAQ,SACR,IAAK,YACL,WAAY,QACZ,SAAU,CAAC,OAAO,EAClB,eAAgB,GAChB,SAAU,OACV,OAAQ,CAEN,QAAS,QACT,uBAAwB,cAC1B,EACA,SAAU,UACV,kBAAmB,YACrB,CAAC,KAED,SAAM,CACJ,OAAQ,GACR,YAAa,CAAC,sDAAsD,EACpE,QAAS,kBACT,OAAQ,MACR,OAAQ,SACR,IAAK,YACL,WAAY,QACZ,eAAgB,GAChB,SAAU,OACV,OAAQ,CACN,OAAQ,UACR,OAAQ,UACR,QAAS,UACT,OAAQ,SACV,EACA,OAAQ,CACN,QAAS,OACT,uBAAwB,eAC1B,EACA,SAAU,UACV,kBAAmB,aACnB,SAAU,CAAC,QAAS,uBAAwB,mBAAmB,EAC/D,QAAS,CACP,CACE,KAAM,cACN,MAAMM,EAAO,CACXA,EAAM,OACJ,CACE,OAAQ,OACV,EACA,MAAOC,GAAU,CACf,GAAI,CAACA,EAAM,KAAK,SAAS,cAAc,EACrC,OAEF,MAAMC,EAAO,QAAM,YAASD,EAAM,KAAM,OAAO,EAG/C,MAAO,CACL,YAHa,EAAAE,SAAgBD,EAAM,CAAE,OAAQ,EAAK,CAAC,EAC7B,SAAS,EAAE,QAAQ,eAAgB,SAAS,EAGlE,OAAQ,KACV,CACF,CACF,CACF,CACF,CACF,CACF,CAAC,CACH,CAAC,CACH",
|
|
6
|
+
"names": ["nativePrebuild_exports", "__export", "nativePrebuild", "__toCommonJS", "import_promises", "import_esbuild", "import_flow_remove_types", "import_extensions", "build", "input", "code", "flowRemoveTypes"]
|
|
7
7
|
}
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -1,126 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var plugin_exports = {};
|
|
20
|
-
__export(plugin_exports, {
|
|
21
|
-
tamaguiPlugin: () => tamaguiPlugin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(plugin_exports);
|
|
24
|
-
function tamaguiPlugin(options) {
|
|
25
|
-
const components = [.../* @__PURE__ */ new Set([...options.components, "tamagui", "@tamagui/core"])];
|
|
26
|
-
const noExternalSSR = new RegExp(
|
|
27
|
-
`${components.join("|")}|react-native|expo-linear-gradient`,
|
|
28
|
-
"ig"
|
|
29
|
-
);
|
|
30
|
-
const plugin = {
|
|
31
|
-
name: "tamagui-base",
|
|
32
|
-
enforce: "pre",
|
|
33
|
-
config(userConfig, env) {
|
|
34
|
-
return {
|
|
35
|
-
plugins: [
|
|
36
|
-
//
|
|
37
|
-
// envPlugin(['NODE_ENV', 'TAMAGUI_TARGET', 'ENABLE_RSC']),
|
|
38
|
-
// viteCommonjs(),
|
|
39
|
-
],
|
|
40
|
-
define: {
|
|
41
|
-
// reanimated support
|
|
42
|
-
"global.__x": {},
|
|
43
|
-
_frameTimestamp: void 0,
|
|
44
|
-
_WORKLET: false,
|
|
45
|
-
...process.env.NODE_ENV !== "test" && {
|
|
46
|
-
"process.env.TAMAGUI_TARGET": JSON.stringify(
|
|
47
|
-
process.env.TAMAGUI_TARGET || "web"
|
|
48
|
-
),
|
|
49
|
-
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || env.mode),
|
|
50
|
-
"process.env.ENABLE_RSC": JSON.stringify(process.env.ENABLE_RSC || ""),
|
|
51
|
-
"process.env.ENABLE_STEPS": JSON.stringify(process.env.ENABLE_STEPS || ""),
|
|
52
|
-
"process.env.IS_STATIC": JSON.stringify(false)
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
// build: {
|
|
56
|
-
// commonjsOptions: {
|
|
57
|
-
// transformMixedEsModules: true,
|
|
58
|
-
// },
|
|
59
|
-
// },
|
|
60
|
-
ssr: {
|
|
61
|
-
noExternal: noExternalSSR
|
|
62
|
-
},
|
|
63
|
-
optimizeDeps: {
|
|
64
|
-
// disabled: false,
|
|
65
|
-
include: ["styleq", "react-native-reanimated"],
|
|
66
|
-
esbuildOptions: {
|
|
67
|
-
jsx: "transform",
|
|
68
|
-
// plugins: [
|
|
69
|
-
// esbuildCommonjs([
|
|
70
|
-
// 'styleq',
|
|
71
|
-
// 'inline-style-prefixer',
|
|
72
|
-
// 'create-react-class',
|
|
73
|
-
// 'copy-to-clipboard',
|
|
74
|
-
// ]),
|
|
75
|
-
// ],
|
|
76
|
-
resolveExtensions: [
|
|
77
|
-
".web.js",
|
|
78
|
-
".web.ts",
|
|
79
|
-
".web.tsx",
|
|
80
|
-
".js",
|
|
81
|
-
".jsx",
|
|
82
|
-
".json",
|
|
83
|
-
".ts",
|
|
84
|
-
".tsx",
|
|
85
|
-
".mjs"
|
|
86
|
-
],
|
|
87
|
-
loader: {
|
|
88
|
-
".js": "jsx"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
resolve: {
|
|
93
|
-
// for once it extracts
|
|
94
|
-
// mainFields: ['module:jsx', 'module', 'jsnext:main', 'jsnext', 'main'],
|
|
95
|
-
extensions: [
|
|
96
|
-
".web.js",
|
|
97
|
-
".web.ts",
|
|
98
|
-
".web.tsx",
|
|
99
|
-
".js",
|
|
100
|
-
".jsx",
|
|
101
|
-
".json",
|
|
102
|
-
".ts",
|
|
103
|
-
".tsx",
|
|
104
|
-
".mjs"
|
|
105
|
-
],
|
|
106
|
-
alias: {
|
|
107
|
-
"react-native/Libraries/Renderer/shims/ReactFabric": "@tamagui/proxy-worm",
|
|
108
|
-
"react-native/Libraries/Utilities/codegenNativeComponent": "@tamagui/proxy-worm",
|
|
109
|
-
"react-native-svg": "@tamagui/react-native-svg",
|
|
110
|
-
"react-native": "react-native-web",
|
|
111
|
-
...options.useReactNativeWebLite && {
|
|
112
|
-
"react-native": "react-native-web-lite",
|
|
113
|
-
"react-native-web": "react-native-web-lite"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
return plugin;
|
|
121
|
-
}
|
|
122
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
123
|
-
0 && (module.exports = {
|
|
124
|
-
tamaguiPlugin
|
|
125
|
-
});
|
|
1
|
+
"use strict";var a=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var s in e)a(t,s,{get:e[s],enumerable:!0})},m=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!g.call(t,i)&&i!==s&&a(t,i,{get:()=>e[i],enumerable:!(n=o(e,i))||n.enumerable});return t};var v=t=>m(a({},"__esModule",{value:!0}),t);var l={};p(l,{tamaguiPlugin:()=>u});module.exports=v(l);function u(t){const e=[...new Set([...t.components,"tamagui","@tamagui/core"])],s=new RegExp(`${e.join("|")}|react-native|expo-linear-gradient`,"ig");return{name:"tamagui-base",enforce:"pre",config(i,r){return{plugins:[],define:{"global.__x":{},_frameTimestamp:void 0,_WORKLET:!1,...process.env.NODE_ENV!=="test"&&{"process.env.TAMAGUI_TARGET":JSON.stringify(process.env.TAMAGUI_TARGET||"web"),"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||r.mode),"process.env.ENABLE_RSC":JSON.stringify(process.env.ENABLE_RSC||""),"process.env.ENABLE_STEPS":JSON.stringify(process.env.ENABLE_STEPS||""),"process.env.IS_STATIC":JSON.stringify(!1)}},ssr:{noExternal:s},optimizeDeps:{include:["styleq","react-native-reanimated"],esbuildOptions:{jsx:"transform",resolveExtensions:[".web.js",".web.ts",".web.tsx",".js",".jsx",".json",".ts",".tsx",".mjs"],loader:{".js":"jsx"}}},resolve:{extensions:[".web.js",".web.ts",".web.tsx",".js",".jsx",".json",".ts",".tsx",".mjs"],alias:{"react-native/Libraries/Renderer/shims/ReactFabric":"@tamagui/proxy-worm","react-native/Libraries/Utilities/codegenNativeComponent":"@tamagui/proxy-worm","react-native-svg":"@tamagui/react-native-svg","react-native":"react-native-web",...t.useReactNativeWebLite&&{"react-native":"react-native-web-lite","react-native-web":"react-native-web-lite"}}}}}}}0&&(module.exports={tamaguiPlugin});
|
|
126
2
|
//# sourceMappingURL=plugin.js.map
|
package/dist/cjs/plugin.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugin.ts"],
|
|
4
4
|
"sourcesContent": ["import type { TamaguiOptions } from '@tamagui/static'\nimport type { Plugin } from 'vite'\n\n/**\n * For some reason envPlugin doesnt work for vitest, but process: { env: {} } breaks vitest\n */\n\nexport function tamaguiPlugin(\n options: TamaguiOptions & {\n useReactNativeWebLite?: boolean\n }\n): Plugin {\n const components = [...new Set([...options.components, 'tamagui', '@tamagui/core'])]\n const noExternalSSR = new RegExp(\n `${components.join('|')}|react-native|expo-linear-gradient`,\n 'ig'\n )\n\n const plugin: Plugin = {\n name: 'tamagui-base',\n enforce: 'pre',\n\n config(userConfig, env) {\n return {\n plugins: [\n //\n // envPlugin(['NODE_ENV', 'TAMAGUI_TARGET', 'ENABLE_RSC']),\n // viteCommonjs(),\n ],\n define: {\n // reanimated support\n 'global.__x': {},\n _frameTimestamp: undefined,\n _WORKLET: false,\n ...(process.env.NODE_ENV !== 'test' && {\n 'process.env.TAMAGUI_TARGET': JSON.stringify(\n process.env.TAMAGUI_TARGET || 'web'\n ),\n 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || env.mode),\n 'process.env.ENABLE_RSC': JSON.stringify(process.env.ENABLE_RSC || ''),\n 'process.env.ENABLE_STEPS': JSON.stringify(process.env.ENABLE_STEPS || ''),\n 'process.env.IS_STATIC': JSON.stringify(false),\n }),\n },\n // build: {\n // commonjsOptions: {\n // transformMixedEsModules: true,\n // },\n // },\n ssr: {\n noExternal: noExternalSSR,\n },\n optimizeDeps: {\n // disabled: false,\n include: ['styleq', 'react-native-reanimated'],\n esbuildOptions: {\n jsx: 'transform',\n // plugins: [\n // esbuildCommonjs([\n // 'styleq',\n // 'inline-style-prefixer',\n // 'create-react-class',\n // 'copy-to-clipboard',\n // ]),\n // ],\n resolveExtensions: [\n '.web.js',\n '.web.ts',\n '.web.tsx',\n '.js',\n '.jsx',\n '.json',\n '.ts',\n '.tsx',\n '.mjs',\n ],\n loader: {\n '.js': 'jsx',\n },\n },\n },\n resolve: {\n // for once it extracts\n // mainFields: ['module:jsx', 'module', 'jsnext:main', 'jsnext', 'main'],\n extensions: [\n '.web.js',\n '.web.ts',\n '.web.tsx',\n '.js',\n '.jsx',\n '.json',\n '.ts',\n '.tsx',\n '.mjs',\n ],\n alias: {\n 'react-native/Libraries/Renderer/shims/ReactFabric': '@tamagui/proxy-worm',\n 'react-native/Libraries/Utilities/codegenNativeComponent':\n '@tamagui/proxy-worm',\n 'react-native-svg': '@tamagui/react-native-svg',\n 'react-native': 'react-native-web',\n ...(options.useReactNativeWebLite && {\n 'react-native': 'react-native-web-lite',\n 'react-native-web': 'react-native-web-lite',\n }),\n },\n },\n }\n },\n }\n\n return plugin\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAOO,SAASE,EACdE,EAGQ,CACR,MAAMC,EAAa,CAAC,GAAG,IAAI,IAAI,CAAC,GAAGD,EAAQ,WAAY,UAAW,eAAe,CAAC,CAAC,EAC7EE,EAAgB,IAAI,OACxB,GAAGD,EAAW,KAAK,GAAG,sCACtB,IACF,EA+FA,MA7FuB,CACrB,KAAM,eACN,QAAS,MAET,OAAOE,EAAYC,EAAK,CACtB,MAAO,CACL,QAAS,CAIT,EACA,OAAQ,CAEN,aAAc,CAAC,EACf,gBAAiB,OACjB,SAAU,GACV,GAAI,QAAQ,IAAI,WAAa,QAAU,CACrC,6BAA8B,KAAK,UACjC,QAAQ,IAAI,gBAAkB,KAChC,EACA,uBAAwB,KAAK,UAAU,QAAQ,IAAI,UAAYA,EAAI,IAAI,EACvE,yBAA0B,KAAK,UAAU,QAAQ,IAAI,YAAc,EAAE,EACrE,2BAA4B,KAAK,UAAU,QAAQ,IAAI,cAAgB,EAAE,EACzE,wBAAyB,KAAK,UAAU,EAAK,CAC/C,CACF,EAMA,IAAK,CACH,WAAYF,CACd,EACA,aAAc,CAEZ,QAAS,CAAC,SAAU,yBAAyB,EAC7C,eAAgB,CACd,IAAK,YASL,kBAAmB,CACjB,UACA,UACA,WACA,MACA,OACA,QACA,MACA,OACA,MACF,EACA,OAAQ,CACN,MAAO,KACT,CACF,CACF,EACA,QAAS,CAGP,WAAY,CACV,UACA,UACA,WACA,MACA,OACA,QACA,MACA,OACA,MACF,EACA,MAAO,CACL,oDAAqD,sBACrD,0DACE,sBACF,mBAAoB,4BACpB,eAAgB,mBAChB,GAAIF,EAAQ,uBAAyB,CACnC,eAAgB,wBAChB,mBAAoB,uBACtB,CACF,CACF,CACF,CACF,CACF,CAGF",
|
|
6
|
+
"names": ["plugin_exports", "__export", "tamaguiPlugin", "__toCommonJS", "options", "components", "noExternalSSR", "userConfig", "env"]
|
|
7
7
|
}
|
package/dist/esm/extensions.js
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
const
|
|
2
|
-
".ios.js",
|
|
3
|
-
".native.js",
|
|
4
|
-
".native.ts",
|
|
5
|
-
".native.tsx",
|
|
6
|
-
".js",
|
|
7
|
-
".jsx",
|
|
8
|
-
".json",
|
|
9
|
-
".ts",
|
|
10
|
-
".tsx",
|
|
11
|
-
".mjs"
|
|
12
|
-
];
|
|
13
|
-
export {
|
|
14
|
-
extensions
|
|
15
|
-
};
|
|
1
|
+
const s=[".ios.js",".native.js",".native.ts",".native.tsx",".js",".jsx",".json",".ts",".tsx",".mjs"];export{s as extensions};
|
|
16
2
|
//# sourceMappingURL=extensions.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/extensions.ts"],
|
|
4
4
|
"sourcesContent": ["export const extensions = [\n '.ios.js',\n '.native.js',\n '.native.ts',\n '.native.tsx',\n '.js',\n '.jsx',\n '.json',\n '.ts',\n '.tsx',\n '.mjs',\n]\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAO,MAAMA,EAAa,CACxB,UACA,aACA,aACA,cACA,MACA,OACA,QACA,MACA,OACA,MACF",
|
|
6
|
+
"names": ["extensions"]
|
|
7
7
|
}
|
package/dist/esm/extensions.mjs
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
const
|
|
2
|
-
".ios.js",
|
|
3
|
-
".native.js",
|
|
4
|
-
".native.ts",
|
|
5
|
-
".native.tsx",
|
|
6
|
-
".js",
|
|
7
|
-
".jsx",
|
|
8
|
-
".json",
|
|
9
|
-
".ts",
|
|
10
|
-
".tsx",
|
|
11
|
-
".mjs"
|
|
12
|
-
];
|
|
13
|
-
export {
|
|
14
|
-
extensions
|
|
15
|
-
};
|
|
1
|
+
const s=[".ios.js",".native.js",".native.ts",".native.tsx",".js",".jsx",".json",".ts",".tsx",".mjs"];export{s as extensions};
|
|
16
2
|
//# sourceMappingURL=extensions.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/extensions.ts"],
|
|
4
4
|
"sourcesContent": ["export const extensions = [\n '.ios.js',\n '.native.js',\n '.native.ts',\n '.native.tsx',\n '.js',\n '.jsx',\n '.json',\n '.ts',\n '.tsx',\n '.mjs',\n]\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAO,MAAMA,EAAa,CACxB,UACA,aACA,aACA,cACA,MACA,OACA,QACA,MACA,OACA,MACF",
|
|
6
|
+
"names": ["extensions"]
|
|
7
7
|
}
|
package/dist/esm/extract.js
CHANGED
|
@@ -1,163 +1,18 @@
|
|
|
1
|
-
import path from "
|
|
2
|
-
import * as Static from "@tamagui/static";
|
|
3
|
-
import outdent from "outdent";
|
|
4
|
-
import { normalizePath } from "vite";
|
|
5
|
-
const { createExtractor, extractToClassNames, getPragmaOptions } = Static["default"] || Static;
|
|
6
|
-
const styleUpdateEvent = (fileId) => `tamagui-style-update:${fileId}`;
|
|
7
|
-
const GLOBAL_CSS_VIRTUAL_PATH = "__tamagui_global_css__.css";
|
|
8
|
-
function tamaguiExtractPlugin(options) {
|
|
9
|
-
const disableStatic = options.disable || options.disableDebugAttr && options.disableExtraction;
|
|
10
|
-
if (disableStatic) {
|
|
11
|
-
return {
|
|
12
|
-
name: "tamagui-extract"
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
let extractor = null;
|
|
16
|
-
const cssMap = /* @__PURE__ */ new Map();
|
|
17
|
-
let config;
|
|
18
|
-
let server;
|
|
19
|
-
let shouldReturnCSS = true;
|
|
20
|
-
let virtualExt;
|
|
21
|
-
const getAbsoluteVirtualFileId = (filePath) => {
|
|
22
|
-
if (filePath.startsWith(config.root)) {
|
|
23
|
-
return filePath;
|
|
24
|
-
}
|
|
25
|
-
return normalizePath(path.join(config.root, filePath));
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
name: "tamagui-extract",
|
|
29
|
-
enforce: "pre",
|
|
30
|
-
configureServer(_server) {
|
|
31
|
-
server = _server;
|
|
32
|
-
},
|
|
33
|
-
buildEnd() {
|
|
34
|
-
extractor.cleanupBeforeExit();
|
|
35
|
-
},
|
|
36
|
-
writeBundle(options2, bundle) {
|
|
37
|
-
setTimeout(() => {
|
|
38
|
-
console.warn("some sort of dangling process or osmethign, exit for now...");
|
|
39
|
-
process.exit(0);
|
|
40
|
-
}, 100);
|
|
41
|
-
},
|
|
42
|
-
config(_userConfig, env) {
|
|
43
|
-
const include = env.command === "serve" ? ["@tamagui/core/inject-styles"] : [];
|
|
44
|
-
return {
|
|
45
|
-
optimizeDeps: { include }
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
async configResolved(resolvedConfig) {
|
|
49
|
-
config = resolvedConfig;
|
|
50
|
-
extractor = createExtractor({
|
|
51
|
-
logger: resolvedConfig.logger
|
|
52
|
-
});
|
|
53
|
-
shouldReturnCSS = true;
|
|
54
|
-
virtualExt = `.tamagui.${shouldReturnCSS ? "css" : "js"}`;
|
|
55
|
-
},
|
|
56
|
-
async resolveId(source) {
|
|
57
|
-
if (source === "tamagui.css") {
|
|
58
|
-
await extractor.loadTamagui(options);
|
|
59
|
-
return GLOBAL_CSS_VIRTUAL_PATH;
|
|
60
|
-
}
|
|
61
|
-
const [validId, query] = source.split("?");
|
|
62
|
-
if (!validId.endsWith(virtualExt)) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(validId);
|
|
66
|
-
if (cssMap.has(absoluteId)) {
|
|
67
|
-
return absoluteId + (query ? `?${query}` : "");
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
/**
|
|
71
|
-
* TODO
|
|
72
|
-
*
|
|
73
|
-
* mainFields module:jsx breaks, so lets just have a mapping here
|
|
74
|
-
* where we load() and map it to the jsx path before transform
|
|
75
|
-
*
|
|
76
|
-
*/
|
|
77
|
-
load(id, options2) {
|
|
78
|
-
const [validId] = id.split("?");
|
|
79
|
-
if (validId === GLOBAL_CSS_VIRTUAL_PATH) {
|
|
80
|
-
return extractor.getTamagui().getCSS();
|
|
81
|
-
}
|
|
82
|
-
if (!cssMap.has(validId)) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const css = cssMap.get(validId);
|
|
86
|
-
if (typeof css !== "string") {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (shouldReturnCSS || !server || server.config.isProduction) {
|
|
90
|
-
return css;
|
|
91
|
-
}
|
|
92
|
-
return outdent`
|
|
1
|
+
import j from"path";import*as x from"@tamagui/static";import _ from"outdent";import{normalizePath as $}from"vite";const{createExtractor:P,extractToClassNames:w,getPragmaOptions:E}=x.default||x,S=i=>`tamagui-style-update:${i}`,b="__tamagui_global_css__.css";function B(i){if(i.disable||i.disableDebugAttr&&i.disableExtraction)return{name:"tamagui-extract"};let c=null;const o=new Map;let u,n,g=!0,d;const p=t=>t.startsWith(u.root)?t:$(j.join(u.root,t));return{name:"tamagui-extract",enforce:"pre",configureServer(t){n=t},buildEnd(){c.cleanupBeforeExit()},writeBundle(t,r){setTimeout(()=>{console.warn("some sort of dangling process or osmethign, exit for now..."),process.exit(0)},100)},config(t,r){return{optimizeDeps:{include:r.command==="serve"?["@tamagui/core/inject-styles"]:[]}}},async configResolved(t){u=t,c=P({logger:t.logger}),g=!0,d=`.tamagui.${g?"css":"js"}`},async resolveId(t){if(t==="tamagui.css")return await c.loadTamagui(i),b;const[r,s]=t.split("?");if(!r.endsWith(d))return;const e=t.startsWith(u.root)?t:p(r);if(o.has(e))return e+(s?`?${s}`:"")},load(t,r){const[s]=t.split("?");if(s===b)return c.getTamagui().getCSS();if(!o.has(s))return;const e=o.get(s);if(typeof e=="string")return g||!n||n.config.isProduction?e:_`
|
|
93
2
|
import { injectStyles } from '@tamagui/core/inject-styles';
|
|
94
3
|
|
|
95
4
|
const inject = (css) => injectStyles({
|
|
96
|
-
filePath: "${
|
|
5
|
+
filePath: "${s}",
|
|
97
6
|
css
|
|
98
7
|
});
|
|
99
8
|
|
|
100
|
-
inject(${JSON.stringify(
|
|
9
|
+
inject(${JSON.stringify(e)});
|
|
101
10
|
|
|
102
11
|
if (import.meta.hot) {
|
|
103
|
-
import.meta.hot.on('${
|
|
12
|
+
import.meta.hot.on('${S(s)}', (css) => {
|
|
104
13
|
inject(css);
|
|
105
14
|
});
|
|
106
15
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
async transform(code, id, ssrParam) {
|
|
110
|
-
const [validId] = id.split("?");
|
|
111
|
-
if (!validId.endsWith(".tsx")) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const firstCommentIndex = code.indexOf("// ");
|
|
115
|
-
const { shouldDisable, shouldPrintDebug } = getPragmaOptions({
|
|
116
|
-
source: firstCommentIndex >= 0 ? code.slice(firstCommentIndex) : "",
|
|
117
|
-
path: validId
|
|
118
|
-
});
|
|
119
|
-
if (shouldDisable) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const extracted = await extractToClassNames({
|
|
123
|
-
extractor,
|
|
124
|
-
source: code,
|
|
125
|
-
sourcePath: validId,
|
|
126
|
-
options,
|
|
127
|
-
shouldPrintDebug
|
|
128
|
-
});
|
|
129
|
-
if (!extracted) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const rootRelativeId = `${validId}${virtualExt}`;
|
|
133
|
-
const absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
|
|
134
|
-
let source = extracted.js;
|
|
135
|
-
if (extracted.styles) {
|
|
136
|
-
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== extracted.styles) {
|
|
137
|
-
const { moduleGraph } = server;
|
|
138
|
-
const [module] = Array.from(moduleGraph.getModulesByFile(absoluteId) || []);
|
|
139
|
-
if (module) {
|
|
140
|
-
moduleGraph.invalidateModule(module);
|
|
141
|
-
module.lastHMRTimestamp = module.lastInvalidationTimestamp || Date.now();
|
|
142
|
-
}
|
|
143
|
-
server.ws.send({
|
|
144
|
-
type: "custom",
|
|
145
|
-
event: styleUpdateEvent(absoluteId),
|
|
146
|
-
data: extracted.styles
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
source = `${source}
|
|
150
|
-
import "${rootRelativeId}";`;
|
|
151
|
-
cssMap.set(absoluteId, extracted.styles);
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
code: source.toString(),
|
|
155
|
-
map: extracted.map
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
export {
|
|
161
|
-
tamaguiExtractPlugin
|
|
162
|
-
};
|
|
16
|
+
`},async transform(t,r,s){const[e]=r.split("?");if(!e.endsWith(".tsx"))return;const y=t.indexOf("// "),{shouldDisable:I,shouldPrintDebug:T}=E({source:y>=0?t.slice(y):"",path:e});if(I)return;const a=await w({extractor:c,source:t,sourcePath:e,options:i,shouldPrintDebug:T});if(!a)return;const v=`${e}${d}`,l=p(v);let f=a.js;if(a.styles){if(n&&o.has(l)&&o.get(l)!==a.styles){const{moduleGraph:h}=n,[m]=Array.from(h.getModulesByFile(l)||[]);m&&(h.invalidateModule(m),m.lastHMRTimestamp=m.lastInvalidationTimestamp||Date.now()),n.ws.send({type:"custom",event:S(l),data:a.styles})}f=`${f}
|
|
17
|
+
import "${v}";`,o.set(l,a.styles)}return{code:f.toString(),map:a.map}}}}export{B as tamaguiExtractPlugin};
|
|
163
18
|
//# sourceMappingURL=extract.js.map
|