@vanilla-extract/babel-plugin-debug-ids
Advanced tools
Comparing version 0.0.0-inline-prototype-202342012537 to 0.0.0-package-json-types-field-20240521234503
import { PluginObj, PluginPass } from '@babel/core'; | ||
declare const styleFunctions: readonly [...("style" | "style$" | "createTheme" | "createTheme$" | "styleVariants" | "styleVariants$" | "fontFace" | "fontFace$" | "keyframes" | "keyframes$" | "createVar" | "createVar$" | "recipe" | "recipe$" | "createContainer" | "createContainer$" | "layer" | "layer$")[], "globalStyle", "createGlobalTheme", "createThemeContract", "globalFontFace", "globalKeyframes", "globalLayer", "recipe"]; | ||
type StyleFunction = typeof styleFunctions[number]; | ||
declare const styleFunctions: readonly [...("style" | "createTheme" | "styleVariants" | "fontFace" | "keyframes" | "createVar" | "recipe" | "createContainer" | "layer")[], "globalStyle", "createGlobalTheme", "createThemeContract", "globalFontFace", "globalKeyframes", "globalLayer", "recipe"]; | ||
type StyleFunction = (typeof styleFunctions)[number]; | ||
type Context = PluginPass & { | ||
@@ -6,0 +6,0 @@ namespaceImport: string; |
@@ -12,11 +12,5 @@ 'use strict'; | ||
}, | ||
style$: { | ||
maxParams: 2 | ||
}, | ||
createTheme: { | ||
maxParams: 3 | ||
}, | ||
createTheme$: { | ||
maxParams: 3 | ||
}, | ||
styleVariants: { | ||
@@ -31,41 +25,17 @@ maxParams: 3, | ||
}, | ||
styleVariants$: { | ||
maxParams: 3, | ||
hasDebugId: ({ | ||
arguments: args | ||
}) => { | ||
const previousArg = args[args.length - 1]; | ||
return core.types.isStringLiteral(previousArg) || core.types.isTemplateLiteral(previousArg); | ||
} | ||
}, | ||
fontFace: { | ||
maxParams: 2 | ||
}, | ||
fontFace$: { | ||
maxParams: 2 | ||
}, | ||
keyframes: { | ||
maxParams: 2 | ||
}, | ||
keyframes$: { | ||
maxParams: 2 | ||
}, | ||
createVar: { | ||
maxParams: 1 | ||
}, | ||
createVar$: { | ||
maxParams: 1 | ||
}, | ||
recipe: { | ||
maxParams: 2 | ||
}, | ||
recipe$: { | ||
maxParams: 2 | ||
}, | ||
createContainer: { | ||
maxParams: 1 | ||
}, | ||
createContainer$: { | ||
maxParams: 1 | ||
}, | ||
layer: { | ||
@@ -79,11 +49,2 @@ maxParams: 2, | ||
} | ||
}, | ||
layer$: { | ||
maxParams: 2, | ||
hasDebugId: ({ | ||
arguments: args | ||
}) => { | ||
const previousArg = args[args.length - 1]; | ||
return core.types.isStringLiteral(previousArg) || core.types.isTemplateLiteral(previousArg); | ||
} | ||
} | ||
@@ -113,4 +74,4 @@ }; | ||
// Special case: Handle `export const [themeClass, vars] = createTheme({});` | ||
// when it's already been compiled into this: | ||
// Special case 1: Handle `export const [themeClass, vars] = createTheme({});` | ||
// when it's already been compiled into one of the following forms: | ||
// | ||
@@ -121,9 +82,42 @@ // var _createTheme = createTheme({}), | ||
// vars = _createTheme2[1]; | ||
if (core.types.isVariableDeclaration(firstRelevantParentPath.parent) && firstRelevantParentPath.parent.declarations.length === 4) { | ||
const [themeDeclarator,, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (core.types.isCallExpression(themeDeclarator.init) && core.types.isIdentifier(themeDeclarator.init.callee, { | ||
name: 'createTheme' | ||
}) && core.types.isVariableDeclarator(classNameDeclarator) && core.types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
if (core.types.isVariableDeclaration(firstRelevantParentPath.parent)) { | ||
if (firstRelevantParentPath.parent.declarations.length === 4) { | ||
const [themeDeclarator,, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (core.types.isCallExpression(themeDeclarator.init) && core.types.isIdentifier(themeDeclarator.init.callee, { | ||
name: 'createTheme' | ||
}) && core.types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
} | ||
} | ||
// alternative compiled form: | ||
// | ||
// var ref = _slicedToArray(createTheme({}), 2); | ||
// export var themeClass = ref[0], | ||
// vars = ref[1]; | ||
else if (firstRelevantParentPath.parent.declarations.length === 1) { | ||
var _firstRelevantParentP; | ||
const [themeDeclarator] = firstRelevantParentPath.parent.declarations; | ||
const nextSibling = (_firstRelevantParentP = firstRelevantParentPath.parentPath) === null || _firstRelevantParentP === void 0 ? void 0 : _firstRelevantParentP.getNextSibling().node; | ||
if (core.types.isCallExpression(themeDeclarator.init) && core.types.isCallExpression(themeDeclarator.init.arguments[0]) && core.types.isIdentifier(themeDeclarator.init.arguments[0].callee, { | ||
name: 'createTheme' | ||
}) && core.types.isExportNamedDeclaration(nextSibling) && core.types.isVariableDeclaration(nextSibling.declaration) && core.types.isVariableDeclarator(nextSibling.declaration.declarations[0]) && core.types.isIdentifier(nextSibling.declaration.declarations[0].id)) { | ||
return nextSibling.declaration.declarations[0].id.name; | ||
} | ||
} | ||
// Special case 2: Handle `const [themeClass, vars] = createTheme({}); | ||
// export { themeClass, vars };` | ||
// when compiled into the following: | ||
// | ||
// var ref = _slicedToArray(createTheme({}), 2), | ||
// myThemeClass = ref[0], | ||
// vars = ref[1]; | ||
// export { themeClass, vars }; | ||
else if (firstRelevantParentPath.parent.declarations.length === 3) { | ||
const [themeDeclarator, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (core.types.isCallExpression(themeDeclarator.init) && core.types.isCallExpression(themeDeclarator.init.arguments[0]) && core.types.isIdentifier(themeDeclarator.init.arguments[0].callee, { | ||
name: 'createTheme' | ||
}) && core.types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
} | ||
} | ||
} | ||
@@ -130,0 +124,0 @@ const relevantParent = firstRelevantParentPath.node; |
@@ -12,11 +12,5 @@ 'use strict'; | ||
}, | ||
style$: { | ||
maxParams: 2 | ||
}, | ||
createTheme: { | ||
maxParams: 3 | ||
}, | ||
createTheme$: { | ||
maxParams: 3 | ||
}, | ||
styleVariants: { | ||
@@ -31,41 +25,17 @@ maxParams: 3, | ||
}, | ||
styleVariants$: { | ||
maxParams: 3, | ||
hasDebugId: ({ | ||
arguments: args | ||
}) => { | ||
const previousArg = args[args.length - 1]; | ||
return core.types.isStringLiteral(previousArg) || core.types.isTemplateLiteral(previousArg); | ||
} | ||
}, | ||
fontFace: { | ||
maxParams: 2 | ||
}, | ||
fontFace$: { | ||
maxParams: 2 | ||
}, | ||
keyframes: { | ||
maxParams: 2 | ||
}, | ||
keyframes$: { | ||
maxParams: 2 | ||
}, | ||
createVar: { | ||
maxParams: 1 | ||
}, | ||
createVar$: { | ||
maxParams: 1 | ||
}, | ||
recipe: { | ||
maxParams: 2 | ||
}, | ||
recipe$: { | ||
maxParams: 2 | ||
}, | ||
createContainer: { | ||
maxParams: 1 | ||
}, | ||
createContainer$: { | ||
maxParams: 1 | ||
}, | ||
layer: { | ||
@@ -79,11 +49,2 @@ maxParams: 2, | ||
} | ||
}, | ||
layer$: { | ||
maxParams: 2, | ||
hasDebugId: ({ | ||
arguments: args | ||
}) => { | ||
const previousArg = args[args.length - 1]; | ||
return core.types.isStringLiteral(previousArg) || core.types.isTemplateLiteral(previousArg); | ||
} | ||
} | ||
@@ -113,4 +74,4 @@ }; | ||
// Special case: Handle `export const [themeClass, vars] = createTheme({});` | ||
// when it's already been compiled into this: | ||
// Special case 1: Handle `export const [themeClass, vars] = createTheme({});` | ||
// when it's already been compiled into one of the following forms: | ||
// | ||
@@ -121,9 +82,42 @@ // var _createTheme = createTheme({}), | ||
// vars = _createTheme2[1]; | ||
if (core.types.isVariableDeclaration(firstRelevantParentPath.parent) && firstRelevantParentPath.parent.declarations.length === 4) { | ||
const [themeDeclarator,, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (core.types.isCallExpression(themeDeclarator.init) && core.types.isIdentifier(themeDeclarator.init.callee, { | ||
name: 'createTheme' | ||
}) && core.types.isVariableDeclarator(classNameDeclarator) && core.types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
if (core.types.isVariableDeclaration(firstRelevantParentPath.parent)) { | ||
if (firstRelevantParentPath.parent.declarations.length === 4) { | ||
const [themeDeclarator,, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (core.types.isCallExpression(themeDeclarator.init) && core.types.isIdentifier(themeDeclarator.init.callee, { | ||
name: 'createTheme' | ||
}) && core.types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
} | ||
} | ||
// alternative compiled form: | ||
// | ||
// var ref = _slicedToArray(createTheme({}), 2); | ||
// export var themeClass = ref[0], | ||
// vars = ref[1]; | ||
else if (firstRelevantParentPath.parent.declarations.length === 1) { | ||
var _firstRelevantParentP; | ||
const [themeDeclarator] = firstRelevantParentPath.parent.declarations; | ||
const nextSibling = (_firstRelevantParentP = firstRelevantParentPath.parentPath) === null || _firstRelevantParentP === void 0 ? void 0 : _firstRelevantParentP.getNextSibling().node; | ||
if (core.types.isCallExpression(themeDeclarator.init) && core.types.isCallExpression(themeDeclarator.init.arguments[0]) && core.types.isIdentifier(themeDeclarator.init.arguments[0].callee, { | ||
name: 'createTheme' | ||
}) && core.types.isExportNamedDeclaration(nextSibling) && core.types.isVariableDeclaration(nextSibling.declaration) && core.types.isVariableDeclarator(nextSibling.declaration.declarations[0]) && core.types.isIdentifier(nextSibling.declaration.declarations[0].id)) { | ||
return nextSibling.declaration.declarations[0].id.name; | ||
} | ||
} | ||
// Special case 2: Handle `const [themeClass, vars] = createTheme({}); | ||
// export { themeClass, vars };` | ||
// when compiled into the following: | ||
// | ||
// var ref = _slicedToArray(createTheme({}), 2), | ||
// myThemeClass = ref[0], | ||
// vars = ref[1]; | ||
// export { themeClass, vars }; | ||
else if (firstRelevantParentPath.parent.declarations.length === 3) { | ||
const [themeDeclarator, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (core.types.isCallExpression(themeDeclarator.init) && core.types.isCallExpression(themeDeclarator.init.arguments[0]) && core.types.isIdentifier(themeDeclarator.init.arguments[0].callee, { | ||
name: 'createTheme' | ||
}) && core.types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
} | ||
} | ||
} | ||
@@ -130,0 +124,0 @@ const relevantParent = firstRelevantParentPath.node; |
@@ -8,11 +8,5 @@ import { types } from '@babel/core'; | ||
}, | ||
style$: { | ||
maxParams: 2 | ||
}, | ||
createTheme: { | ||
maxParams: 3 | ||
}, | ||
createTheme$: { | ||
maxParams: 3 | ||
}, | ||
styleVariants: { | ||
@@ -27,41 +21,17 @@ maxParams: 3, | ||
}, | ||
styleVariants$: { | ||
maxParams: 3, | ||
hasDebugId: ({ | ||
arguments: args | ||
}) => { | ||
const previousArg = args[args.length - 1]; | ||
return types.isStringLiteral(previousArg) || types.isTemplateLiteral(previousArg); | ||
} | ||
}, | ||
fontFace: { | ||
maxParams: 2 | ||
}, | ||
fontFace$: { | ||
maxParams: 2 | ||
}, | ||
keyframes: { | ||
maxParams: 2 | ||
}, | ||
keyframes$: { | ||
maxParams: 2 | ||
}, | ||
createVar: { | ||
maxParams: 1 | ||
}, | ||
createVar$: { | ||
maxParams: 1 | ||
}, | ||
recipe: { | ||
maxParams: 2 | ||
}, | ||
recipe$: { | ||
maxParams: 2 | ||
}, | ||
createContainer: { | ||
maxParams: 1 | ||
}, | ||
createContainer$: { | ||
maxParams: 1 | ||
}, | ||
layer: { | ||
@@ -75,11 +45,2 @@ maxParams: 2, | ||
} | ||
}, | ||
layer$: { | ||
maxParams: 2, | ||
hasDebugId: ({ | ||
arguments: args | ||
}) => { | ||
const previousArg = args[args.length - 1]; | ||
return types.isStringLiteral(previousArg) || types.isTemplateLiteral(previousArg); | ||
} | ||
} | ||
@@ -109,4 +70,4 @@ }; | ||
// Special case: Handle `export const [themeClass, vars] = createTheme({});` | ||
// when it's already been compiled into this: | ||
// Special case 1: Handle `export const [themeClass, vars] = createTheme({});` | ||
// when it's already been compiled into one of the following forms: | ||
// | ||
@@ -117,9 +78,42 @@ // var _createTheme = createTheme({}), | ||
// vars = _createTheme2[1]; | ||
if (types.isVariableDeclaration(firstRelevantParentPath.parent) && firstRelevantParentPath.parent.declarations.length === 4) { | ||
const [themeDeclarator,, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (types.isCallExpression(themeDeclarator.init) && types.isIdentifier(themeDeclarator.init.callee, { | ||
name: 'createTheme' | ||
}) && types.isVariableDeclarator(classNameDeclarator) && types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
if (types.isVariableDeclaration(firstRelevantParentPath.parent)) { | ||
if (firstRelevantParentPath.parent.declarations.length === 4) { | ||
const [themeDeclarator,, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (types.isCallExpression(themeDeclarator.init) && types.isIdentifier(themeDeclarator.init.callee, { | ||
name: 'createTheme' | ||
}) && types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
} | ||
} | ||
// alternative compiled form: | ||
// | ||
// var ref = _slicedToArray(createTheme({}), 2); | ||
// export var themeClass = ref[0], | ||
// vars = ref[1]; | ||
else if (firstRelevantParentPath.parent.declarations.length === 1) { | ||
var _firstRelevantParentP; | ||
const [themeDeclarator] = firstRelevantParentPath.parent.declarations; | ||
const nextSibling = (_firstRelevantParentP = firstRelevantParentPath.parentPath) === null || _firstRelevantParentP === void 0 ? void 0 : _firstRelevantParentP.getNextSibling().node; | ||
if (types.isCallExpression(themeDeclarator.init) && types.isCallExpression(themeDeclarator.init.arguments[0]) && types.isIdentifier(themeDeclarator.init.arguments[0].callee, { | ||
name: 'createTheme' | ||
}) && types.isExportNamedDeclaration(nextSibling) && types.isVariableDeclaration(nextSibling.declaration) && types.isVariableDeclarator(nextSibling.declaration.declarations[0]) && types.isIdentifier(nextSibling.declaration.declarations[0].id)) { | ||
return nextSibling.declaration.declarations[0].id.name; | ||
} | ||
} | ||
// Special case 2: Handle `const [themeClass, vars] = createTheme({}); | ||
// export { themeClass, vars };` | ||
// when compiled into the following: | ||
// | ||
// var ref = _slicedToArray(createTheme({}), 2), | ||
// myThemeClass = ref[0], | ||
// vars = ref[1]; | ||
// export { themeClass, vars }; | ||
else if (firstRelevantParentPath.parent.declarations.length === 3) { | ||
const [themeDeclarator, classNameDeclarator] = firstRelevantParentPath.parent.declarations; | ||
if (types.isCallExpression(themeDeclarator.init) && types.isCallExpression(themeDeclarator.init.arguments[0]) && types.isIdentifier(themeDeclarator.init.arguments[0].callee, { | ||
name: 'createTheme' | ||
}) && types.isIdentifier(classNameDeclarator.id)) { | ||
return classNameDeclarator.id.name; | ||
} | ||
} | ||
} | ||
@@ -126,0 +120,0 @@ const relevantParent = firstRelevantParentPath.node; |
{ | ||
"name": "@vanilla-extract/babel-plugin-debug-ids", | ||
"version": "0.0.0-inline-prototype-202342012537", | ||
"version": "0.0.0-package-json-types-field-20240521234503", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
"main": "dist/vanilla-extract-babel-plugin-debug-ids.cjs.js", | ||
"module": "dist/vanilla-extract-babel-plugin-debug-ids.esm.js", | ||
"types": "dist/vanilla-extract-babel-plugin-debug-ids.cjs.d.ts", | ||
"preconstruct": { | ||
@@ -23,7 +24,7 @@ "entrypoints": [ | ||
"dependencies": { | ||
"@babel/core": "^7.20.7" | ||
"@babel/core": "^7.23.9" | ||
}, | ||
"devDependencies": { | ||
"@types/babel__core": "^7.1.20" | ||
"@types/babel__core": "^7.20.5" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28792
9
608
Updated@babel/core@^7.23.9