@tamagui/vite-plugin 1.0.1-beta.78 → 1.0.1-beta.81
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/plugin.js +62 -3
- package/dist/cjs/plugin.js.map +2 -2
- package/dist/esm/plugin.js +61 -2
- package/dist/esm/plugin.js.map +2 -2
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/index.js.map +7 -0
- package/dist/jsx/plugin.js +62 -2
- package/dist/jsx/plugin.js.map +7 -0
- package/package.json +5 -3
- package/src/plugin.ts +65 -1
- package/types/plugin.d.ts +3 -1
- package/types/plugin.d.ts.map +1 -1
package/dist/cjs/plugin.js
CHANGED
|
@@ -17,12 +17,71 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var plugin_exports = {};
|
|
19
19
|
__export(plugin_exports, {
|
|
20
|
-
|
|
20
|
+
tamaguiPlugin: () => tamaguiPlugin
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(plugin_exports);
|
|
23
|
-
|
|
23
|
+
function tamaguiPlugin(options) {
|
|
24
|
+
return {
|
|
25
|
+
name: "tamagui",
|
|
26
|
+
enforce: "pre",
|
|
27
|
+
config(userConfig, env) {
|
|
28
|
+
return {
|
|
29
|
+
esbuild: {
|
|
30
|
+
loader: "tsx"
|
|
31
|
+
},
|
|
32
|
+
define: {
|
|
33
|
+
global: {},
|
|
34
|
+
_frameTimestamp: void 0,
|
|
35
|
+
_WORKLET: false,
|
|
36
|
+
process: {
|
|
37
|
+
env: {
|
|
38
|
+
TAMAGUI_TARGET: process.env.TAMAGUI_TARGET || "web",
|
|
39
|
+
NODE_ENV: process.env.NODE_ENV || env.mode
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
optimizeDeps: {
|
|
44
|
+
esbuildOptions: {
|
|
45
|
+
resolveExtensions: [
|
|
46
|
+
".web.js",
|
|
47
|
+
".web.ts",
|
|
48
|
+
".web.tsx",
|
|
49
|
+
".js",
|
|
50
|
+
".jsx",
|
|
51
|
+
".json",
|
|
52
|
+
".ts",
|
|
53
|
+
".tsx",
|
|
54
|
+
".mjs"
|
|
55
|
+
],
|
|
56
|
+
loader: {
|
|
57
|
+
".js": "jsx"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
resolve: {
|
|
62
|
+
extensions: [
|
|
63
|
+
".web.js",
|
|
64
|
+
".web.ts",
|
|
65
|
+
".web.tsx",
|
|
66
|
+
".js",
|
|
67
|
+
".jsx",
|
|
68
|
+
".json",
|
|
69
|
+
".ts",
|
|
70
|
+
".tsx",
|
|
71
|
+
".mjs"
|
|
72
|
+
],
|
|
73
|
+
alias: {
|
|
74
|
+
"react-native/Libraries/Renderer/shims/ReactFabric": "@tamagui/proxy-worm",
|
|
75
|
+
"react-native/Libraries/Utilities/codegenNativeComponent": "@tamagui/proxy-worm",
|
|
76
|
+
"react-native": "react-native-web"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
24
83
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25
84
|
0 && (module.exports = {
|
|
26
|
-
|
|
85
|
+
tamaguiPlugin
|
|
27
86
|
});
|
|
28
87
|
//# sourceMappingURL=plugin.js.map
|
package/dist/cjs/plugin.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugin.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import type { TamaguiOptions } from '@tamagui/static'\nimport type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'\n\nexport function tamaguiPlugin(options?: TamaguiOptions): Plugin {\n return {\n name: 'tamagui',\n enforce: 'pre',\n\n config(userConfig, env) {\n return {\n esbuild: {\n loader: 'tsx',\n },\n define: {\n global: {},\n _frameTimestamp: undefined,\n _WORKLET: false,\n process: {\n env: {\n TAMAGUI_TARGET: process.env.TAMAGUI_TARGET || 'web',\n NODE_ENV: process.env.NODE_ENV || env.mode,\n },\n },\n },\n optimizeDeps: {\n esbuildOptions: {\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 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': '@tamagui/proxy-worm',\n 'react-native': 'react-native-web',\n },\n },\n }\n },\n }\n}\n\n// fork from https://github.com/seek-oss/vanilla-extract/blob/master/packages/vite-plugin/src/index.ts\n\n// import path from 'path'\n\n// import outdent from 'outdent'\n// import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'\n// import { normalizePath } from 'vite'\n\n// const styleUpdateEvent = (fileId: string) => `tamagui-style-update:${fileId}`\n\n// interface Options {\n// identifiers?: IdentifierOption\n// esbuildOptions?: CompileOptions['esbuildOptions']\n// }\n// export function vanillaExtractPlugin({ identifiers, esbuildOptions }: Options = {}): Plugin {\n// let config: ResolvedConfig\n// let server: ViteDevServer\n// let postCssConfig: PostCSSConfigResult | null\n// const cssMap = new Map<string, string>()\n\n// let virtualExt: string\n// let packageName: string\n\n// const getAbsoluteVirtualFileId = (source: string) => normalizePath(path.join(config.root, source))\n\n// return {\n// name: 'tamagui',\n// enforce: 'pre',\n// configureServer(_server) {\n// server = _server\n// },\n// config(_userConfig, env) {\n// const include = env.command === 'serve' ? ['@tamagui/css/injectStyles'] : []\n\n// return {\n// optimizeDeps: { include },\n// ssr: {\n// external: ['@tamagui/css', '@tamagui/css/fileScope', '@tamagui/css/adapter'],\n// },\n// }\n// },\n// async configResolved(resolvedConfig) {\n// config = resolvedConfig\n// packageName = getPackageInfo(config.root).name\n\n// if (config.command === 'serve') {\n// postCssConfig = await resolvePostcssConfig(config)\n// }\n\n// virtualExt = `.vanilla.${config.command === 'serve' ? 'js' : 'css'}`\n// },\n// resolveId(source) {\n// if (!source.endsWith(virtualExt)) {\n// return\n// }\n\n// // Absolute paths seem to occur often in monorepos, where files are\n// // imported from outside the config root.\n// const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(source)\n\n// // There should always be an entry in the `cssMap` here.\n// // The only valid scenario for a missing one is if someone had written\n// // a file in their app using the .vanilla.js/.vanilla.css extension\n// if (cssMap.has(absoluteId)) {\n// return absoluteId\n// }\n// },\n// load(id) {\n// if (!cssMap.has(id)) {\n// return\n// }\n\n// const css = cssMap.get(id)\n\n// if (typeof css !== 'string') {\n// return\n// }\n\n// if (!server || server.config.isProduction) {\n// return css\n// }\n\n// return outdent`\n// import { injectStyles } from '@tamagui/css/injectStyles';\n\n// const inject = (css) => injectStyles({\n// fileScope: ${JSON.stringify({ filePath: id })},\n// css\n// });\n\n// inject(${JSON.stringify(css)});\n\n// import.meta.hot.on('${styleUpdateEvent(id)}', (css) => {\n// inject(css);\n// });\n// `\n// },\n// async transform(code, id, ssrParam) {\n// if (!cssFileFilter.test(id)) {\n// return null\n// }\n\n// let ssr: boolean | undefined\n\n// if (typeof ssrParam === 'boolean') {\n// ssr = ssrParam\n// } else {\n// ssr = ssrParam?.ssr\n// }\n\n// const index = id.indexOf('?')\n// const validId = index === -1 ? id : id.substring(0, index)\n\n// if (ssr) {\n// return addFileScope({\n// source: code,\n// filePath: normalizePath(validId),\n// rootPath: config.root,\n// packageName,\n// })\n// }\n\n// const { source, watchFiles } = await compile({\n// filePath: validId,\n// cwd: config.root,\n// esbuildOptions,\n// })\n\n// for (const file of watchFiles) {\n// // In start mode, we need to prevent the file from rewatching itself.\n// // If it's a `build --watch`, it needs to watch everything.\n// if (config.command === 'build' || file !== id) {\n// this.addWatchFile(file)\n// }\n// }\n\n// const output = await processVanillaFile({\n// source,\n// filePath: validId,\n// identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),\n// serializeVirtualCssPath: async ({ fileScope, source }) => {\n// const rootRelativeId = `${fileScope.filePath}${virtualExt}`\n// const absoluteId = getAbsoluteVirtualFileId(rootRelativeId)\n\n// let cssSource = source\n\n// if (postCssConfig) {\n// const postCssResult = await (await import('postcss'))\n// .default(postCssConfig.plugins)\n// .process(source, {\n// ...postCssConfig.options,\n// from: undefined,\n// map: false,\n// })\n\n// cssSource = postCssResult.css\n// }\n\n// if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== source) {\n// const { moduleGraph } = server\n// const module = moduleGraph.getModuleById(absoluteId)\n\n// if (module) {\n// moduleGraph.invalidateModule(module)\n// }\n\n// server.ws.send({\n// type: 'custom',\n// event: styleUpdateEvent(absoluteId),\n// data: cssSource,\n// })\n// }\n\n// cssMap.set(absoluteId, cssSource)\n\n// // We use the root relative id here to ensure file contents (content-hashes)\n// // are consistent across build machines\n// return `import \"${rootRelativeId}\";`\n// },\n// })\n\n// return {\n// code: output,\n// map: { mappings: '' },\n// }\n// },\n// }\n// }\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,uBAAuB,SAAkC;AAC9D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IAET,OAAO,YAAY,KAAK;AACtB,aAAO;AAAA,QACL,SAAS;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,QACA,QAAQ;AAAA,UACN,QAAQ,CAAC;AAAA,UACT,iBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,SAAS;AAAA,YACP,KAAK;AAAA,cACH,gBAAgB,QAAQ,IAAI,kBAAkB;AAAA,cAC9C,UAAU,QAAQ,IAAI,YAAY,IAAI;AAAA,YACxC;AAAA,UACF;AAAA,QACF;AAAA,QACA,cAAc;AAAA,UACZ,gBAAgB;AAAA,YACd,mBAAmB;AAAA,cACjB;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,YACA,QAAQ;AAAA,cACN,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP,YAAY;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO;AAAA,YACL,qDAAqD;AAAA,YACrD,2DAA2D;AAAA,YAC3D,gBAAgB;AAAA,UAClB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
function tamaguiPlugin(options) {
|
|
2
|
+
return {
|
|
3
|
+
name: "tamagui",
|
|
4
|
+
enforce: "pre",
|
|
5
|
+
config(userConfig, env) {
|
|
6
|
+
return {
|
|
7
|
+
esbuild: {
|
|
8
|
+
loader: "tsx"
|
|
9
|
+
},
|
|
10
|
+
define: {
|
|
11
|
+
global: {},
|
|
12
|
+
_frameTimestamp: void 0,
|
|
13
|
+
_WORKLET: false,
|
|
14
|
+
process: {
|
|
15
|
+
env: {
|
|
16
|
+
TAMAGUI_TARGET: process.env.TAMAGUI_TARGET || "web",
|
|
17
|
+
NODE_ENV: process.env.NODE_ENV || env.mode
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
optimizeDeps: {
|
|
22
|
+
esbuildOptions: {
|
|
23
|
+
resolveExtensions: [
|
|
24
|
+
".web.js",
|
|
25
|
+
".web.ts",
|
|
26
|
+
".web.tsx",
|
|
27
|
+
".js",
|
|
28
|
+
".jsx",
|
|
29
|
+
".json",
|
|
30
|
+
".ts",
|
|
31
|
+
".tsx",
|
|
32
|
+
".mjs"
|
|
33
|
+
],
|
|
34
|
+
loader: {
|
|
35
|
+
".js": "jsx"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
resolve: {
|
|
40
|
+
extensions: [
|
|
41
|
+
".web.js",
|
|
42
|
+
".web.ts",
|
|
43
|
+
".web.tsx",
|
|
44
|
+
".js",
|
|
45
|
+
".jsx",
|
|
46
|
+
".json",
|
|
47
|
+
".ts",
|
|
48
|
+
".tsx",
|
|
49
|
+
".mjs"
|
|
50
|
+
],
|
|
51
|
+
alias: {
|
|
52
|
+
"react-native/Libraries/Renderer/shims/ReactFabric": "@tamagui/proxy-worm",
|
|
53
|
+
"react-native/Libraries/Utilities/codegenNativeComponent": "@tamagui/proxy-worm",
|
|
54
|
+
"react-native": "react-native-web"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
2
61
|
export {
|
|
3
|
-
|
|
62
|
+
tamaguiPlugin
|
|
4
63
|
};
|
|
5
64
|
//# sourceMappingURL=plugin.js.map
|
package/dist/esm/plugin.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugin.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { TamaguiOptions } from '@tamagui/static'\nimport type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'\n\nexport function tamaguiPlugin(options?: TamaguiOptions): Plugin {\n return {\n name: 'tamagui',\n enforce: 'pre',\n\n config(userConfig, env) {\n return {\n esbuild: {\n loader: 'tsx',\n },\n define: {\n global: {},\n _frameTimestamp: undefined,\n _WORKLET: false,\n process: {\n env: {\n TAMAGUI_TARGET: process.env.TAMAGUI_TARGET || 'web',\n NODE_ENV: process.env.NODE_ENV || env.mode,\n },\n },\n },\n optimizeDeps: {\n esbuildOptions: {\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 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': '@tamagui/proxy-worm',\n 'react-native': 'react-native-web',\n },\n },\n }\n },\n }\n}\n\n// fork from https://github.com/seek-oss/vanilla-extract/blob/master/packages/vite-plugin/src/index.ts\n\n// import path from 'path'\n\n// import outdent from 'outdent'\n// import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'\n// import { normalizePath } from 'vite'\n\n// const styleUpdateEvent = (fileId: string) => `tamagui-style-update:${fileId}`\n\n// interface Options {\n// identifiers?: IdentifierOption\n// esbuildOptions?: CompileOptions['esbuildOptions']\n// }\n// export function vanillaExtractPlugin({ identifiers, esbuildOptions }: Options = {}): Plugin {\n// let config: ResolvedConfig\n// let server: ViteDevServer\n// let postCssConfig: PostCSSConfigResult | null\n// const cssMap = new Map<string, string>()\n\n// let virtualExt: string\n// let packageName: string\n\n// const getAbsoluteVirtualFileId = (source: string) => normalizePath(path.join(config.root, source))\n\n// return {\n// name: 'tamagui',\n// enforce: 'pre',\n// configureServer(_server) {\n// server = _server\n// },\n// config(_userConfig, env) {\n// const include = env.command === 'serve' ? ['@tamagui/css/injectStyles'] : []\n\n// return {\n// optimizeDeps: { include },\n// ssr: {\n// external: ['@tamagui/css', '@tamagui/css/fileScope', '@tamagui/css/adapter'],\n// },\n// }\n// },\n// async configResolved(resolvedConfig) {\n// config = resolvedConfig\n// packageName = getPackageInfo(config.root).name\n\n// if (config.command === 'serve') {\n// postCssConfig = await resolvePostcssConfig(config)\n// }\n\n// virtualExt = `.vanilla.${config.command === 'serve' ? 'js' : 'css'}`\n// },\n// resolveId(source) {\n// if (!source.endsWith(virtualExt)) {\n// return\n// }\n\n// // Absolute paths seem to occur often in monorepos, where files are\n// // imported from outside the config root.\n// const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(source)\n\n// // There should always be an entry in the `cssMap` here.\n// // The only valid scenario for a missing one is if someone had written\n// // a file in their app using the .vanilla.js/.vanilla.css extension\n// if (cssMap.has(absoluteId)) {\n// return absoluteId\n// }\n// },\n// load(id) {\n// if (!cssMap.has(id)) {\n// return\n// }\n\n// const css = cssMap.get(id)\n\n// if (typeof css !== 'string') {\n// return\n// }\n\n// if (!server || server.config.isProduction) {\n// return css\n// }\n\n// return outdent`\n// import { injectStyles } from '@tamagui/css/injectStyles';\n\n// const inject = (css) => injectStyles({\n// fileScope: ${JSON.stringify({ filePath: id })},\n// css\n// });\n\n// inject(${JSON.stringify(css)});\n\n// import.meta.hot.on('${styleUpdateEvent(id)}', (css) => {\n// inject(css);\n// });\n// `\n// },\n// async transform(code, id, ssrParam) {\n// if (!cssFileFilter.test(id)) {\n// return null\n// }\n\n// let ssr: boolean | undefined\n\n// if (typeof ssrParam === 'boolean') {\n// ssr = ssrParam\n// } else {\n// ssr = ssrParam?.ssr\n// }\n\n// const index = id.indexOf('?')\n// const validId = index === -1 ? id : id.substring(0, index)\n\n// if (ssr) {\n// return addFileScope({\n// source: code,\n// filePath: normalizePath(validId),\n// rootPath: config.root,\n// packageName,\n// })\n// }\n\n// const { source, watchFiles } = await compile({\n// filePath: validId,\n// cwd: config.root,\n// esbuildOptions,\n// })\n\n// for (const file of watchFiles) {\n// // In start mode, we need to prevent the file from rewatching itself.\n// // If it's a `build --watch`, it needs to watch everything.\n// if (config.command === 'build' || file !== id) {\n// this.addWatchFile(file)\n// }\n// }\n\n// const output = await processVanillaFile({\n// source,\n// filePath: validId,\n// identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),\n// serializeVirtualCssPath: async ({ fileScope, source }) => {\n// const rootRelativeId = `${fileScope.filePath}${virtualExt}`\n// const absoluteId = getAbsoluteVirtualFileId(rootRelativeId)\n\n// let cssSource = source\n\n// if (postCssConfig) {\n// const postCssResult = await (await import('postcss'))\n// .default(postCssConfig.plugins)\n// .process(source, {\n// ...postCssConfig.options,\n// from: undefined,\n// map: false,\n// })\n\n// cssSource = postCssResult.css\n// }\n\n// if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== source) {\n// const { moduleGraph } = server\n// const module = moduleGraph.getModuleById(absoluteId)\n\n// if (module) {\n// moduleGraph.invalidateModule(module)\n// }\n\n// server.ws.send({\n// type: 'custom',\n// event: styleUpdateEvent(absoluteId),\n// data: cssSource,\n// })\n// }\n\n// cssMap.set(absoluteId, cssSource)\n\n// // We use the root relative id here to ensure file contents (content-hashes)\n// // are consistent across build machines\n// return `import \"${rootRelativeId}\";`\n// },\n// })\n\n// return {\n// code: output,\n// map: { mappings: '' },\n// }\n// },\n// }\n// }\n"],
|
|
5
|
+
"mappings": "AAGO,uBAAuB,SAAkC;AAC9D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IAET,OAAO,YAAY,KAAK;AACtB,aAAO;AAAA,QACL,SAAS;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,QACA,QAAQ;AAAA,UACN,QAAQ,CAAC;AAAA,UACT,iBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,SAAS;AAAA,YACP,KAAK;AAAA,cACH,gBAAgB,QAAQ,IAAI,kBAAkB;AAAA,cAC9C,UAAU,QAAQ,IAAI,YAAY,IAAI;AAAA,YACxC;AAAA,UACF;AAAA,QACF;AAAA,QACA,cAAc;AAAA,UACZ,gBAAgB;AAAA,YACd,mBAAmB;AAAA,cACjB;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,YACA,QAAQ;AAAA,cACN,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP,YAAY;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO;AAAA,YACL,qDAAqD;AAAA,YACrD,2DAA2D;AAAA,YAC3D,gBAAgB;AAAA,UAClB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/index.js
CHANGED
package/dist/jsx/plugin.js
CHANGED
|
@@ -1,4 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
function tamaguiPlugin(options) {
|
|
2
|
+
return {
|
|
3
|
+
name: "tamagui",
|
|
4
|
+
enforce: "pre",
|
|
5
|
+
config(userConfig, env) {
|
|
6
|
+
return {
|
|
7
|
+
esbuild: {
|
|
8
|
+
loader: "tsx"
|
|
9
|
+
},
|
|
10
|
+
define: {
|
|
11
|
+
global: {},
|
|
12
|
+
_frameTimestamp: void 0,
|
|
13
|
+
_WORKLET: false,
|
|
14
|
+
process: {
|
|
15
|
+
env: {
|
|
16
|
+
TAMAGUI_TARGET: process.env.TAMAGUI_TARGET || "web",
|
|
17
|
+
NODE_ENV: process.env.NODE_ENV || env.mode
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
optimizeDeps: {
|
|
22
|
+
esbuildOptions: {
|
|
23
|
+
resolveExtensions: [
|
|
24
|
+
".web.js",
|
|
25
|
+
".web.ts",
|
|
26
|
+
".web.tsx",
|
|
27
|
+
".js",
|
|
28
|
+
".jsx",
|
|
29
|
+
".json",
|
|
30
|
+
".ts",
|
|
31
|
+
".tsx",
|
|
32
|
+
".mjs"
|
|
33
|
+
],
|
|
34
|
+
loader: {
|
|
35
|
+
".js": "jsx"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
resolve: {
|
|
40
|
+
extensions: [
|
|
41
|
+
".web.js",
|
|
42
|
+
".web.ts",
|
|
43
|
+
".web.tsx",
|
|
44
|
+
".js",
|
|
45
|
+
".jsx",
|
|
46
|
+
".json",
|
|
47
|
+
".ts",
|
|
48
|
+
".tsx",
|
|
49
|
+
".mjs"
|
|
50
|
+
],
|
|
51
|
+
alias: {
|
|
52
|
+
"react-native/Libraries/Renderer/shims/ReactFabric": "@tamagui/proxy-worm",
|
|
53
|
+
"react-native/Libraries/Utilities/codegenNativeComponent": "@tamagui/proxy-worm",
|
|
54
|
+
"react-native": "react-native-web"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
2
61
|
export {
|
|
3
|
-
|
|
62
|
+
tamaguiPlugin
|
|
4
63
|
};
|
|
64
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/plugin.ts"],
|
|
4
|
+
"sourcesContent": ["import type { TamaguiOptions } from '@tamagui/static'\nimport type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'\n\nexport function tamaguiPlugin(options?: TamaguiOptions): Plugin {\n return {\n name: 'tamagui',\n enforce: 'pre',\n\n config(userConfig, env) {\n return {\n esbuild: {\n loader: 'tsx',\n },\n define: {\n global: {},\n _frameTimestamp: undefined,\n _WORKLET: false,\n process: {\n env: {\n TAMAGUI_TARGET: process.env.TAMAGUI_TARGET || 'web',\n NODE_ENV: process.env.NODE_ENV || env.mode,\n },\n },\n },\n optimizeDeps: {\n esbuildOptions: {\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 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': '@tamagui/proxy-worm',\n 'react-native': 'react-native-web',\n },\n },\n }\n },\n }\n}\n\n// fork from https://github.com/seek-oss/vanilla-extract/blob/master/packages/vite-plugin/src/index.ts\n\n// import path from 'path'\n\n// import outdent from 'outdent'\n// import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'\n// import { normalizePath } from 'vite'\n\n// const styleUpdateEvent = (fileId: string) => `tamagui-style-update:${fileId}`\n\n// interface Options {\n// identifiers?: IdentifierOption\n// esbuildOptions?: CompileOptions['esbuildOptions']\n// }\n// export function vanillaExtractPlugin({ identifiers, esbuildOptions }: Options = {}): Plugin {\n// let config: ResolvedConfig\n// let server: ViteDevServer\n// let postCssConfig: PostCSSConfigResult | null\n// const cssMap = new Map<string, string>()\n\n// let virtualExt: string\n// let packageName: string\n\n// const getAbsoluteVirtualFileId = (source: string) => normalizePath(path.join(config.root, source))\n\n// return {\n// name: 'tamagui',\n// enforce: 'pre',\n// configureServer(_server) {\n// server = _server\n// },\n// config(_userConfig, env) {\n// const include = env.command === 'serve' ? ['@tamagui/css/injectStyles'] : []\n\n// return {\n// optimizeDeps: { include },\n// ssr: {\n// external: ['@tamagui/css', '@tamagui/css/fileScope', '@tamagui/css/adapter'],\n// },\n// }\n// },\n// async configResolved(resolvedConfig) {\n// config = resolvedConfig\n// packageName = getPackageInfo(config.root).name\n\n// if (config.command === 'serve') {\n// postCssConfig = await resolvePostcssConfig(config)\n// }\n\n// virtualExt = `.vanilla.${config.command === 'serve' ? 'js' : 'css'}`\n// },\n// resolveId(source) {\n// if (!source.endsWith(virtualExt)) {\n// return\n// }\n\n// // Absolute paths seem to occur often in monorepos, where files are\n// // imported from outside the config root.\n// const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(source)\n\n// // There should always be an entry in the `cssMap` here.\n// // The only valid scenario for a missing one is if someone had written\n// // a file in their app using the .vanilla.js/.vanilla.css extension\n// if (cssMap.has(absoluteId)) {\n// return absoluteId\n// }\n// },\n// load(id) {\n// if (!cssMap.has(id)) {\n// return\n// }\n\n// const css = cssMap.get(id)\n\n// if (typeof css !== 'string') {\n// return\n// }\n\n// if (!server || server.config.isProduction) {\n// return css\n// }\n\n// return outdent`\n// import { injectStyles } from '@tamagui/css/injectStyles';\n\n// const inject = (css) => injectStyles({\n// fileScope: ${JSON.stringify({ filePath: id })},\n// css\n// });\n\n// inject(${JSON.stringify(css)});\n\n// import.meta.hot.on('${styleUpdateEvent(id)}', (css) => {\n// inject(css);\n// });\n// `\n// },\n// async transform(code, id, ssrParam) {\n// if (!cssFileFilter.test(id)) {\n// return null\n// }\n\n// let ssr: boolean | undefined\n\n// if (typeof ssrParam === 'boolean') {\n// ssr = ssrParam\n// } else {\n// ssr = ssrParam?.ssr\n// }\n\n// const index = id.indexOf('?')\n// const validId = index === -1 ? id : id.substring(0, index)\n\n// if (ssr) {\n// return addFileScope({\n// source: code,\n// filePath: normalizePath(validId),\n// rootPath: config.root,\n// packageName,\n// })\n// }\n\n// const { source, watchFiles } = await compile({\n// filePath: validId,\n// cwd: config.root,\n// esbuildOptions,\n// })\n\n// for (const file of watchFiles) {\n// // In start mode, we need to prevent the file from rewatching itself.\n// // If it's a `build --watch`, it needs to watch everything.\n// if (config.command === 'build' || file !== id) {\n// this.addWatchFile(file)\n// }\n// }\n\n// const output = await processVanillaFile({\n// source,\n// filePath: validId,\n// identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),\n// serializeVirtualCssPath: async ({ fileScope, source }) => {\n// const rootRelativeId = `${fileScope.filePath}${virtualExt}`\n// const absoluteId = getAbsoluteVirtualFileId(rootRelativeId)\n\n// let cssSource = source\n\n// if (postCssConfig) {\n// const postCssResult = await (await import('postcss'))\n// .default(postCssConfig.plugins)\n// .process(source, {\n// ...postCssConfig.options,\n// from: undefined,\n// map: false,\n// })\n\n// cssSource = postCssResult.css\n// }\n\n// if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== source) {\n// const { moduleGraph } = server\n// const module = moduleGraph.getModuleById(absoluteId)\n\n// if (module) {\n// moduleGraph.invalidateModule(module)\n// }\n\n// server.ws.send({\n// type: 'custom',\n// event: styleUpdateEvent(absoluteId),\n// data: cssSource,\n// })\n// }\n\n// cssMap.set(absoluteId, cssSource)\n\n// // We use the root relative id here to ensure file contents (content-hashes)\n// // are consistent across build machines\n// return `import \"${rootRelativeId}\";`\n// },\n// })\n\n// return {\n// code: output,\n// map: { mappings: '' },\n// }\n// },\n// }\n// }\n"],
|
|
5
|
+
"mappings": "AAGO,uBAAuB,SAAkC;AAC9D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IAET,OAAO,YAAY,KAAK;AACtB,aAAO;AAAA,QACL,SAAS;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,QACA,QAAQ;AAAA,UACN,QAAQ,CAAC;AAAA,UACT,iBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,SAAS;AAAA,YACP,KAAK;AAAA,cACH,gBAAgB,QAAQ,IAAI,kBAAkB;AAAA,cAC9C,UAAU,QAAQ,IAAI,YAAY,IAAI;AAAA,YACxC;AAAA,UACF;AAAA,QACF;AAAA,QACA,cAAc;AAAA,UACZ,gBAAgB;AAAA,YACd,mBAAmB;AAAA,cACjB;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,YACA,QAAQ;AAAA,cACN,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP,YAAY;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO;AAAA,YACL,qDAAqD;AAAA,YACrD,2DAA2D;AAAA,YAC3D,gBAAgB;AAAA,UAClB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/vite-plugin",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.81",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tamagui/
|
|
21
|
+
"@tamagui/core-node": "^1.0.1-beta.81",
|
|
22
|
+
"@tamagui/proxy-worm": "^1.0.1-beta.81",
|
|
23
|
+
"@tamagui/static": "^1.0.1-beta.81",
|
|
22
24
|
"fs-extra": "^10.1.0",
|
|
23
25
|
"lodash": "^4.17.21"
|
|
24
26
|
},
|
|
25
27
|
"devDependencies": {
|
|
26
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
28
|
+
"@tamagui/build": "^1.0.1-beta.81"
|
|
27
29
|
},
|
|
28
30
|
"publishConfig": {
|
|
29
31
|
"access": "public"
|
package/src/plugin.ts
CHANGED
|
@@ -1,4 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TamaguiOptions } from '@tamagui/static'
|
|
2
|
+
import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'
|
|
3
|
+
|
|
4
|
+
export function tamaguiPlugin(options?: TamaguiOptions): Plugin {
|
|
5
|
+
return {
|
|
6
|
+
name: 'tamagui',
|
|
7
|
+
enforce: 'pre',
|
|
8
|
+
|
|
9
|
+
config(userConfig, env) {
|
|
10
|
+
return {
|
|
11
|
+
esbuild: {
|
|
12
|
+
loader: 'tsx',
|
|
13
|
+
},
|
|
14
|
+
define: {
|
|
15
|
+
global: {},
|
|
16
|
+
_frameTimestamp: undefined,
|
|
17
|
+
_WORKLET: false,
|
|
18
|
+
process: {
|
|
19
|
+
env: {
|
|
20
|
+
TAMAGUI_TARGET: process.env.TAMAGUI_TARGET || 'web',
|
|
21
|
+
NODE_ENV: process.env.NODE_ENV || env.mode,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
optimizeDeps: {
|
|
26
|
+
esbuildOptions: {
|
|
27
|
+
resolveExtensions: [
|
|
28
|
+
'.web.js',
|
|
29
|
+
'.web.ts',
|
|
30
|
+
'.web.tsx',
|
|
31
|
+
'.js',
|
|
32
|
+
'.jsx',
|
|
33
|
+
'.json',
|
|
34
|
+
'.ts',
|
|
35
|
+
'.tsx',
|
|
36
|
+
'.mjs',
|
|
37
|
+
],
|
|
38
|
+
loader: {
|
|
39
|
+
'.js': 'jsx',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
resolve: {
|
|
44
|
+
extensions: [
|
|
45
|
+
'.web.js',
|
|
46
|
+
'.web.ts',
|
|
47
|
+
'.web.tsx',
|
|
48
|
+
'.js',
|
|
49
|
+
'.jsx',
|
|
50
|
+
'.json',
|
|
51
|
+
'.ts',
|
|
52
|
+
'.tsx',
|
|
53
|
+
'.mjs',
|
|
54
|
+
],
|
|
55
|
+
alias: {
|
|
56
|
+
'react-native/Libraries/Renderer/shims/ReactFabric': '@tamagui/proxy-worm',
|
|
57
|
+
'react-native/Libraries/Utilities/codegenNativeComponent': '@tamagui/proxy-worm',
|
|
58
|
+
'react-native': 'react-native-web',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
2
66
|
// fork from https://github.com/seek-oss/vanilla-extract/blob/master/packages/vite-plugin/src/index.ts
|
|
3
67
|
|
|
4
68
|
// import path from 'path'
|
package/types/plugin.d.ts
CHANGED
package/types/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAA;AAEjE,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CA4D9D"}
|