@plumeria/unplugin 19.12.0 → 19.13.0
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.
- package/dist/core.js +16 -3
- package/dist/core.mjs +16 -3
- package/package.json +3 -3
package/dist/core.js
CHANGED
|
@@ -41,7 +41,7 @@ const pluginutils_1 = require("@rollup/pluginutils");
|
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
42
|
const compiler_1 = __importDefault(require("@plumeria/compiler"));
|
|
43
43
|
const guard_1 = require("@plumeria/eslint-plugin/guard");
|
|
44
|
-
const { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } = compiler_1.default;
|
|
44
|
+
const { resolvePropertyPolicy, optimizer, transformSource, compileCSS, DEFAULT_STYLE_PROP, needsCompile, } = compiler_1.default;
|
|
45
45
|
exports.EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
|
|
46
46
|
const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
47
47
|
const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude);
|
|
@@ -154,7 +154,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
154
154
|
this.addWatchFile(depPath);
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
const { code: transformedSource
|
|
157
|
+
const { code: transformedSource } = transformSource({
|
|
158
158
|
source,
|
|
159
159
|
moduleId: id,
|
|
160
160
|
filePath: baseId,
|
|
@@ -163,9 +163,22 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
163
163
|
classProp,
|
|
164
164
|
propertyPolicy,
|
|
165
165
|
isDev,
|
|
166
|
-
collectOndemandSheets: true,
|
|
167
166
|
addDependency,
|
|
168
167
|
});
|
|
168
|
+
const relative = path.relative(viteRoot, baseId).replace(/\\/g, '/');
|
|
169
|
+
const insideRoot = !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
170
|
+
const filePath = path.resolve(baseId);
|
|
171
|
+
const fileCss = compileCSS({
|
|
172
|
+
include: [],
|
|
173
|
+
exclude: [],
|
|
174
|
+
files: [filePath],
|
|
175
|
+
cwd: insideRoot ? viteRoot : path.dirname(baseId),
|
|
176
|
+
styleProp,
|
|
177
|
+
withoutLogicalProperties: options.withoutLogicalProperties,
|
|
178
|
+
withoutPhysicalProperties: options.withoutPhysicalProperties,
|
|
179
|
+
sources: { [filePath]: source },
|
|
180
|
+
});
|
|
181
|
+
const extractedSheets = fileCss ? [fileCss] : [];
|
|
169
182
|
const cssFilename = `${baseId.replace(exports.EXTENSION_PATTERN, '')}.zero.css`;
|
|
170
183
|
const cssId = `/${path.relative(viteRoot, cssFilename).replace(/\\/g, '/')}`;
|
|
171
184
|
if (isDev) {
|
package/dist/core.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createFilter } from '@rollup/pluginutils';
|
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import compiler from '@plumeria/compiler';
|
|
4
4
|
import { lintOverrides, startLintGuard } from '@plumeria/eslint-plugin/guard';
|
|
5
|
-
const { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } = compiler;
|
|
5
|
+
const { resolvePropertyPolicy, optimizer, transformSource, compileCSS, DEFAULT_STYLE_PROP, needsCompile, } = compiler;
|
|
6
6
|
export const EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
|
|
7
7
|
export const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
8
8
|
const filter = createFilter(options.include, options.exclude);
|
|
@@ -115,7 +115,7 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
115
115
|
this.addWatchFile(depPath);
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
const { code: transformedSource
|
|
118
|
+
const { code: transformedSource } = transformSource({
|
|
119
119
|
source,
|
|
120
120
|
moduleId: id,
|
|
121
121
|
filePath: baseId,
|
|
@@ -124,9 +124,22 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
124
124
|
classProp,
|
|
125
125
|
propertyPolicy,
|
|
126
126
|
isDev,
|
|
127
|
-
collectOndemandSheets: true,
|
|
128
127
|
addDependency,
|
|
129
128
|
});
|
|
129
|
+
const relative = path.relative(viteRoot, baseId).replace(/\\/g, '/');
|
|
130
|
+
const insideRoot = !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
131
|
+
const filePath = path.resolve(baseId);
|
|
132
|
+
const fileCss = compileCSS({
|
|
133
|
+
include: [],
|
|
134
|
+
exclude: [],
|
|
135
|
+
files: [filePath],
|
|
136
|
+
cwd: insideRoot ? viteRoot : path.dirname(baseId),
|
|
137
|
+
styleProp,
|
|
138
|
+
withoutLogicalProperties: options.withoutLogicalProperties,
|
|
139
|
+
withoutPhysicalProperties: options.withoutPhysicalProperties,
|
|
140
|
+
sources: { [filePath]: source },
|
|
141
|
+
});
|
|
142
|
+
const extractedSheets = fileCss ? [fileCss] : [];
|
|
130
143
|
const cssFilename = `${baseId.replace(EXTENSION_PATTERN, '')}.zero.css`;
|
|
131
144
|
const cssId = `/${path.relative(viteRoot, cssFilename).replace(/\\/g, '/')}`;
|
|
132
145
|
if (isDev) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/unplugin",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.13.0",
|
|
4
4
|
"description": "Universal Plumeria plugin for various build tools",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@rollup/pluginutils": "^5.4.0",
|
|
95
95
|
"unplugin": "^3.0.0",
|
|
96
|
-
"@plumeria/
|
|
97
|
-
"@plumeria/
|
|
96
|
+
"@plumeria/eslint-plugin": "19.13.0",
|
|
97
|
+
"@plumeria/compiler": "19.13.0"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"vite": "^8.0.13"
|