@plumeria/turbopack-loader 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/index.d.ts +1 -1
- package/dist/index.js +8 -9
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.default = loader;
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
|
-
const utils_1 = require("@plumeria/utils");
|
|
40
39
|
const compiler_1 = require("@plumeria/compiler");
|
|
41
40
|
const split_css_rules_1 = require("./split-css-rules");
|
|
42
41
|
const file_lock_1 = require("./file-lock");
|
|
@@ -60,11 +59,11 @@ async function generateProductionCss(virtualFilePath, options) {
|
|
|
60
59
|
include: options.include ?? DEFAULT_INCLUDE,
|
|
61
60
|
exclude: options.exclude ?? DEFAULT_EXCLUDE,
|
|
62
61
|
cwd: process.cwd(),
|
|
63
|
-
styleProp: options.styleProp ??
|
|
62
|
+
styleProp: options.styleProp ?? compiler_1.DEFAULT_STYLE_PROP,
|
|
64
63
|
withoutLogicalProperties: options.withoutLogicalProperties,
|
|
65
64
|
withoutPhysicalProperties: options.withoutPhysicalProperties,
|
|
66
65
|
});
|
|
67
|
-
const optimized = await (0,
|
|
66
|
+
const optimized = await (0, compiler_1.optimizer)(css);
|
|
68
67
|
const tempPath = `${virtualFilePath}.${process.pid}.tmp`;
|
|
69
68
|
fs.writeFileSync(tempPath, `${GENERATED_MARKER}\n${optimized}`, 'utf-8');
|
|
70
69
|
fs.renameSync(tempPath, virtualFilePath);
|
|
@@ -87,19 +86,19 @@ async function loader(source) {
|
|
|
87
86
|
const loaderOptions = this.getOptions?.() ??
|
|
88
87
|
(typeof this.query === 'object' ? this.query : undefined) ??
|
|
89
88
|
{};
|
|
90
|
-
const styleProp = loaderOptions.styleProp ??
|
|
91
|
-
const propertyPolicy = (0,
|
|
89
|
+
const styleProp = loaderOptions.styleProp ?? compiler_1.DEFAULT_STYLE_PROP;
|
|
90
|
+
const propertyPolicy = (0, compiler_1.resolvePropertyPolicy)(loaderOptions);
|
|
92
91
|
const resourcePath = this.resourcePath;
|
|
93
92
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
94
93
|
const VIRTUAL_FILE_PATH = path.resolve(__dirname, '..', 'zero-virtual.css');
|
|
95
94
|
if (resourcePath.includes('node_modules') ||
|
|
96
|
-
!(0,
|
|
95
|
+
!(0, compiler_1.needsCompile)(source, styleProp, resourcePath)) {
|
|
97
96
|
return callback(null, source);
|
|
98
97
|
}
|
|
99
98
|
try {
|
|
100
99
|
this.clearDependencies();
|
|
101
100
|
this.addDependency(resourcePath);
|
|
102
|
-
const { code: transformedSource, sheets: extractedSheets } = await (0,
|
|
101
|
+
const { code: transformedSource, sheets: extractedSheets } = await (0, compiler_1.transformSource)({
|
|
103
102
|
source,
|
|
104
103
|
moduleId: resourcePath,
|
|
105
104
|
filePath: resourcePath,
|
|
@@ -110,7 +109,7 @@ async function loader(source) {
|
|
|
110
109
|
collectOndemandSheets: !isProduction,
|
|
111
110
|
addDependency: (depPath) => this.addDependency(depPath),
|
|
112
111
|
});
|
|
113
|
-
const optInCSS = await (0,
|
|
112
|
+
const optInCSS = await (0, compiler_1.optimizer)(extractedSheets.join(''));
|
|
114
113
|
let relativeImportPath = path.relative(path.dirname(resourcePath), VIRTUAL_FILE_PATH);
|
|
115
114
|
relativeImportPath = relativeImportPath.replace(/\\/g, '/');
|
|
116
115
|
if (!relativeImportPath.startsWith('.')) {
|
|
@@ -142,7 +141,7 @@ async function loader(source) {
|
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
if (hasNewRule) {
|
|
145
|
-
const nextCss = await (0,
|
|
144
|
+
const nextCss = await (0, compiler_1.optimizer)(Array.from(ruleSet).join('\n\n'));
|
|
146
145
|
fs.writeFileSync(VIRTUAL_FILE_PATH, nextCss, 'utf-8');
|
|
147
146
|
}
|
|
148
147
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/turbopack-loader",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.5.0",
|
|
4
4
|
"description": "Plumeria Turbopack-loader",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,8 +29,7 @@
|
|
|
29
29
|
"zero-virtual.css"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@plumeria/
|
|
33
|
-
"@plumeria/compiler": "19.3.0"
|
|
32
|
+
"@plumeria/compiler": "19.5.0"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
35
|
"zss-engine": "2.8.0"
|