Skip to content

Commit

Permalink
chore: release v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Jan 7, 2024
1 parent 04abc3b commit b4d35e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 109 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.2.1

# Patches

- Remove `rs-module-lexer` using `es-module-lexer`.

## 0.2.0

# Features & Improves
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-stylex-dev",
"version": "0.2.0",
"version": "0.2.1",
"description": "an unofficial stylex vite plugin",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -67,8 +67,8 @@
"@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"
"es-module-lexer": "^1.4.1",
"magic-string": "^0.30.5"
},
"resolutions": {
"sharp": "0.32.6"
Expand Down
10 changes: 5 additions & 5 deletions src/patch-alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
// 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 { ImportSpecifier } from 'es-module-lexer'
import type { Alias, AliasOptions, Plugin } from 'vite'
import * as rsModuleLexer from 'rs-module-lexer'
import { init, parse } from 'es-module-lexer'
import type { RollupPluginContext } from './interface'

interface PatchAliasOptions {
Expand All @@ -27,15 +27,15 @@ function handleRelativePath(from: string, to: string) {
return relativePath
}

const { parseAsync } = ('default' in rsModuleLexer ? rsModuleLexer.default : rsModuleLexer) as { parseAsync: typeof _parseAsync }
// 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) : []
init.then()
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 [imports] = parse(code)
const withAliasPath: AliasPath[] = []
for (const stmt of imports) {
if (!stmt.n) continue
Expand Down
103 changes: 2 additions & 101 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3328,69 +3328,6 @@ __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"
Expand Down Expand Up @@ -5532,7 +5469,7 @@ __metadata:
languageName: node
linkType: hard

"es-module-lexer@npm:^1.3.1":
"es-module-lexer@npm:^1.3.1, es-module-lexer@npm:^1.4.1":
version: 1.4.1
resolution: "es-module-lexer@npm:1.4.1"
checksum: a11b5a256d4e8e9c7d94c2fd87415ccd1591617b6edd847e064503f8eaece2d25e2e9078a02c5ce3ed5e83bb748f5b4820efbe78072c8beb07ac619c2edec35d
Expand Down Expand Up @@ -11828,42 +11765,6 @@ __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"
Expand Down Expand Up @@ -13856,13 +13757,13 @@ __metadata:
"@typescript-eslint/utils": ^6.14.0
ava: ^5.3.1
c8: ^8.0.1
es-module-lexer: ^1.4.1
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
Expand Down

0 comments on commit b4d35e5

Please sign in to comment.