Skip to content

Commit

Permalink
feat: upgrade jsr info (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
eryue0220 authored Mar 6, 2024
1 parent 2a332a9 commit 69aef20
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eryue0220/unplugin-stylex",
"version": "0.2.3",
"version": "0.2.4",
"exports": {
"./index": "./src/index.ts",
"./esbuild": "./src/esbuild.ts",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unplugin-stylex",
"version": "0.2.3",
"version": "0.2.4",
"packageManager": "pnpm@8.11.0",
"description": "Unplugin for stylex",
"repository": "https://github.com/eryue0220/unplugin-stylex",
Expand Down
21 changes: 21 additions & 0 deletions src/esbuild.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
/**
* This entry file is for esbuild plugin. Requires esbuild >= 0.15
*
* @module
*/

import { createEsbuildPlugin } from 'unplugin'
import type { EsbuildPlugin } from 'unplugin'
import { unpluginFactory } from './index'
import type { UnpluginStylexInstance } from './types'

const esbuildPlugin: UnpluginStylexInstance<EsbuildPlugin | EsbuildPlugin[]> = createEsbuildPlugin(unpluginFactory)


/**
* Esbuild plugin
*
* @example
*
* import { build } from 'esbuild'
* import stylexPlugin from 'unplugin-stylex/esbuild'
*
* export default {
* plugins: [
* stylexPlugin(),
* ],
* }
*/
export default esbuildPlugin
9 changes: 9 additions & 0 deletions src/rollup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
/**
* This entry file is for Rollup plugin.
*
* @module
*/

import { isDevelopment } from './core/constants'
import type { UnpluginStylexOptions } from './types'

/**
* Note: Current, please use @stylexjs/rollup-plugin
*/
export default (options?: UnpluginStylexOptions) => {
if (isDevelopment || options?.dev) {
throw new Error('If you want to use this plugin through rollup, please use "@stylexjs/rollup-plugin" instead')
Expand Down
19 changes: 19 additions & 0 deletions src/rspack.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* This entry file is for Rspac plugin.
*
* @module
*/

import { createRspackPlugin } from 'unplugin'
import type { RspackPluginInstance } from 'unplugin'
import { unpluginFactory } from './index'
Expand All @@ -7,4 +13,17 @@ type RspackPluginType = UnpluginStylexInstance<RspackPluginInstance | RspackPlug

const rspackPlugin: RspackPluginType = createRspackPlugin(unpluginFactory)

/**
* Rsapck plugin
*
* @example
*
* import stylexPlugin from 'unplugin-stylex/rspack'
*
* module.exports = {
* plugins: [
* stylexPlugin(),
* ],
* }
*/
export default rspackPlugin
20 changes: 20 additions & 0 deletions src/vite.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
/**
* This entry file is for Vite plugin.
*
* @module
*/

import { createVitePlugin } from 'unplugin'
import type { VitePlugin } from 'unplugin'
import { unpluginFactory } from './index'
import type { UnpluginStylexInstance } from './types'

const vitePlugin: UnpluginStylexInstance<VitePlugin | VitePlugin[]> = createVitePlugin(unpluginFactory)

/**
* Vite example
*
* @example
*
* import { defineConfig } from 'vite'
* import stylexPlugin from 'unplugin-stylex/vite'
*
* export default defineConfig({
* plugins: [
* stylexPlugin(),
* ],
* })
*/
export default vitePlugin
9 changes: 9 additions & 0 deletions src/webpack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
/**
* This entry file is for Webpack plugin.
*
* @module
*/

import { isDevelopment } from './core/constants'
import type { UnpluginStylexOptions } from './types'

/**
* Note: Current, please use @stylexjs/webpack-plugin
*/
export default (options?: UnpluginStylexOptions) => {
if (isDevelopment || options?.dev) {
throw new Error('If you want to use this plugin through webpack, please use "@stylexjs/webpack-plugin" instead')
Expand Down

0 comments on commit 69aef20

Please sign in to comment.