@plumeria/unplugin 19.4.0 → 19.5.1
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.d.ts +1 -1
- package/dist/core.js +11 -8
- package/dist/core.mjs +5 -5
- package/dist/vite.js +7 -3
- package/dist/vite.mjs +3 -2
- package/package.json +2 -2
package/dist/core.d.ts
CHANGED
package/dist/core.js
CHANGED
|
@@ -32,16 +32,20 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.unpluginFactory = exports.EXTENSION_PATTERN = void 0;
|
|
37
40
|
const pluginutils_1 = require("@rollup/pluginutils");
|
|
38
41
|
const path = __importStar(require("path"));
|
|
39
|
-
const
|
|
42
|
+
const compiler_1 = __importDefault(require("@plumeria/compiler"));
|
|
43
|
+
const { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } = compiler_1.default;
|
|
40
44
|
exports.EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
|
|
41
45
|
const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
42
46
|
const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude);
|
|
43
|
-
const propertyPolicy =
|
|
44
|
-
const styleProp = options.styleProp ??
|
|
47
|
+
const propertyPolicy = resolvePropertyPolicy(options);
|
|
48
|
+
const styleProp = options.styleProp ?? DEFAULT_STYLE_PROP;
|
|
45
49
|
let classProp;
|
|
46
50
|
const cssLookup = new Map();
|
|
47
51
|
const cssFileLookup = new Map();
|
|
@@ -106,7 +110,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
106
110
|
const [baseId] = id.split('?');
|
|
107
111
|
if (!filter(baseId))
|
|
108
112
|
return null;
|
|
109
|
-
if (!
|
|
113
|
+
if (!needsCompile(source, styleProp, baseId))
|
|
110
114
|
return null;
|
|
111
115
|
const dependencies = [];
|
|
112
116
|
const addDependency = (depPath) => {
|
|
@@ -115,7 +119,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
115
119
|
this.addWatchFile(depPath);
|
|
116
120
|
}
|
|
117
121
|
};
|
|
118
|
-
const { code: transformedSource, sheets: extractedSheets } =
|
|
122
|
+
const { code: transformedSource, sheets: extractedSheets } = transformSource({
|
|
119
123
|
source,
|
|
120
124
|
moduleId: id,
|
|
121
125
|
filePath: baseId,
|
|
@@ -127,7 +131,6 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
127
131
|
collectOndemandSheets: true,
|
|
128
132
|
addDependency,
|
|
129
133
|
});
|
|
130
|
-
const optInCSS = await (0, utils_1.optimizer)(extractedSheets.join(''));
|
|
131
134
|
const cssFilename = `${baseId.replace(exports.EXTENSION_PATTERN, '')}.zero.css`;
|
|
132
135
|
const cssId = `/${path.relative(viteRoot, cssFilename).replace(/\\/g, '/')}`;
|
|
133
136
|
if (isDev) {
|
|
@@ -139,11 +142,11 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
139
142
|
acc.delete(sheet);
|
|
140
143
|
acc.add(sheet);
|
|
141
144
|
});
|
|
142
|
-
const accCSS =
|
|
145
|
+
const accCSS = optimizer(Array.from(acc).join(''));
|
|
143
146
|
cssLookup.set(cssFilename, accCSS);
|
|
144
147
|
}
|
|
145
148
|
else {
|
|
146
|
-
cssLookup.set(cssFilename,
|
|
149
|
+
cssLookup.set(cssFilename, optimizer(extractedSheets.join('')));
|
|
147
150
|
}
|
|
148
151
|
cssFileLookup.set(cssId, cssFilename);
|
|
149
152
|
if (extractedSheets.length > 0) {
|
package/dist/core.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createFilter } from '@rollup/pluginutils';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import
|
|
3
|
+
import compiler from '@plumeria/compiler';
|
|
4
|
+
const { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } = compiler;
|
|
4
5
|
export const EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
|
|
5
6
|
export const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
6
7
|
const filter = createFilter(options.include, options.exclude);
|
|
@@ -79,7 +80,7 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
79
80
|
this.addWatchFile(depPath);
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
|
-
const { code: transformedSource, sheets: extractedSheets } =
|
|
83
|
+
const { code: transformedSource, sheets: extractedSheets } = transformSource({
|
|
83
84
|
source,
|
|
84
85
|
moduleId: id,
|
|
85
86
|
filePath: baseId,
|
|
@@ -91,7 +92,6 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
91
92
|
collectOndemandSheets: true,
|
|
92
93
|
addDependency,
|
|
93
94
|
});
|
|
94
|
-
const optInCSS = await optimizer(extractedSheets.join(''));
|
|
95
95
|
const cssFilename = `${baseId.replace(EXTENSION_PATTERN, '')}.zero.css`;
|
|
96
96
|
const cssId = `/${path.relative(viteRoot, cssFilename).replace(/\\/g, '/')}`;
|
|
97
97
|
if (isDev) {
|
|
@@ -103,11 +103,11 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
103
103
|
acc.delete(sheet);
|
|
104
104
|
acc.add(sheet);
|
|
105
105
|
});
|
|
106
|
-
const accCSS =
|
|
106
|
+
const accCSS = optimizer(Array.from(acc).join(''));
|
|
107
107
|
cssLookup.set(cssFilename, accCSS);
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
|
-
cssLookup.set(cssFilename,
|
|
110
|
+
cssLookup.set(cssFilename, optimizer(extractedSheets.join('')));
|
|
111
111
|
}
|
|
112
112
|
cssFileLookup.set(cssId, cssFilename);
|
|
113
113
|
if (extractedSheets.length > 0) {
|
package/dist/vite.js
CHANGED
|
@@ -32,12 +32,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
const unplugin_1 = require("unplugin");
|
|
37
40
|
const core_1 = require("./core");
|
|
38
|
-
const
|
|
41
|
+
const compiler_1 = __importDefault(require("@plumeria/compiler"));
|
|
39
42
|
const path = __importStar(require("path"));
|
|
40
43
|
const disk_css_1 = require("./disk-css");
|
|
44
|
+
const { scanAll, optimizer } = compiler_1.default;
|
|
41
45
|
function isRscConfig(userConfig) {
|
|
42
46
|
if (userConfig.environments?.rsc)
|
|
43
47
|
return true;
|
|
@@ -65,7 +69,7 @@ function attachViteHooks(plugin, options) {
|
|
|
65
69
|
let propsTableSnapshot = {};
|
|
66
70
|
const snapshotPropsTable = () => {
|
|
67
71
|
const snap = {};
|
|
68
|
-
const table =
|
|
72
|
+
const table = scanAll().componentPropsTable || {};
|
|
69
73
|
for (const compKey of Object.keys(table)) {
|
|
70
74
|
snap[compKey] = {};
|
|
71
75
|
for (const propName of Object.keys(table[compKey])) {
|
|
@@ -190,7 +194,7 @@ function attachViteHooks(plugin, options) {
|
|
|
190
194
|
return;
|
|
191
195
|
if (this.environment?.name !== 'rsc')
|
|
192
196
|
return;
|
|
193
|
-
const source =
|
|
197
|
+
const source = optimizer([...cssLookup.keys()]
|
|
194
198
|
.sort()
|
|
195
199
|
.map((key) => cssLookup.get(key))
|
|
196
200
|
.join(''));
|
package/dist/vite.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createVitePlugin } from 'unplugin';
|
|
2
2
|
import { unpluginFactory, EXTENSION_PATTERN } from './core.mjs';
|
|
3
|
-
import
|
|
3
|
+
import compiler from '@plumeria/compiler';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import { createDiskCssImport } from './disk-css.mjs';
|
|
6
|
+
const { scanAll, optimizer } = compiler;
|
|
6
7
|
function isRscConfig(userConfig) {
|
|
7
8
|
if (userConfig.environments?.rsc)
|
|
8
9
|
return true;
|
|
@@ -155,7 +156,7 @@ function attachViteHooks(plugin, options) {
|
|
|
155
156
|
return;
|
|
156
157
|
if (this.environment?.name !== 'rsc')
|
|
157
158
|
return;
|
|
158
|
-
const source =
|
|
159
|
+
const source = optimizer([...cssLookup.keys()]
|
|
159
160
|
.sort()
|
|
160
161
|
.map((key) => cssLookup.get(key))
|
|
161
162
|
.join(''));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/unplugin",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.5.1",
|
|
4
4
|
"description": "Universal Plumeria plugin for various build tools",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@rollup/pluginutils": "^5.4.0",
|
|
96
96
|
"unplugin": "^3.0.0",
|
|
97
|
-
"@plumeria/
|
|
97
|
+
"@plumeria/compiler": "19.5.1"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"vite": "^8.0.13"
|