diff --git a/.gitignore b/.gitignore
index 22da892..6939821 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ temp
types
.tmpl
coverage
+.DS_Store
yarn-debug.log*
yarn-error.log*
diff --git a/__tests__/plugin.spec.ts b/__tests__/plugin.spec.ts
index 3facc56..7e39b90 100644
--- a/__tests__/plugin.spec.ts
+++ b/__tests__/plugin.spec.ts
@@ -55,8 +55,8 @@ async function mockBuild(taskName: string, opts: BuildOptions = {}) {
test('normal suit disable css minify', async (t) => {
const { css, js } = await mockBuild('normal', { vite: { build: { cssMinify: false } } })
await sleep()
- t.is(css, `.xju2f9n:not(#\\#){color:blue}
-.x1e2nbdu:not(#\\#){color:red}`)
+ t.is(css, `.xju2f9n{color:blue}
+.x1e2nbdu{color:red}`)
t.is(js, `import * as s from "@stylexjs/stylex";
const e = {
blue: {
@@ -78,7 +78,7 @@ export {
test('normal suite enable css minify', async (t) => {
const { css } = await mockBuild('normal')
await sleep()
- t.is(css, '.xju2f9n:not(#\\#){color:#00f}.x1e2nbdu:not(#\\#){color:red}\n')
+ t.is(css, '.xju2f9n{color:#00f}.x1e2nbdu{color:red}\n')
})
test('pxtorem suite should transform px to rem', async (t) => {
@@ -90,5 +90,5 @@ test('pxtorem suite should transform px to rem', async (t) => {
}
} })
await sleep()
- t.is(css, '.x1j61zf2:not(#\\#){font-size:1rem}\n')
+ t.is(css, '.x1j61zf2{font-size:1rem}\n')
})
diff --git a/e2e/e2e.spec.ts b/e2e/e2e.spec.ts
index b9026ea..5d2d6f2 100644
--- a/e2e/e2e.spec.ts
+++ b/e2e/e2e.spec.ts
@@ -92,3 +92,37 @@ test('fixture open-props', async (t) => {
}, [windowHandle, elementHandle])
t.is(blue, 'rgb(231, 245, 255)', 'tap button and text color should be blue')
})
+
+test('fixture tsconfig-paths', async (t) => {
+ const { page } = await createE2EServer('tsconfig-paths')
+ await page.waitForSelector('div[role="button"]')
+ const elementHandle = await page.$('div[role="button"]')
+ const windowHandle = await page.evaluateHandle(() => Promise.resolve(window))
+ const red = await page.evaluate(([window, el]) => {
+ return (window as Window).getComputedStyle(el as Element).color
+ }, [windowHandle, elementHandle])
+ t.is(red, 'rgb(255, 0, 0)', 'first load spa button text color should be red')
+ await elementHandle.click()
+ await new Promise((resolve) => setTimeout(resolve, 2000))
+ const blue = await page.evaluate(([window, el]) => {
+ return (window as Window).getComputedStyle(el as Element).color
+ }, [windowHandle, elementHandle])
+ t.is(blue, 'rgb(0, 0, 255)', 'tap button and text color should be blue')
+})
+
+test('fixture path-alias', async (t) => {
+ const { page } = await createE2EServer('path-alias')
+ await page.waitForSelector('div[role="button"]')
+ const elementHandle = await page.$('div[role="button"]')
+ const windowHandle = await page.evaluateHandle(() => Promise.resolve(window))
+ const red = await page.evaluate(([window, el]) => {
+ return (window as Window).getComputedStyle(el as Element).color
+ }, [windowHandle, elementHandle])
+ t.is(red, 'rgb(255, 0, 0)', 'first load spa button text color should be red')
+ await elementHandle.click()
+ await new Promise((resolve) => setTimeout(resolve, 2000))
+ const blue = await page.evaluate(([window, el]) => {
+ return (window as Window).getComputedStyle(el as Element).color
+ }, [windowHandle, elementHandle])
+ t.is(blue, 'rgb(0, 0, 255)', 'tap button and text color should be blue')
+})
diff --git a/e2e/fixtures/open-props/package.json b/e2e/fixtures/open-props/package.json
index ef6298a..17e67cf 100644
--- a/e2e/fixtures/open-props/package.json
+++ b/e2e/fixtures/open-props/package.json
@@ -1,5 +1,8 @@
{
"name": "vite-plugin-stylex-e2e-open-props",
+ "scripts": {
+ "dev": "vite"
+ },
"devDependencies": {
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
@@ -10,6 +13,6 @@
"vite-plugin-stylex-dev": "workspace:*"
},
"dependencies": {
- "@stylexjs/open-props": "^0.3.0"
+ "@stylexjs/open-props": "^0.4.1"
}
}
diff --git a/e2e/fixtures/path-alias/index.html b/e2e/fixtures/path-alias/index.html
new file mode 100644
index 0000000..5727caa
--- /dev/null
+++ b/e2e/fixtures/path-alias/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Document
+
+
+
+
+
+
\ No newline at end of file
diff --git a/e2e/fixtures/path-alias/package.json b/e2e/fixtures/path-alias/package.json
new file mode 100644
index 0000000..a68e01f
--- /dev/null
+++ b/e2e/fixtures/path-alias/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "vite-plugin-stylex-e2e-paths-alias",
+ "scripts": {
+ "dev": "vite",
+ "build": "vite build",
+ "preview": "vite preview"
+ },
+ "devDependencies": {
+ "@types/react": "^18.2.45",
+ "@types/react-dom": "^18.2.18",
+ "@vitejs/plugin-react": "^4.2.1",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0",
+ "vite": "^5.0.10",
+ "vite-plugin-stylex-dev": "workspace:*"
+ }
+}
diff --git a/e2e/fixtures/path-alias/src/app.tsx b/e2e/fixtures/path-alias/src/app.tsx
new file mode 100644
index 0000000..e724b2e
--- /dev/null
+++ b/e2e/fixtures/path-alias/src/app.tsx
@@ -0,0 +1,28 @@
+/* eslint-disable jsx-a11y/interactive-supports-focus */
+/* eslint-disable jsx-a11y/click-events-have-key-events */
+import * as stylex from '@stylexjs/stylex'
+import { useState } from 'react'
+
+const styles = stylex.create({
+ text: { fontSize: '20px', cursor: 'pointer' },
+ blue: {
+ color: 'blue'
+ },
+ red: {
+ color: 'red'
+ }
+})
+
+export function App() {
+ const [color, setColor] = useState('red')
+
+ const handleClick = () => {
+ setColor(pre => pre === 'red' ? 'blue' : 'red')
+ }
+
+ return (
+
+ )
+}
diff --git a/e2e/fixtures/path-alias/src/main.tsx b/e2e/fixtures/path-alias/src/main.tsx
new file mode 100644
index 0000000..1c2a3dd
--- /dev/null
+++ b/e2e/fixtures/path-alias/src/main.tsx
@@ -0,0 +1,9 @@
+import React from 'react'
+import ReactDOM from 'react-dom/client'
+import { App } from './app'
+
+ReactDOM.createRoot(document.querySelector('#app')!).render(
+
+
+
+)
diff --git a/e2e/fixtures/path-alias/tsconfig.json b/e2e/fixtures/path-alias/tsconfig.json
new file mode 100644
index 0000000..84cacb1
--- /dev/null
+++ b/e2e/fixtures/path-alias/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "baseUrl": ".",
+ "jsx": "react-jsx",
+ "esModuleInterop": true,
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "paths": {
+ "@/*": ["src/*"],
+ "~/*":["themes/*"]
+ }
+ }
+}
\ No newline at end of file
diff --git a/e2e/fixtures/path-alias/vite.config.mts b/e2e/fixtures/path-alias/vite.config.mts
new file mode 100644
index 0000000..c6a264f
--- /dev/null
+++ b/e2e/fixtures/path-alias/vite.config.mts
@@ -0,0 +1,13 @@
+import path from 'path'
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+import { stylexPlugin } from 'vite-plugin-stylex-dev'
+
+export default defineConfig({
+ resolve: {
+ alias: {
+ '@': path.join(__dirname, 'src')
+ }
+ },
+ plugins: [react(), stylexPlugin()]
+})
diff --git a/e2e/fixtures/tsconfig-paths/index.html b/e2e/fixtures/tsconfig-paths/index.html
new file mode 100644
index 0000000..5727caa
--- /dev/null
+++ b/e2e/fixtures/tsconfig-paths/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Document
+
+
+
+
+
+
\ No newline at end of file
diff --git a/e2e/fixtures/tsconfig-paths/package.json b/e2e/fixtures/tsconfig-paths/package.json
new file mode 100644
index 0000000..8557cd0
--- /dev/null
+++ b/e2e/fixtures/tsconfig-paths/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "vite-plugin-stylex-e2e-tsconfig-paths",
+ "scripts": {
+ "dev": "vite",
+ "build": "vite build",
+ "preview": "vite preview"
+ },
+ "devDependencies": {
+ "@types/react": "^18.2.45",
+ "@types/react-dom": "^18.2.18",
+ "@vitejs/plugin-react": "^4.2.1",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0",
+ "vite": "^5.0.10",
+ "vite-plugin-stylex-dev": "workspace:*",
+ "vite-tsconfig-paths": "^4.2.3"
+ }
+}
diff --git a/e2e/fixtures/tsconfig-paths/src/app.tsx b/e2e/fixtures/tsconfig-paths/src/app.tsx
new file mode 100644
index 0000000..e724b2e
--- /dev/null
+++ b/e2e/fixtures/tsconfig-paths/src/app.tsx
@@ -0,0 +1,28 @@
+/* eslint-disable jsx-a11y/interactive-supports-focus */
+/* eslint-disable jsx-a11y/click-events-have-key-events */
+import * as stylex from '@stylexjs/stylex'
+import { useState } from 'react'
+
+const styles = stylex.create({
+ text: { fontSize: '20px', cursor: 'pointer' },
+ blue: {
+ color: 'blue'
+ },
+ red: {
+ color: 'red'
+ }
+})
+
+export function App() {
+ const [color, setColor] = useState('red')
+
+ const handleClick = () => {
+ setColor(pre => pre === 'red' ? 'blue' : 'red')
+ }
+
+ return (
+
+ )
+}
diff --git a/e2e/fixtures/tsconfig-paths/src/main.tsx b/e2e/fixtures/tsconfig-paths/src/main.tsx
new file mode 100644
index 0000000..1c2a3dd
--- /dev/null
+++ b/e2e/fixtures/tsconfig-paths/src/main.tsx
@@ -0,0 +1,9 @@
+import React from 'react'
+import ReactDOM from 'react-dom/client'
+import { App } from './app'
+
+ReactDOM.createRoot(document.querySelector('#app')!).render(
+
+
+
+)
diff --git a/e2e/fixtures/tsconfig-paths/tsconfig.json b/e2e/fixtures/tsconfig-paths/tsconfig.json
new file mode 100644
index 0000000..84cacb1
--- /dev/null
+++ b/e2e/fixtures/tsconfig-paths/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "baseUrl": ".",
+ "jsx": "react-jsx",
+ "esModuleInterop": true,
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "paths": {
+ "@/*": ["src/*"],
+ "~/*":["themes/*"]
+ }
+ }
+}
\ No newline at end of file
diff --git a/e2e/fixtures/tsconfig-paths/vite.config.mts b/e2e/fixtures/tsconfig-paths/vite.config.mts
new file mode 100644
index 0000000..e58e4d2
--- /dev/null
+++ b/e2e/fixtures/tsconfig-paths/vite.config.mts
@@ -0,0 +1,9 @@
+// import path from 'path'
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+import tsconfigPaths from 'vite-tsconfig-paths'
+import { stylexPlugin } from 'vite-plugin-stylex-dev'
+
+export default defineConfig({
+ plugins: [tsconfigPaths({ root: __dirname }), react(), stylexPlugin()]
+})
diff --git a/e2e/fixtures/vue-ssr/server.ts b/e2e/fixtures/vue-ssr/server.ts
index dbe2051..26918b1 100644
--- a/e2e/fixtures/vue-ssr/server.ts
+++ b/e2e/fixtures/vue-ssr/server.ts
@@ -28,9 +28,9 @@ export async function createSSRServer(configFile = path.join(__dirname, 'vite.co
const port = genRandomPort()
app.listen(port)
const { page } = await createChromeBrowser(port)
- return { app, page }
+ return { app, page, port }
}
if (require.main === module) {
- createSSRServer()
+ createSSRServer().then(({ port }) => console.log(`server listen on: http://127.0.0.1:${port}`))
}
diff --git a/examples/nuxt-demo/components/btn2.vue b/examples/nuxt-demo/components/btn2.vue
index 52e78f0..7e5f653 100644
--- a/examples/nuxt-demo/components/btn2.vue
+++ b/examples/nuxt-demo/components/btn2.vue
@@ -8,7 +8,7 @@ import stylex from '@stylexjs/stylex'
const btns = stylex.create({
button: {
transition: '.150s all',
- border: '3px solid red',
+ border: '3px solid green',
backgroundColor: 'HotPink'
},
diff --git a/examples/qwik-demo/src/components/starter/hero/hero.tsx b/examples/qwik-demo/src/components/starter/hero/hero.tsx
index 20f27ef..7a70228 100644
--- a/examples/qwik-demo/src/components/starter/hero/hero.tsx
+++ b/examples/qwik-demo/src/components/starter/hero/hero.tsx
@@ -11,8 +11,8 @@ const s = stylex.create({
export default component$(() => {
return (
-
-
+
+
So
{' '}
fantastic
@@ -23,7 +23,7 @@ export default component$(() => {
{' '}
here
-
Have fun building your App with Qwik.
+
Have fun building your App with Qwik.
)
})
diff --git a/examples/qwik-demo/vite.config.ts b/examples/qwik-demo/vite.config.ts
index c3388d5..2e8a0b3 100644
--- a/examples/qwik-demo/vite.config.ts
+++ b/examples/qwik-demo/vite.config.ts
@@ -6,7 +6,7 @@ import { stylexPlugin } from 'vite-plugin-stylex-dev'
export default defineConfig(() => {
return {
- plugins: [qwikCity(), qwikVite(), tsconfigPaths(), stylexPlugin()],
+ plugins: [qwikCity(), qwikVite(), tsconfigPaths({ root: __dirname }), stylexPlugin()],
dev: {
headers: {
'Cache-Control': 'public, max-age=0'
diff --git a/examples/vite-demo/src/card.vue b/examples/vite-demo/src/card.vue
index 7b983b4..d22afaf 100644
--- a/examples/vite-demo/src/card.vue
+++ b/examples/vite-demo/src/card.vue
@@ -11,7 +11,8 @@ import * as stylex from '@stylexjs/stylex'
const styles = stylex.create({
card: {
border: '1px solid red',
- color: 'red'
+ color: 'red',
+ fontSize: '30px'
}
})
diff --git a/examples/vite-react-demo/package.json b/examples/vite-react-demo/package.json
index bb08594..59f5ecd 100644
--- a/examples/vite-react-demo/package.json
+++ b/examples/vite-react-demo/package.json
@@ -12,7 +12,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite": "^5.0.10",
- "vite-plugin-stylex-dev": "workspace:*"
+ "vite-plugin-stylex-dev": "workspace:*",
+ "vite-tsconfig-paths": "^4.2.3"
},
"dependencies": {
"@stylexjs/open-props": "^0.3.0"
diff --git a/examples/vite-react-demo/src/app.tsx b/examples/vite-react-demo/src/app.tsx
index a6ab11f..9949d63 100644
--- a/examples/vite-react-demo/src/app.tsx
+++ b/examples/vite-react-demo/src/app.tsx
@@ -1,15 +1,6 @@
-import * as stylex from '@stylexjs/stylex'
-
-import { colors } from '@stylexjs/open-props/lib/colors.stylex'
-
-const styles = stylex.create({
- base: {
- color: colors.gray0
- }
-})
+import Button from './button'
function App() {
- return
+ return
}
-
export { App }
diff --git a/examples/vite-react-demo/src/button.tsx b/examples/vite-react-demo/src/button.tsx
new file mode 100644
index 0000000..81f6442
--- /dev/null
+++ b/examples/vite-react-demo/src/button.tsx
@@ -0,0 +1,45 @@
+import * as stylex from '@stylexjs/stylex'
+import { ComponentProps } from 'react'
+import { colors } from '@/tokens.stylex'
+import { fonts } from '@/tokens/nested.stylex'
+import { others } from '~/other.stylex'
+
+type ButtonProps = {
+ variant?: 'primary',
+ children?: React.ReactNode,
+ styles?: stylex.StyleXStyles,
+} & ComponentProps<'button'>
+
+const baseStyle = {
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ color: colors.primary,
+ borderRadius: others.borderRadius,
+ cursor: 'pointer',
+ padding: '10px 15px',
+ fontSize: fonts.font
+}
+
+const s = stylex.create({
+ base: baseStyle,
+ primary: {
+ borderColor: {
+ default: colors.primary
+ },
+ color: {
+ default: colors.black
+ },
+ backgroundColor: {
+ default: colors.primary,
+ ':hover': colors.primaryDark,
+ ':focus': colors.primaryDark,
+ ':active': colors.primaryDark
+ }
+ }
+})
+
+const Button = ({ variant = 'primary', styles, ...props }: ButtonProps) => (
+
+)
+
+export default Button
diff --git a/examples/vite-react-demo/src/tokens.stylex.ts b/examples/vite-react-demo/src/tokens.stylex.ts
new file mode 100644
index 0000000..c8467fa
--- /dev/null
+++ b/examples/vite-react-demo/src/tokens.stylex.ts
@@ -0,0 +1,11 @@
+import * as stylex from '@stylexjs/stylex'
+
+const DARK = '@media (prefers-color-scheme: dark)'
+
+export const colors = stylex.defineVars({
+ primary: { default: '#fff', [DARK]: '#000' },
+ primaryDark: { default: '#ccc', [DARK]: '#333' },
+ bg: { default: '#fff', [DARK]: '#000' },
+ white: { default: '#fff', [DARK]: '#000' },
+ black: { default: '#000', [DARK]: '#fff' }
+})
diff --git a/examples/vite-react-demo/src/tokens/nested.stylex.ts b/examples/vite-react-demo/src/tokens/nested.stylex.ts
new file mode 100644
index 0000000..1df1272
--- /dev/null
+++ b/examples/vite-react-demo/src/tokens/nested.stylex.ts
@@ -0,0 +1,5 @@
+import * as stylex from '@stylexjs/stylex'
+
+export const fonts = stylex.defineVars({
+ font: '20px'
+})
diff --git a/examples/vite-react-demo/themes/other.stylex.ts b/examples/vite-react-demo/themes/other.stylex.ts
new file mode 100644
index 0000000..ad8eb69
--- /dev/null
+++ b/examples/vite-react-demo/themes/other.stylex.ts
@@ -0,0 +1,5 @@
+import * as stylex from '@stylexjs/stylex'
+
+export const others = stylex.defineVars({
+ borderRadius: '30px'
+})
diff --git a/examples/vite-react-demo/tsconfig.json b/examples/vite-react-demo/tsconfig.json
index 9ffc8b7..17ef365 100644
--- a/examples/vite-react-demo/tsconfig.json
+++ b/examples/vite-react-demo/tsconfig.json
@@ -1,6 +1,11 @@
{
"compilerOptions": {
+ "baseUrl": ".",
"jsx": "react-jsx",
"esModuleInterop": true,
+ "paths": {
+ "@/*": ["src/*"],
+ "~/*":["themes/*"]
+ }
}
}
\ No newline at end of file
diff --git a/examples/vite-react-demo/vite.config.ts b/examples/vite-react-demo/vite.config.ts
index 055024d..80662d6 100644
--- a/examples/vite-react-demo/vite.config.ts
+++ b/examples/vite-react-demo/vite.config.ts
@@ -1,7 +1,14 @@
+// import path from 'path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
+import tsconfigPaths from 'vite-tsconfig-paths'
import { stylexPlugin } from 'vite-plugin-stylex-dev'
export default defineConfig({
- plugins: [react(), stylexPlugin()]
+ // resolve: {
+ // alias: {
+ // '@': path.join(__dirname, 'src')
+ // }
+ // },
+ plugins: [tsconfigPaths({ root: __dirname }), react(), stylexPlugin()]
})
diff --git a/global.d.ts b/global.d.ts
deleted file mode 100644
index d8d67c3..0000000
--- a/global.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-declare module '@stylexjs/babel-plugin'{
- export type Rule = [string, { ltr: string; rtl?: null | string }, number]
- declare type StyleXTransformObj = Readonly<{
- (): PluginObj
- processStylexRules: typeof processStylexRules;
- }>
-
- declare const $$EXPORT_DEFAULT_DECLARATION$$: StyleXTransformObj
- export default $$EXPORT_DEFAULT_DECLARATION$$
-}
diff --git a/package.json b/package.json
index 333afe4..b88dc14 100644
--- a/package.json
+++ b/package.json
@@ -42,7 +42,7 @@
"author": "kanno",
"license": "MIT",
"devDependencies": {
- "@stylexjs/stylex": "0.3.0",
+ "@stylexjs/stylex": "^0.4.1",
"@types/babel__core": "^7.20.5",
"@types/connect": "^3.4.38",
"@types/node": "^20.10.4",
@@ -58,16 +58,17 @@
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"typescript": "^5.3.3",
- "vite": "^5.0.6",
+ "vite": "^5.0.10",
"vue-eslint-parser": "^9.3.2"
},
"dependencies": {
- "@babel/core": "^7.15.5",
- "@babel/plugin-syntax-flow": "^7.18.6",
- "@babel/plugin-syntax-jsx": "^7.14.5",
- "@babel/plugin-syntax-typescript": "^7.14.5",
- "@rollup/pluginutils": "^5.1.0",
- "@stylexjs/babel-plugin": "0.3.0"
+ "@babel/core": "^7.23.6",
+ "@babel/plugin-syntax-flow": "^7.23.3",
+ "@babel/plugin-syntax-jsx": "^7.23.3",
+ "@babel/plugin-syntax-typescript": "^7.23.3",
+ "@stylexjs/babel-plugin": "^0.4.1",
+ "magic-string": "^0.30.5",
+ "rs-module-lexer": "^2.1.1"
},
"resolutions": {
"sharp": "0.32.6"
diff --git a/src/index.ts b/src/index.ts
index 2ff8eca..eaa223d 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,64 +1,29 @@
import path from 'path'
+import { createFilter, searchForWorkspaceRoot } from 'vite'
import stylexBabelPlugin from '@stylexjs/babel-plugin'
import flowSyntaxPlugin from '@babel/plugin-syntax-flow'
import jsxSyntaxPlugin from '@babel/plugin-syntax-jsx'
import typescriptSyntaxPlugin from '@babel/plugin-syntax-typescript'
import type { NextHandleFunction } from 'connect'
-import type { PluginItem } from '@babel/core'
import * as babel from '@babel/core'
-import type { Plugin, ViteDevServer } from 'vite'
+import type { ModuleNode, Plugin, ViteDevServer } from 'vite'
import type { Rule } from '@stylexjs/babel-plugin'
-import type { FilterPattern } from '@rollup/pluginutils'
-import { createFilter } from '@rollup/pluginutils'
+import type { StylexPluginOptions, TransformStylexOptions } from './interface'
+import { createPatchAlias } from './patch-alias'
-interface UnstableModuleResolution {
- type: 'commonJS' | 'haste' | 'experimental_crossFileParsing',
- rootDir: string
-}
-
-interface BabelConfig {
- plugins: Array
- presets: Array
-}
-
-export interface StylexPluginOptions {
- useCSSLayers?: boolean,
- include?: FilterPattern
- exclude?: FilterPattern
- unstable_moduleResolution?: UnstableModuleResolution
- babelConfig?: BabelConfig
- stylexImports?: string[]
- [prop: string]: any
-}
-
-interface TransformWithStylexOptions extends Partial {
- isProduction?: boolean
- unstable_moduleResolution?: UnstableModuleResolution
- [prop: string]: any
-}
-
-function transformWithStylex(code: string, id: string, transformOptions: TransformWithStylexOptions = {}) {
- const { isProduction = false, presets = [], plugins = [], unstable_moduleResolution, ...options } = transformOptions
- const isJSX = path.extname(id) === '.jsx' || path.extname(id) === '.tsx'
+function transformStylex(code: string, id: string, transformOptions: TransformStylexOptions) {
+ const { presets, plugins, ...rest } = transformOptions
return babel.transformAsync(code, {
babelrc: false,
filename: id,
presets,
- plugins: [...plugins,
- /\.jsx?/.test(path.extname(id))
- ? flowSyntaxPlugin
- : typescriptSyntaxPlugin,
- isJSX && jsxSyntaxPlugin,
- [stylexBabelPlugin, { dev: !isProduction, unstable_moduleResolution, runtimeInjection: false, ...options }]
- ].filter(Boolean)
+ plugins: [...plugins, /\.jsx?/.test(path.extname(id))
+ ? flowSyntaxPlugin
+ : [typescriptSyntaxPlugin, { isTSX: true }],
+ jsxSyntaxPlugin, stylexBabelPlugin.withOptions({ ...rest, runtimeInjection: false })]
})
}
-// stylex provide a dev runtime AFAK.
-// But from a design principles. We won't need it. Only using virtual module is enough.
-// Judging from the previous experimental implementation of style9,It's worth to do it.
-
-// I don't understand why nuxt has to handle virtual module. so i had to change the name :(
const VIRTUAL_STYLEX_MODULE = '\0vite-plugin:stylex'
const VIRTUAL_STYLEX_CSS_MODULE = VIRTUAL_STYLEX_MODULE + '.css'
@@ -67,18 +32,61 @@ const VITE_INTERNAL_CSS_PLUGIN_NAMES = ['vite:css', 'vite:css-post']
const VITE_TRANSFORM_MIDDLEWARE_NAME = 'viteTransformMiddleware'
-function createSSRMiddleware(processStylexRules: () => string): NextHandleFunction {
+interface StylexDevMiddlewareOptions {
+ processer: () => string,
+ viteServer: ViteDevServer,
+ custom: boolean
+}
+
+function createStylexDevMiddleware(options: StylexDevMiddlewareOptions): NextHandleFunction {
+ const { processer, viteServer, custom } = options
+
+ const handleModule = (module: ModuleNode, pathName: string, accept = '') => {
+ const isAssets = accept.includes('text/css')
+ const paths = pathName.split('/')
+ paths.pop()
+ let base = ''
+ const filter = paths.filter(p => !['@id', '@fs'].includes(p))
+ base = filter.join('/')
+ if (!base) base = '/'
+ let code = ''
+ if (isAssets) {
+ code = processer()
+ } else {
+ if (custom) {
+ code = [
+ `import {createHotContext as __vite__createHotContext} from ${JSON.stringify(path.posix.join(base, '@vite/client'))};`,
+ 'import.meta.hot = __vite__createHotContext("/@id/__x00__vite-plugin:stylex.css");',
+ `import {updateStyle as __vite__updateStyle,removeStyle as __vite__removeStyle} from ${JSON.stringify(path.posix.join(base, '@vite/client'))};`,
+ 'const __vite__id = "\u0000vite-plugin:stylex.css"',
+ `const __vite__css = ${JSON.stringify(processer())}`,
+ '__vite__updateStyle(__vite__id, __vite__css)',
+ 'import.meta.hot.accept()',
+ 'import.meta.hot.prune(() => __vite__removeStyle(__vite__id))'
+ ].join('\n')
+ } else {
+ code = module.transformResult?.code
+ }
+ }
+ return {
+ code,
+ isAssets
+ }
+ }
+
return function stylexDevMiddleware(req, res, next) {
- const protocol = 'encrypted' in req.connection ? 'https' : 'http'
+ const protocol = 'encrypted' in req.socket ? 'https' : 'http'
const { host } = req.headers
const url = new URL(req.originalUrl, `${protocol}://${host}`)
- // Check style sheet is registered.
- if (url.pathname.endsWith('.css') && url.pathname.includes('vite-plugin:stylex')) {
- res.setHeader('Content-Type', 'text/css')
- res.end(processStylexRules())
- return
+ if (url.pathname.includes('vite-plugin:stylex')) {
+ const module = viteServer.moduleGraph.getModuleById(VIRTUAL_STYLEX_CSS_MODULE)
+ const { code, isAssets } = handleModule(module, url.pathname, req.headers?.accept ?? '')
+ res.setHeader('Content-Type', isAssets ? 'text/css' : 'application/javascript')
+ res.setHeader('x-powered-by', 'vite-plugin-stylex-dev')
+ res.end(code)
+ } else {
+ next()
}
- next()
}
}
@@ -91,13 +99,11 @@ function patchOptmizeDepsExcludeId(id: string) {
return id
}
-// TODO
export function stylexPlugin(opts: StylexPluginOptions = {}): Plugin {
const {
useCSSLayers = false,
- unstable_moduleResolution = { type: 'commonJS', rootDir: process.cwd() },
babelConfig: { plugins = [], presets = [] } = {},
- stylexImports = ['stylex', '@stylexjs/stylex'],
+ importSources = ['stylex', '@stylexjs/stylex'],
include = /\.(mjs|js|ts|vue|jsx|tsx)(\?.*|)$/,
exclude,
...options
@@ -105,6 +111,8 @@ export function stylexPlugin(opts: StylexPluginOptions = {}): Plugin {
const filter = createFilter(include, exclude)
let stylexRules: Record = {}
let isProd = false
+ // I think custom render in most of time is ssr so that we should disable stylex runtime inejct.
+ let isCustomRender = false
let viteServer: ViteDevServer | null = null
const viteCSSPlugins: Plugin[] = []
const processStylexRules = () => {
@@ -113,6 +121,8 @@ export function stylexPlugin(opts: StylexPluginOptions = {}): Plugin {
return stylexBabelPlugin.processStylexRules(rules, useCSSLayers)
}
+ let patchAlias: ReturnType
+
return {
name: 'vite-plugin-stylex',
buildStart() {
@@ -131,27 +141,36 @@ export function stylexPlugin(opts: StylexPluginOptions = {}): Plugin {
// Make sure the insert order
// Reset the order of the middlewares
return () => {
- if (viteServer.config.appType === 'custom' || viteServer.config.server.middlewareMode) {
- const stylexDevMiddleware = createSSRMiddleware(processStylexRules)
- viteServer.middlewares.use(stylexDevMiddleware)
- const order = viteServer.middlewares.stack.findIndex(m => {
- if (typeof m.handle === 'function') return m.handle.name === VITE_TRANSFORM_MIDDLEWARE_NAME
- return -1
- })
- const middleware = viteServer.middlewares.stack.pop()
- if (order !== -1) {
- viteServer.middlewares.stack.splice(order + 1, 0, middleware)
- }
- }
+ // I think the middleware won't be only at ssr or custom render
+ // It should be a normally middleware in development mode.
+ // Hijack the request and do hmr.
+ const stylexDevMiddleware = createStylexDevMiddleware({
+ processer: processStylexRules,
+ viteServer,
+ custom: isCustomRender
+ })
+ viteServer.middlewares.use(stylexDevMiddleware)
+ const order = viteServer.middlewares.stack.findIndex(m => {
+ if (typeof m.handle === 'function') return m.handle.name === VITE_TRANSFORM_MIDDLEWARE_NAME
+ return -1
+ })
+ const middleware = viteServer.middlewares.stack.pop()
+ viteServer.middlewares.stack.splice(order, 0, middleware)
}
},
configResolved(conf) {
+ if (!options.unstable_moduleResolution) {
+ options.unstable_moduleResolution = { type: 'commonJS', rootDir: searchForWorkspaceRoot(conf.root) }
+ }
isProd = conf.mode === 'production' || conf.env.mode === 'production'
+ isCustomRender = conf.appType === 'custom' || conf.server.middlewareMode
if (!isProd) {
- conf.optimizeDeps.exclude = ['@stylexjs/open-props']
+ conf.optimizeDeps.exclude = [...(conf.optimizeDeps.exclude ?? []), '@stylexjs/open-props']
}
viteCSSPlugins.push(...conf.plugins.filter(p => VITE_INTERNAL_CSS_PLUGIN_NAMES.includes(p.name)))
viteCSSPlugins.sort((a, b) => a.name === 'vite:css' && b.name === 'vite:css-post' ? -1 : 1)
+ const tsconfigPaths = conf.plugins.find(p => p.name === 'vite-tsconfig-paths')
+ patchAlias = createPatchAlias(conf.resolve.alias, { tsconfigPaths })
},
load(id) {
if (id === VIRTUAL_STYLEX_CSS_MODULE) {
@@ -163,10 +182,14 @@ export function stylexPlugin(opts: StylexPluginOptions = {}): Plugin {
},
async transform(inputCode, id) {
if (!filter(id)) return
- if (!stylexImports.some((importName) => inputCode.includes(importName))) return
- // TODO
+ if (id.startsWith('\0') || id.includes('virtaul:nuxt')) return
+ if (!importSources.some((stmt) => inputCode.includes(typeof stmt === 'string' ? stmt : stmt.from))) return
+ // TODO for some reason stylex only process filename that contains `xx.style.ext` but vite will process all
+ // of chunks in development mode. So we need hack it.
id = patchOptmizeDepsExcludeId(id)
- const result = await transformWithStylex(inputCode, id, { isProduction: isProd, presets, plugins, unstable_moduleResolution, ...options })
+ inputCode = await patchAlias(inputCode, id, this)
+
+ const result = await transformStylex(inputCode, id, { dev: isCustomRender ? false : !isProd, plugins, presets, ...options })
if (!result) return
if ('stylex' in result.metadata) {
const rules = result.metadata.stylex as Rule[]
@@ -204,3 +227,5 @@ export function stylexPlugin(opts: StylexPluginOptions = {}): Plugin {
}
}
}
+
+export { StylexPluginOptions }
diff --git a/src/interface.ts b/src/interface.ts
new file mode 100644
index 0000000..d203875
--- /dev/null
+++ b/src/interface.ts
@@ -0,0 +1,24 @@
+import type { FilterPattern, HookHandler, Plugin } from 'vite'
+import type { Options } from '@stylexjs/babel-plugin'
+import type { PluginItem } from '@babel/core'
+
+export type InternalOptions = Omit
+
+export interface StylexPluginOptions extends Partial {
+ babelConfig?: {
+ plugins?: Array
+ presets?: Array
+ },
+ useCSSLayers?: boolean,
+ include?: FilterPattern
+ exclude?: FilterPattern
+ [prop: string]: unknown
+}
+
+export type TransformStylexOptions = Partial & {
+ plugins: Array
+ presets: Array
+ dev: boolean
+}
+
+export type RollupPluginContext = ThisParameterType>
diff --git a/src/patch-alias.ts b/src/patch-alias.ts
new file mode 100644
index 0000000..e8c602c
--- /dev/null
+++ b/src/patch-alias.ts
@@ -0,0 +1,76 @@
+// Notice this file is a temporary solution for stylex
+// Stylex work support alias in future.
+// This patch does not change vite's behavior
+// It's should also work well with tsconfPaths plugin
+// https://github.com/facebook/stylex/issues/40
+
+// eg:
+// import { kind } from '@/x.stylex'
+// convert:
+// import { kind } from './x.stylex'
+import path from 'path'
+import MagicString from 'magic-string'
+import type { ImportSpecifier, parseAsync as _parseAsync } from 'rs-module-lexer'
+import type { Alias, AliasOptions, Plugin } from 'vite'
+import * as rsModuleLexer from 'rs-module-lexer'
+import type { RollupPluginContext } from './interface'
+
+interface PatchAliasOptions {
+ tsconfigPaths?: Plugin,
+}
+
+type AliasPath = ImportSpecifier & { relative: string }
+
+function handleRelativePath(from: string, to: string) {
+ let relativePath = path.relative(path.dirname(from), to).replace(/\.\w+$/, '')
+ relativePath = `./${relativePath}`
+ return relativePath
+}
+
+const { parseAsync } = ('default' in rsModuleLexer ? rsModuleLexer.default : rsModuleLexer) as { parseAsync: typeof _parseAsync }
+
+export function createPatchAlias(alias: AliasOptions & Alias[], opts: PatchAliasOptions) {
+ const relativeReg = /^\.\.?(\/|$)/
+ const finds = Array.isArray(alias) ? alias.map((a) => a.find) : []
+ return async (code: string, id: string, rollupContext: RollupPluginContext) => {
+ const str = new MagicString(code)
+ const { output } = await parseAsync({ input: [{ filename: id, code }] })
+ const { imports } = output[0]
+ const withAliasPath: AliasPath[] = []
+ for (const stmt of imports) {
+ if (!stmt.n) continue
+ if (stmt.d > -1) continue
+ if (path.isAbsolute(stmt.n) || relativeReg.test(stmt.n)) continue
+
+ if (opts.tsconfigPaths) {
+ const fn = opts.tsconfigPaths.resolveId as Function
+ if (stmt.n.includes('stylex')) {
+ const result = await fn.call(rollupContext, stmt.n, id)
+ if (result) {
+ const relativePath = handleRelativePath(id, result)
+ if (!relativePath.includes('node_modules')) {
+ withAliasPath.push({ ...stmt, relative: relativePath })
+ }
+ }
+ }
+ } else {
+ if (!finds.some(f => {
+ if (typeof f === 'string') return stmt.n.includes(f)
+ return f.test(stmt.n)
+ })) continue
+ const resolved = await rollupContext.resolve(stmt.n)
+ if (resolved && resolved.id) {
+ const relativePath = handleRelativePath(id, resolved.id)
+ if (!relativePath.includes('node_modules')) {
+ withAliasPath.push({ ...stmt, relative: relativePath })
+ }
+ }
+ }
+ }
+ withAliasPath.forEach((stmt) => {
+ const { s, e, relative } = stmt
+ str.update(s, e, relative)
+ })
+ return str.toString()
+ }
+}
diff --git a/tsup.config.ts b/tsup.config.ts
index 0ca46a8..0c50cce 100644
--- a/tsup.config.ts
+++ b/tsup.config.ts
@@ -8,5 +8,5 @@ export const tsup: Options = {
clean: true,
shims: false,
minify: true,
- external: ['@rollup/pluginutils']
+ external: ['@rollup/pluginutils', 'vite']
}
diff --git a/yarn.lock b/yarn.lock
index 390a32e..28011e1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -46,7 +46,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/core@npm:^7.15.5, @babel/core@npm:^7.20.7, @babel/core@npm:^7.21.8, @babel/core@npm:^7.22.9, @babel/core@npm:^7.23.0, @babel/core@npm:^7.23.3, @babel/core@npm:^7.23.5":
+"@babel/core@npm:^7.20.7, @babel/core@npm:^7.21.8, @babel/core@npm:^7.22.9, @babel/core@npm:^7.23.0, @babel/core@npm:^7.23.3, @babel/core@npm:^7.23.5":
version: 7.23.6
resolution: "@babel/core@npm:7.23.6"
dependencies:
@@ -69,6 +69,29 @@ __metadata:
languageName: node
linkType: hard
+"@babel/core@npm:^7.23.6":
+ version: 7.23.7
+ resolution: "@babel/core@npm:7.23.7"
+ dependencies:
+ "@ampproject/remapping": ^2.2.0
+ "@babel/code-frame": ^7.23.5
+ "@babel/generator": ^7.23.6
+ "@babel/helper-compilation-targets": ^7.23.6
+ "@babel/helper-module-transforms": ^7.23.3
+ "@babel/helpers": ^7.23.7
+ "@babel/parser": ^7.23.6
+ "@babel/template": ^7.22.15
+ "@babel/traverse": ^7.23.7
+ "@babel/types": ^7.23.6
+ convert-source-map: ^2.0.0
+ debug: ^4.1.0
+ gensync: ^1.0.0-beta.2
+ json5: ^2.2.3
+ semver: ^6.3.1
+ checksum: 32d5bf73372a47429afaae9adb0af39e47bcea6a831c4b5dcbb4791380cda6949cb8cb1a2fea8b60bb1ebe189209c80e333903df1fa8e9dcb04798c0ce5bf59e
+ languageName: node
+ linkType: hard
+
"@babel/generator@npm:^7.21.5, @babel/generator@npm:^7.23.6":
version: 7.23.6
resolution: "@babel/generator@npm:7.23.6"
@@ -269,6 +292,17 @@ __metadata:
languageName: node
linkType: hard
+"@babel/helpers@npm:^7.23.7":
+ version: 7.23.7
+ resolution: "@babel/helpers@npm:7.23.7"
+ dependencies:
+ "@babel/template": ^7.22.15
+ "@babel/traverse": ^7.23.7
+ "@babel/types": ^7.23.6
+ checksum: 4f3bdf35fb54ff79107c6020ba1e36a38213a15b05ca0fa06c553b65f566e185fba6339fb3344be04593ebc244ed0bbb0c6087e73effe0d053a30bcd2db3a013
+ languageName: node
+ linkType: hard
+
"@babel/highlight@npm:^7.23.4":
version: 7.23.4
resolution: "@babel/highlight@npm:7.23.4"
@@ -316,7 +350,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/plugin-syntax-flow@npm:^7.18.6":
+"@babel/plugin-syntax-flow@npm:^7.23.3":
version: 7.23.3
resolution: "@babel/plugin-syntax-flow@npm:7.23.3"
dependencies:
@@ -349,7 +383,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/plugin-syntax-jsx@npm:^7.14.5, @babel/plugin-syntax-jsx@npm:^7.21.4, @babel/plugin-syntax-jsx@npm:^7.22.5, @babel/plugin-syntax-jsx@npm:^7.23.3":
+"@babel/plugin-syntax-jsx@npm:^7.21.4, @babel/plugin-syntax-jsx@npm:^7.22.5, @babel/plugin-syntax-jsx@npm:^7.23.3":
version: 7.23.3
resolution: "@babel/plugin-syntax-jsx@npm:7.23.3"
dependencies:
@@ -360,7 +394,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/plugin-syntax-typescript@npm:^7.14.5, @babel/plugin-syntax-typescript@npm:^7.20.0, @babel/plugin-syntax-typescript@npm:^7.23.3":
+"@babel/plugin-syntax-typescript@npm:^7.20.0, @babel/plugin-syntax-typescript@npm:^7.23.3":
version: 7.23.3
resolution: "@babel/plugin-syntax-typescript@npm:7.23.3"
dependencies:
@@ -462,7 +496,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/traverse@npm:^7.0.0-0, @babel/traverse@npm:^7.22.5, @babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.23.6":
+"@babel/traverse@npm:^7.22.5, @babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.23.6":
version: 7.23.6
resolution: "@babel/traverse@npm:7.23.6"
dependencies:
@@ -480,7 +514,25 @@ __metadata:
languageName: node
linkType: hard
-"@babel/types@npm:^7.0.0, @babel/types@npm:^7.15.6, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3, @babel/types@npm:^7.23.5, @babel/types@npm:^7.23.6, @babel/types@npm:^7.8.3":
+"@babel/traverse@npm:^7.23.7":
+ version: 7.23.7
+ resolution: "@babel/traverse@npm:7.23.7"
+ dependencies:
+ "@babel/code-frame": ^7.23.5
+ "@babel/generator": ^7.23.6
+ "@babel/helper-environment-visitor": ^7.22.20
+ "@babel/helper-function-name": ^7.23.0
+ "@babel/helper-hoist-variables": ^7.22.5
+ "@babel/helper-split-export-declaration": ^7.22.6
+ "@babel/parser": ^7.23.6
+ "@babel/types": ^7.23.6
+ debug: ^4.3.1
+ globals: ^11.1.0
+ checksum: d4a7afb922361f710efc97b1e25ec343fab8b2a4ddc81ca84f9a153f22d4482112cba8f263774be8d297918b6c4767c7a98988ab4e53ac73686c986711dd002e
+ languageName: node
+ linkType: hard
+
+"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3, @babel/types@npm:^7.23.5, @babel/types@npm:^7.23.6, @babel/types@npm:^7.8.3":
version: 7.23.6
resolution: "@babel/types@npm:7.23.6"
dependencies:
@@ -2341,16 +2393,17 @@ __metadata:
languageName: node
linkType: hard
-"@stylexjs/babel-plugin@npm:0.3.0":
- version: 0.3.0
- resolution: "@stylexjs/babel-plugin@npm:0.3.0"
+"@stylexjs/babel-plugin@npm:^0.4.1":
+ version: 0.4.1
+ resolution: "@stylexjs/babel-plugin@npm:0.4.1"
dependencies:
- "@stylexjs/shared": 0.3.0
- peerDependencies:
- "@babel/core": ^7.19.6
- "@babel/traverse": ^7.0.0-0
- "@babel/types": ^7.15.6
- checksum: 8aefcbf884a8bbcdad8227beeeafff648960d9b8cce9105bdbd5103071dab0ba870728a1a5b23deec2bead370ce1294ed8aa5e15da2082cbd7992e87b4a7e28d
+ "@babel/core": ^7.23.6
+ "@babel/helper-module-imports": ^7.22.15
+ "@babel/traverse": ^7.23.6
+ "@babel/types": ^7.23.6
+ "@stylexjs/shared": 0.4.1
+ "@stylexjs/stylex": 0.4.1
+ checksum: 035f80f274cfe526143c1d7b38cf410abc183ee26febe39964e5af3fe4ac4104d16dc8d4b959c2085e66f0f9504477d092d784ccc8292234cf39bd6add18d0a4
languageName: node
linkType: hard
@@ -2366,16 +2419,40 @@ __metadata:
languageName: node
linkType: hard
-"@stylexjs/shared@npm:0.3.0":
- version: 0.3.0
- resolution: "@stylexjs/shared@npm:0.3.0"
+"@stylexjs/open-props@npm:^0.4.1":
+ version: 0.4.1
+ resolution: "@stylexjs/open-props@npm:0.4.1"
+ dependencies:
+ css-mediaquery: ^0.1.2
+ invariant: ^2.2.4
+ styleq: 0.1.3
+ utility-types: ^3.10.0
+ checksum: b88b06c09d08fe41e5aff405727d8acee2688330c18ab0160bd82a10c8ef80d2bdb0edc8717ce99c82b65e001ddd4048ff735f1af3cd0c430343615e9605381d
+ languageName: node
+ linkType: hard
+
+"@stylexjs/shared@npm:0.4.1":
+ version: 0.4.1
+ resolution: "@stylexjs/shared@npm:0.4.1"
dependencies:
postcss-value-parser: ^4.1.0
- checksum: 630ea0db807bbf135451cd3867f3975d47003eab8a88a38b42186a8ababda00660f48c880bf019560455be855301a69f6814a18befa345b9b527841103adaf51
+ checksum: 3013cca0cd6c0c022f052530c7dfbe21da2b006fca71b1ac8391c989d908f5c31c76720fb73dc1e1103efbd130344bbe6d5b06d2fde5628585d9558bc7b6a12b
+ languageName: node
+ linkType: hard
+
+"@stylexjs/stylex@npm:0.4.1, @stylexjs/stylex@npm:^0.4.1":
+ version: 0.4.1
+ resolution: "@stylexjs/stylex@npm:0.4.1"
+ dependencies:
+ css-mediaquery: ^0.1.2
+ invariant: ^2.2.4
+ styleq: 0.1.3
+ utility-types: ^3.10.0
+ checksum: d46b79425e75323ab9446979f29578378ff0d4992d136fd7f3bf5f6741e71bf6abee933777da13622dc6cc198e0b04d54b97baa335f5f9675d440dc64ed57897
languageName: node
linkType: hard
-"@stylexjs/stylex@npm:0.3.0, @stylexjs/stylex@npm:^0.3.0":
+"@stylexjs/stylex@npm:^0.3.0":
version: 0.3.0
resolution: "@stylexjs/stylex@npm:0.3.0"
dependencies:
@@ -3251,6 +3328,69 @@ __metadata:
languageName: node
linkType: hard
+"@xn-sakina/rml-darwin-arm64@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-darwin-arm64@npm:2.1.1"
+ conditions: os=darwin & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@xn-sakina/rml-darwin-x64@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-darwin-x64@npm:2.1.1"
+ conditions: os=darwin & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@xn-sakina/rml-linux-arm-gnueabihf@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-linux-arm-gnueabihf@npm:2.1.1"
+ conditions: os=linux & cpu=arm
+ languageName: node
+ linkType: hard
+
+"@xn-sakina/rml-linux-arm64-gnu@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-linux-arm64-gnu@npm:2.1.1"
+ conditions: os=linux & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@xn-sakina/rml-linux-arm64-musl@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-linux-arm64-musl@npm:2.1.1"
+ conditions: os=linux & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@xn-sakina/rml-linux-x64-gnu@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-linux-x64-gnu@npm:2.1.1"
+ conditions: os=linux & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@xn-sakina/rml-linux-x64-musl@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-linux-x64-musl@npm:2.1.1"
+ conditions: os=linux & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@xn-sakina/rml-win32-arm64-msvc@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-win32-arm64-msvc@npm:2.1.1"
+ conditions: os=win32 & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@xn-sakina/rml-win32-x64-msvc@npm:2.1.1":
+ version: 2.1.1
+ resolution: "@xn-sakina/rml-win32-x64-msvc@npm:2.1.1"
+ conditions: os=win32 & cpu=x64
+ languageName: node
+ linkType: hard
+
"@zxing/text-encoding@npm:0.9.0":
version: 0.9.0
resolution: "@zxing/text-encoding@npm:0.9.0"
@@ -11688,6 +11828,42 @@ __metadata:
languageName: node
linkType: hard
+"rs-module-lexer@npm:^2.1.1":
+ version: 2.1.1
+ resolution: "rs-module-lexer@npm:2.1.1"
+ dependencies:
+ "@xn-sakina/rml-darwin-arm64": 2.1.1
+ "@xn-sakina/rml-darwin-x64": 2.1.1
+ "@xn-sakina/rml-linux-arm-gnueabihf": 2.1.1
+ "@xn-sakina/rml-linux-arm64-gnu": 2.1.1
+ "@xn-sakina/rml-linux-arm64-musl": 2.1.1
+ "@xn-sakina/rml-linux-x64-gnu": 2.1.1
+ "@xn-sakina/rml-linux-x64-musl": 2.1.1
+ "@xn-sakina/rml-win32-arm64-msvc": 2.1.1
+ "@xn-sakina/rml-win32-x64-msvc": 2.1.1
+ dependenciesMeta:
+ "@xn-sakina/rml-darwin-arm64":
+ optional: true
+ "@xn-sakina/rml-darwin-x64":
+ optional: true
+ "@xn-sakina/rml-linux-arm-gnueabihf":
+ optional: true
+ "@xn-sakina/rml-linux-arm64-gnu":
+ optional: true
+ "@xn-sakina/rml-linux-arm64-musl":
+ optional: true
+ "@xn-sakina/rml-linux-x64-gnu":
+ optional: true
+ "@xn-sakina/rml-linux-x64-musl":
+ optional: true
+ "@xn-sakina/rml-win32-arm64-msvc":
+ optional: true
+ "@xn-sakina/rml-win32-x64-msvc":
+ optional: true
+ checksum: e203c3db6642b58765d1b275b588c3f0b7b8ebadca62f7bd610bfbff2772a17b5303699343c886cda0f3fd6606de74b459d596c3debeb3f192fc2c2919f647a2
+ languageName: node
+ linkType: hard
+
"run-applescript@npm:^5.0.0":
version: 5.0.0
resolution: "run-applescript@npm:5.0.0"
@@ -13667,13 +13843,12 @@ __metadata:
version: 0.0.0-use.local
resolution: "vite-plugin-stylex-dev@workspace:."
dependencies:
- "@babel/core": ^7.15.5
- "@babel/plugin-syntax-flow": ^7.18.6
- "@babel/plugin-syntax-jsx": ^7.14.5
- "@babel/plugin-syntax-typescript": ^7.14.5
- "@rollup/pluginutils": ^5.1.0
- "@stylexjs/babel-plugin": 0.3.0
- "@stylexjs/stylex": 0.3.0
+ "@babel/core": ^7.23.6
+ "@babel/plugin-syntax-flow": ^7.23.3
+ "@babel/plugin-syntax-jsx": ^7.23.3
+ "@babel/plugin-syntax-typescript": ^7.23.3
+ "@stylexjs/babel-plugin": ^0.4.1
+ "@stylexjs/stylex": ^0.4.1
"@types/babel__core": ^7.20.5
"@types/connect": ^3.4.38
"@types/node": ^20.10.4
@@ -13684,12 +13859,14 @@ __metadata:
eslint: ^8.55.0
eslint-config-kagura: ^2.1.1
eslint-plugin-vue: ^9.19.2
+ magic-string: ^0.30.5
playwright: ~1.32.3
postcss-pxtorem: ^6.0.0
+ rs-module-lexer: ^2.1.1
tsup: ^8.0.1
tsx: ^4.6.2
typescript: ^5.3.3
- vite: ^5.0.6
+ vite: ^5.0.10
vue-eslint-parser: ^9.3.2
languageName: unknown
linkType: soft
@@ -13698,7 +13875,21 @@ __metadata:
version: 0.0.0-use.local
resolution: "vite-plugin-stylex-e2e-open-props@workspace:e2e/fixtures/open-props"
dependencies:
- "@stylexjs/open-props": ^0.3.0
+ "@stylexjs/open-props": ^0.4.1
+ "@types/react": ^18.2.45
+ "@types/react-dom": ^18.2.18
+ "@vitejs/plugin-react": ^4.2.1
+ react: ^18.2.0
+ react-dom: ^18.2.0
+ vite: ^5.0.10
+ vite-plugin-stylex-dev: "workspace:*"
+ languageName: unknown
+ linkType: soft
+
+"vite-plugin-stylex-e2e-paths-alias@workspace:e2e/fixtures/path-alias":
+ version: 0.0.0-use.local
+ resolution: "vite-plugin-stylex-e2e-paths-alias@workspace:e2e/fixtures/path-alias"
+ dependencies:
"@types/react": ^18.2.45
"@types/react-dom": ^18.2.18
"@vitejs/plugin-react": ^4.2.1
@@ -13753,6 +13944,21 @@ __metadata:
languageName: unknown
linkType: soft
+"vite-plugin-stylex-e2e-tsconfig-paths@workspace:e2e/fixtures/tsconfig-paths":
+ version: 0.0.0-use.local
+ resolution: "vite-plugin-stylex-e2e-tsconfig-paths@workspace:e2e/fixtures/tsconfig-paths"
+ dependencies:
+ "@types/react": ^18.2.45
+ "@types/react-dom": ^18.2.18
+ "@vitejs/plugin-react": ^4.2.1
+ react: ^18.2.0
+ react-dom: ^18.2.0
+ vite: ^5.0.10
+ vite-plugin-stylex-dev: "workspace:*"
+ vite-tsconfig-paths: ^4.2.3
+ languageName: unknown
+ linkType: soft
+
"vite-plugin-stylex-e2e-vue-ssr@workspace:e2e/fixtures/vue-ssr":
version: 0.0.0-use.local
resolution: "vite-plugin-stylex-e2e-vue-ssr@workspace:e2e/fixtures/vue-ssr"
@@ -13798,6 +14004,7 @@ __metadata:
react-dom: ^18.2.0
vite: ^5.0.10
vite-plugin-stylex-dev: "workspace:*"
+ vite-tsconfig-paths: ^4.2.3
languageName: unknown
linkType: soft
@@ -13817,6 +14024,22 @@ __metadata:
languageName: node
linkType: hard
+"vite-tsconfig-paths@npm:^4.2.3":
+ version: 4.2.3
+ resolution: "vite-tsconfig-paths@npm:4.2.3"
+ dependencies:
+ debug: ^4.1.1
+ globrex: ^0.1.2
+ tsconfck: ^2.1.0
+ peerDependencies:
+ vite: "*"
+ peerDependenciesMeta:
+ vite:
+ optional: true
+ checksum: d8a837eded390ea03c56eb97c8e35fbb8a1073c97e3c8119adab5e8c8a3f8b6dc610c5a9236c6dc3f778ea1650e72d7f5a39b82df20feec0e546f23feac74b8e
+ languageName: node
+ linkType: hard
+
"vite@npm:^3.0.0 || ^4.0.0, vite@npm:^4.1.4, vite@npm:^4.5.0":
version: 4.5.1
resolution: "vite@npm:4.5.1"