@vanilla-extract/esbuild-plugin
Advanced tools
Comparing version 0.0.0-create-compiler-api-20232723636 to 0.0.0-create-compiler-api-20232803013
@@ -1,2 +0,2 @@ | ||
import { IdentifierOption, CompileOptions, Unstable_CreateCompilerOptions } from '@vanilla-extract/integration'; | ||
import { IdentifierOption, CompileOptions } from '@vanilla-extract/integration'; | ||
@@ -636,3 +636,3 @@ type Platform = 'browser' | 'node' | 'neutral' | ||
interface VanillaExtractPluginOptions$1 { | ||
interface VanillaExtractPluginOptions { | ||
outputCss?: boolean; | ||
@@ -648,13 +648,4 @@ /** | ||
} | ||
declare function vanillaExtractPlugin$1({ outputCss, externals, runtime, processCss, identifiers, esbuildOptions, }?: VanillaExtractPluginOptions$1): Plugin; | ||
declare function vanillaExtractPlugin({ outputCss, externals, runtime, processCss, identifiers, esbuildOptions, }?: VanillaExtractPluginOptions): Plugin; | ||
interface VanillaExtractPluginOptions { | ||
outputCss?: boolean; | ||
runtime?: boolean; | ||
processCss?: (css: string) => Promise<string>; | ||
identifiers?: IdentifierOption; | ||
compilerVitePlugins?: Unstable_CreateCompilerOptions['vitePlugins']; | ||
} | ||
declare function vanillaExtractPlugin({ outputCss, runtime, processCss, identifiers: identOption, compilerVitePlugins: vitePlugins, }?: VanillaExtractPluginOptions): Plugin; | ||
export { vanillaExtractPlugin as unstable_vanillaExtractPluginNext, vanillaExtractPlugin$1 as vanillaExtractPlugin }; | ||
export { vanillaExtractPlugin }; |
@@ -8,4 +8,4 @@ 'use strict'; | ||
const vanillaCssNamespace$1 = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin$1({ | ||
const vanillaCssNamespace = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin({ | ||
outputCss, | ||
@@ -32,3 +32,3 @@ externals = [], | ||
path: args.path, | ||
namespace: vanillaCssNamespace$1 | ||
namespace: vanillaCssNamespace | ||
}; | ||
@@ -38,3 +38,3 @@ }); | ||
filter: /.*/, | ||
namespace: vanillaCssNamespace$1 | ||
namespace: vanillaCssNamespace | ||
}, async ({ | ||
@@ -104,79 +104,2 @@ path: path$1 | ||
const vanillaCssNamespace = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin({ | ||
outputCss = true, | ||
runtime = false, | ||
processCss, | ||
identifiers: identOption, | ||
compilerVitePlugins: vitePlugins | ||
} = {}) { | ||
if (runtime) { | ||
// If using runtime CSS then just apply fileScopes and debug IDs to code | ||
return integration.vanillaExtractTransformPlugin({ | ||
identOption | ||
}); | ||
} | ||
return { | ||
name: 'vanilla-extract', | ||
async setup(build) { | ||
const root = build.initialOptions.absWorkingDir || process.cwd(); | ||
const identifiers = identOption || (build.initialOptions.minify ? 'short' : 'debug'); | ||
const compiler = integration.unstable_createCompiler({ | ||
root, | ||
identifiers, | ||
vitePlugins | ||
}); | ||
build.onEnd(async () => { | ||
await compiler.close(); | ||
}); | ||
build.onResolve({ | ||
filter: /\.vanilla\.css/ | ||
}, args => { | ||
return { | ||
path: args.path, | ||
namespace: vanillaCssNamespace | ||
}; | ||
}); | ||
build.onLoad({ | ||
filter: /.*/, | ||
namespace: vanillaCssNamespace | ||
}, async ({ | ||
path: path$1 | ||
}) => { | ||
const [rootRelativePath] = path$1.split('.vanilla.css'); | ||
let { | ||
css, | ||
filePath | ||
} = compiler.getCssForFile(rootRelativePath); | ||
if (typeof processCss === 'function') { | ||
css = await processCss(css); | ||
} | ||
return { | ||
contents: css, | ||
loader: 'css', | ||
resolveDir: path.dirname(filePath) | ||
}; | ||
}); | ||
build.onLoad({ | ||
filter: integration.cssFileFilter | ||
}, async ({ | ||
path | ||
}) => { | ||
const { | ||
source, | ||
watchFiles | ||
} = await compiler.processVanillaFile(path, { | ||
outputCss | ||
}); | ||
return { | ||
contents: source, | ||
loader: 'js', | ||
watchFiles: Array.from(watchFiles) | ||
}; | ||
}); | ||
} | ||
}; | ||
} | ||
exports.unstable_vanillaExtractPluginNext = vanillaExtractPlugin; | ||
exports.vanillaExtractPlugin = vanillaExtractPlugin$1; | ||
exports.vanillaExtractPlugin = vanillaExtractPlugin; |
@@ -8,4 +8,4 @@ 'use strict'; | ||
const vanillaCssNamespace$1 = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin$1({ | ||
const vanillaCssNamespace = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin({ | ||
outputCss, | ||
@@ -32,3 +32,3 @@ externals = [], | ||
path: args.path, | ||
namespace: vanillaCssNamespace$1 | ||
namespace: vanillaCssNamespace | ||
}; | ||
@@ -38,3 +38,3 @@ }); | ||
filter: /.*/, | ||
namespace: vanillaCssNamespace$1 | ||
namespace: vanillaCssNamespace | ||
}, async ({ | ||
@@ -104,79 +104,2 @@ path: path$1 | ||
const vanillaCssNamespace = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin({ | ||
outputCss = true, | ||
runtime = false, | ||
processCss, | ||
identifiers: identOption, | ||
compilerVitePlugins: vitePlugins | ||
} = {}) { | ||
if (runtime) { | ||
// If using runtime CSS then just apply fileScopes and debug IDs to code | ||
return integration.vanillaExtractTransformPlugin({ | ||
identOption | ||
}); | ||
} | ||
return { | ||
name: 'vanilla-extract', | ||
async setup(build) { | ||
const root = build.initialOptions.absWorkingDir || process.cwd(); | ||
const identifiers = identOption || (build.initialOptions.minify ? 'short' : 'debug'); | ||
const compiler = integration.unstable_createCompiler({ | ||
root, | ||
identifiers, | ||
vitePlugins | ||
}); | ||
build.onEnd(async () => { | ||
await compiler.close(); | ||
}); | ||
build.onResolve({ | ||
filter: /\.vanilla\.css/ | ||
}, args => { | ||
return { | ||
path: args.path, | ||
namespace: vanillaCssNamespace | ||
}; | ||
}); | ||
build.onLoad({ | ||
filter: /.*/, | ||
namespace: vanillaCssNamespace | ||
}, async ({ | ||
path: path$1 | ||
}) => { | ||
const [rootRelativePath] = path$1.split('.vanilla.css'); | ||
let { | ||
css, | ||
filePath | ||
} = compiler.getCssForFile(rootRelativePath); | ||
if (typeof processCss === 'function') { | ||
css = await processCss(css); | ||
} | ||
return { | ||
contents: css, | ||
loader: 'css', | ||
resolveDir: path.dirname(filePath) | ||
}; | ||
}); | ||
build.onLoad({ | ||
filter: integration.cssFileFilter | ||
}, async ({ | ||
path | ||
}) => { | ||
const { | ||
source, | ||
watchFiles | ||
} = await compiler.processVanillaFile(path, { | ||
outputCss | ||
}); | ||
return { | ||
contents: source, | ||
loader: 'js', | ||
watchFiles: Array.from(watchFiles) | ||
}; | ||
}); | ||
} | ||
}; | ||
} | ||
exports.unstable_vanillaExtractPluginNext = vanillaExtractPlugin; | ||
exports.vanillaExtractPlugin = vanillaExtractPlugin$1; | ||
exports.vanillaExtractPlugin = vanillaExtractPlugin; |
import { dirname, join } from 'path'; | ||
import { vanillaExtractTransformPlugin, virtualCssFileFilter, getSourceFromVirtualCssFile, cssFileFilter, compile, processVanillaFile, unstable_createCompiler } from '@vanilla-extract/integration'; | ||
import { vanillaExtractTransformPlugin, virtualCssFileFilter, getSourceFromVirtualCssFile, cssFileFilter, compile, processVanillaFile } from '@vanilla-extract/integration'; | ||
const vanillaCssNamespace$1 = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin$1({ | ||
const vanillaCssNamespace = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin({ | ||
outputCss, | ||
@@ -27,3 +27,3 @@ externals = [], | ||
path: args.path, | ||
namespace: vanillaCssNamespace$1 | ||
namespace: vanillaCssNamespace | ||
}; | ||
@@ -33,3 +33,3 @@ }); | ||
filter: /.*/, | ||
namespace: vanillaCssNamespace$1 | ||
namespace: vanillaCssNamespace | ||
}, async ({ | ||
@@ -99,78 +99,2 @@ path | ||
const vanillaCssNamespace = 'vanilla-extract-css-ns'; | ||
function vanillaExtractPlugin({ | ||
outputCss = true, | ||
runtime = false, | ||
processCss, | ||
identifiers: identOption, | ||
compilerVitePlugins: vitePlugins | ||
} = {}) { | ||
if (runtime) { | ||
// If using runtime CSS then just apply fileScopes and debug IDs to code | ||
return vanillaExtractTransformPlugin({ | ||
identOption | ||
}); | ||
} | ||
return { | ||
name: 'vanilla-extract', | ||
async setup(build) { | ||
const root = build.initialOptions.absWorkingDir || process.cwd(); | ||
const identifiers = identOption || (build.initialOptions.minify ? 'short' : 'debug'); | ||
const compiler = unstable_createCompiler({ | ||
root, | ||
identifiers, | ||
vitePlugins | ||
}); | ||
build.onEnd(async () => { | ||
await compiler.close(); | ||
}); | ||
build.onResolve({ | ||
filter: /\.vanilla\.css/ | ||
}, args => { | ||
return { | ||
path: args.path, | ||
namespace: vanillaCssNamespace | ||
}; | ||
}); | ||
build.onLoad({ | ||
filter: /.*/, | ||
namespace: vanillaCssNamespace | ||
}, async ({ | ||
path | ||
}) => { | ||
const [rootRelativePath] = path.split('.vanilla.css'); | ||
let { | ||
css, | ||
filePath | ||
} = compiler.getCssForFile(rootRelativePath); | ||
if (typeof processCss === 'function') { | ||
css = await processCss(css); | ||
} | ||
return { | ||
contents: css, | ||
loader: 'css', | ||
resolveDir: dirname(filePath) | ||
}; | ||
}); | ||
build.onLoad({ | ||
filter: cssFileFilter | ||
}, async ({ | ||
path | ||
}) => { | ||
const { | ||
source, | ||
watchFiles | ||
} = await compiler.processVanillaFile(path, { | ||
outputCss | ||
}); | ||
return { | ||
contents: source, | ||
loader: 'js', | ||
watchFiles: Array.from(watchFiles) | ||
}; | ||
}); | ||
} | ||
}; | ||
} | ||
export { vanillaExtractPlugin as unstable_vanillaExtractPluginNext, vanillaExtractPlugin$1 as vanillaExtractPlugin }; | ||
export { vanillaExtractPlugin }; |
{ | ||
"name": "@vanilla-extract/esbuild-plugin", | ||
"version": "0.0.0-create-compiler-api-20232723636", | ||
"version": "0.0.0-create-compiler-api-20232803013", | ||
"description": "Zero-runtime Stylesheets-in-TypeScript", | ||
@@ -18,3 +18,3 @@ "main": "dist/vanilla-extract-esbuild-plugin.cjs.js", | ||
"dependencies": { | ||
"@vanilla-extract/integration": "^0.0.0-create-compiler-api-20232723636" | ||
"@vanilla-extract/integration": "^0.0.0-create-compiler-api-20232803013" | ||
}, | ||
@@ -21,0 +21,0 @@ "devDependencies": { |
34484
865