Skip to content

Commit

Permalink
chore: init inlie
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed May 6, 2024
1 parent 32a9d93 commit 984be2f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ build-shared:

publish-all: build-shared build-core build-babel-plugin
@echo "Publishing packages..."
pnpm -r publish --access public
pnpm -r publish --access public

test:
pnpm -r run test
11 changes: 10 additions & 1 deletion packages/babel-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as b from '@babel/core'
import type { PluginObj } from '@babel/core'
import { scanImportStmt, transformInjectGlobalStyle, transformStylexAttrs } from './visitor'
import { scanImportStmt, transformInjectGlobalStyle, transformInline, transformStylexAttrs } from './visitor'
import { Context } from './state-context'
import type { StylexExtendBabelPluginOptions } from './interface'
import type { ImportIdentifiers, InternalPluginOptions } from './state-context'
Expand Down Expand Up @@ -70,6 +70,15 @@ function declare({ types: t }: typeof b): PluginObj {
}
})
}
path.traverse({
CallExpression(path) {
const { arguments } = path.node
// if (!arguments.length || arguments.find(a => a.type === 'CallExpression'))
// if (path.get('arguments').length) {
transformInline(path, ctx)
path.skip()
}
})
},
exit(path) {
const body = path.get('body')
Expand Down
1 change: 1 addition & 0 deletions packages/babel-plugin/src/visitor/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { transformStylexAttrs } from './jsx-attribute'
export { transformInjectGlobalStyle } from './global-style'
export { transformInline } from './inline'
export { scanImportStmt } from './import-stmt'
3 changes: 3 additions & 0 deletions packages/babel-plugin/src/visitor/inline.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function transformInline() {

}
6 changes: 5 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { StylexCSS } from '@stylex-extend/shared'
import type { CSSObject, StylexCSS } from '@stylex-extend/shared'

export function injectGlobalStyle(..._: Array<Record<string, StylexCSS>>): string {
throw new Error('\'injectGlobalStyle\' calls should be compiled away.')
}

export function inline(_: CSSObject): any {
throw new Error('\'inline\' calls should be compiled away.')
}

0 comments on commit 984be2f

Please sign in to comment.