@vanilla-extract/vite-plugin 4.0.3 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,10 +18,11 @@ function vanillaExtractPlugin({
|
|
|
18
18
|
unstable_mode: mode = 'emitCss'
|
|
19
19
|
} = {}) {
|
|
20
20
|
let config;
|
|
21
|
-
let
|
|
21
|
+
let configEnv;
|
|
22
22
|
let server;
|
|
23
23
|
let packageName;
|
|
24
24
|
let compiler;
|
|
25
|
+
const vitePromise = import('vite');
|
|
25
26
|
const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
|
26
27
|
const getAbsoluteId = filePath => {
|
|
27
28
|
let resolvedId = filePath;
|
|
@@ -66,32 +67,43 @@ function vanillaExtractPlugin({
|
|
|
66
67
|
configureServer(_server) {
|
|
67
68
|
server = _server;
|
|
68
69
|
},
|
|
69
|
-
config(
|
|
70
|
-
|
|
70
|
+
config(_userConfig, _configEnv) {
|
|
71
|
+
configEnv = _configEnv;
|
|
71
72
|
return {
|
|
72
73
|
ssr: {
|
|
73
74
|
external: ['@vanilla-extract/css', '@vanilla-extract/css/fileScope', '@vanilla-extract/css/adapter']
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
77
|
},
|
|
77
|
-
async configResolved(
|
|
78
|
-
config =
|
|
78
|
+
async configResolved(_resolvedConfig) {
|
|
79
|
+
config = _resolvedConfig;
|
|
79
80
|
packageName = integration.getPackageInfo(config.root).name;
|
|
80
81
|
if (mode !== 'transform') {
|
|
81
|
-
var
|
|
82
|
+
var _configFile$config$pl;
|
|
83
|
+
const {
|
|
84
|
+
loadConfigFromFile
|
|
85
|
+
} = await vitePromise;
|
|
86
|
+
const configFile = await loadConfigFromFile({
|
|
87
|
+
command: config.command,
|
|
88
|
+
mode: config.mode,
|
|
89
|
+
isSsrBuild: configEnv.isSsrBuild
|
|
90
|
+
}, config.configFile);
|
|
82
91
|
compiler = integration.createCompiler({
|
|
83
92
|
root: config.root,
|
|
84
93
|
identifiers: getIdentOption(),
|
|
85
94
|
cssImportSpecifier: fileIdToVirtualId,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
viteConfig: {
|
|
96
|
+
...(configFile === null || configFile === void 0 ? void 0 : configFile.config),
|
|
97
|
+
plugins: configFile === null || configFile === void 0 ? void 0 : (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
|
|
98
|
+
// Prevent an infinite loop where the compiler creates a new instance of the plugin,
|
|
99
|
+
// which creates a new compiler, which creates a new instance of the plugin, etc.
|
|
100
|
+
plugin.name !== 'vanilla-extract' &&
|
|
101
|
+
// Skip Remix because it throws an error if it's not loaded with a config file.
|
|
102
|
+
// If it _is_ loaded with a config file, it will create an infinite loop because it
|
|
103
|
+
// also has a child compiler which uses the same mechanism to load the config file.
|
|
104
|
+
// https://github.com/remix-run/remix/pull/7990#issuecomment-1809356626
|
|
105
|
+
plugin.name !== 'remix')
|
|
106
|
+
}
|
|
95
107
|
});
|
|
96
108
|
}
|
|
97
109
|
},
|
|
@@ -18,10 +18,11 @@ function vanillaExtractPlugin({
|
|
|
18
18
|
unstable_mode: mode = 'emitCss'
|
|
19
19
|
} = {}) {
|
|
20
20
|
let config;
|
|
21
|
-
let
|
|
21
|
+
let configEnv;
|
|
22
22
|
let server;
|
|
23
23
|
let packageName;
|
|
24
24
|
let compiler;
|
|
25
|
+
const vitePromise = import('vite');
|
|
25
26
|
const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
|
26
27
|
const getAbsoluteId = filePath => {
|
|
27
28
|
let resolvedId = filePath;
|
|
@@ -66,32 +67,43 @@ function vanillaExtractPlugin({
|
|
|
66
67
|
configureServer(_server) {
|
|
67
68
|
server = _server;
|
|
68
69
|
},
|
|
69
|
-
config(
|
|
70
|
-
|
|
70
|
+
config(_userConfig, _configEnv) {
|
|
71
|
+
configEnv = _configEnv;
|
|
71
72
|
return {
|
|
72
73
|
ssr: {
|
|
73
74
|
external: ['@vanilla-extract/css', '@vanilla-extract/css/fileScope', '@vanilla-extract/css/adapter']
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
77
|
},
|
|
77
|
-
async configResolved(
|
|
78
|
-
config =
|
|
78
|
+
async configResolved(_resolvedConfig) {
|
|
79
|
+
config = _resolvedConfig;
|
|
79
80
|
packageName = integration.getPackageInfo(config.root).name;
|
|
80
81
|
if (mode !== 'transform') {
|
|
81
|
-
var
|
|
82
|
+
var _configFile$config$pl;
|
|
83
|
+
const {
|
|
84
|
+
loadConfigFromFile
|
|
85
|
+
} = await vitePromise;
|
|
86
|
+
const configFile = await loadConfigFromFile({
|
|
87
|
+
command: config.command,
|
|
88
|
+
mode: config.mode,
|
|
89
|
+
isSsrBuild: configEnv.isSsrBuild
|
|
90
|
+
}, config.configFile);
|
|
82
91
|
compiler = integration.createCompiler({
|
|
83
92
|
root: config.root,
|
|
84
93
|
identifiers: getIdentOption(),
|
|
85
94
|
cssImportSpecifier: fileIdToVirtualId,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
viteConfig: {
|
|
96
|
+
...(configFile === null || configFile === void 0 ? void 0 : configFile.config),
|
|
97
|
+
plugins: configFile === null || configFile === void 0 ? void 0 : (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
|
|
98
|
+
// Prevent an infinite loop where the compiler creates a new instance of the plugin,
|
|
99
|
+
// which creates a new compiler, which creates a new instance of the plugin, etc.
|
|
100
|
+
plugin.name !== 'vanilla-extract' &&
|
|
101
|
+
// Skip Remix because it throws an error if it's not loaded with a config file.
|
|
102
|
+
// If it _is_ loaded with a config file, it will create an infinite loop because it
|
|
103
|
+
// also has a child compiler which uses the same mechanism to load the config file.
|
|
104
|
+
// https://github.com/remix-run/remix/pull/7990#issuecomment-1809356626
|
|
105
|
+
plugin.name !== 'remix')
|
|
106
|
+
}
|
|
95
107
|
});
|
|
96
108
|
}
|
|
97
109
|
},
|
|
@@ -10,10 +10,11 @@ function vanillaExtractPlugin({
|
|
|
10
10
|
unstable_mode: mode = 'emitCss'
|
|
11
11
|
} = {}) {
|
|
12
12
|
let config;
|
|
13
|
-
let
|
|
13
|
+
let configEnv;
|
|
14
14
|
let server;
|
|
15
15
|
let packageName;
|
|
16
16
|
let compiler;
|
|
17
|
+
const vitePromise = import('vite');
|
|
17
18
|
const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
|
18
19
|
const getAbsoluteId = filePath => {
|
|
19
20
|
let resolvedId = filePath;
|
|
@@ -58,32 +59,43 @@ function vanillaExtractPlugin({
|
|
|
58
59
|
configureServer(_server) {
|
|
59
60
|
server = _server;
|
|
60
61
|
},
|
|
61
|
-
config(
|
|
62
|
-
|
|
62
|
+
config(_userConfig, _configEnv) {
|
|
63
|
+
configEnv = _configEnv;
|
|
63
64
|
return {
|
|
64
65
|
ssr: {
|
|
65
66
|
external: ['@vanilla-extract/css', '@vanilla-extract/css/fileScope', '@vanilla-extract/css/adapter']
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
},
|
|
69
|
-
async configResolved(
|
|
70
|
-
config =
|
|
70
|
+
async configResolved(_resolvedConfig) {
|
|
71
|
+
config = _resolvedConfig;
|
|
71
72
|
packageName = getPackageInfo(config.root).name;
|
|
72
73
|
if (mode !== 'transform') {
|
|
73
|
-
var
|
|
74
|
+
var _configFile$config$pl;
|
|
75
|
+
const {
|
|
76
|
+
loadConfigFromFile
|
|
77
|
+
} = await vitePromise;
|
|
78
|
+
const configFile = await loadConfigFromFile({
|
|
79
|
+
command: config.command,
|
|
80
|
+
mode: config.mode,
|
|
81
|
+
isSsrBuild: configEnv.isSsrBuild
|
|
82
|
+
}, config.configFile);
|
|
74
83
|
compiler = createCompiler({
|
|
75
84
|
root: config.root,
|
|
76
85
|
identifiers: getIdentOption(),
|
|
77
86
|
cssImportSpecifier: fileIdToVirtualId,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
viteConfig: {
|
|
88
|
+
...(configFile === null || configFile === void 0 ? void 0 : configFile.config),
|
|
89
|
+
plugins: configFile === null || configFile === void 0 ? void 0 : (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
|
|
90
|
+
// Prevent an infinite loop where the compiler creates a new instance of the plugin,
|
|
91
|
+
// which creates a new compiler, which creates a new instance of the plugin, etc.
|
|
92
|
+
plugin.name !== 'vanilla-extract' &&
|
|
93
|
+
// Skip Remix because it throws an error if it's not loaded with a config file.
|
|
94
|
+
// If it _is_ loaded with a config file, it will create an infinite loop because it
|
|
95
|
+
// also has a child compiler which uses the same mechanism to load the config file.
|
|
96
|
+
// https://github.com/remix-run/remix/pull/7990#issuecomment-1809356626
|
|
97
|
+
plugin.name !== 'remix')
|
|
98
|
+
}
|
|
87
99
|
});
|
|
88
100
|
}
|
|
89
101
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanilla-extract/vite-plugin",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Zero-runtime Stylesheets-in-TypeScript",
|
|
5
5
|
"main": "dist/vanilla-extract-vite-plugin.cjs.js",
|
|
6
6
|
"module": "dist/vanilla-extract-vite-plugin.esm.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"author": "SEEK",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@vanilla-extract/integration": "^7.
|
|
18
|
+
"@vanilla-extract/integration": "^7.1.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"vite": "npm:vite@^5.0.11"
|