@plumeria/unplugin 19.3.0 → 19.5.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.d.ts +1 -1
- package/dist/core.js +11 -7
- package/dist/core.mjs +2 -1
- package/dist/vite.js +7 -3
- package/dist/vite.mjs +2 -1
- 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 } = await
|
|
122
|
+
const { code: transformedSource, sheets: extractedSheets } = await transformSource({
|
|
119
123
|
source,
|
|
120
124
|
moduleId: id,
|
|
121
125
|
filePath: baseId,
|
|
@@ -127,7 +131,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
127
131
|
collectOndemandSheets: true,
|
|
128
132
|
addDependency,
|
|
129
133
|
});
|
|
130
|
-
const optInCSS = await
|
|
134
|
+
const optInCSS = await optimizer(extractedSheets.join(''));
|
|
131
135
|
const cssFilename = `${baseId.replace(exports.EXTENSION_PATTERN, '')}.zero.css`;
|
|
132
136
|
const cssId = `/${path.relative(viteRoot, cssFilename).replace(/\\/g, '/')}`;
|
|
133
137
|
if (isDev) {
|
|
@@ -139,7 +143,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
|
|
|
139
143
|
acc.delete(sheet);
|
|
140
144
|
acc.add(sheet);
|
|
141
145
|
});
|
|
142
|
-
const accCSS = await
|
|
146
|
+
const accCSS = await optimizer(Array.from(acc).join(''));
|
|
143
147
|
cssLookup.set(cssFilename, accCSS);
|
|
144
148
|
}
|
|
145
149
|
else {
|
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);
|
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 = await
|
|
197
|
+
const source = await 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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/unplugin",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.5.0",
|
|
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.0"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"vite": "^8.0.13"
|