@plumeria/turbopack-loader 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/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 =
|
|
66
|
+
const optimized = (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 } =
|
|
101
|
+
const { code: transformedSource, sheets: extractedSheets } = (0, compiler_1.transformSource)({
|
|
103
102
|
source,
|
|
104
103
|
moduleId: resourcePath,
|
|
105
104
|
filePath: resourcePath,
|
|
@@ -110,7 +109,6 @@ async function loader(source) {
|
|
|
110
109
|
collectOndemandSheets: !isProduction,
|
|
111
110
|
addDependency: (depPath) => this.addDependency(depPath),
|
|
112
111
|
});
|
|
113
|
-
const optInCSS = await (0, utils_1.optimizer)(extractedSheets.join(''));
|
|
114
112
|
let relativeImportPath = path.relative(path.dirname(resourcePath), VIRTUAL_FILE_PATH);
|
|
115
113
|
relativeImportPath = relativeImportPath.replace(/\\/g, '/');
|
|
116
114
|
if (!relativeImportPath.startsWith('.')) {
|
|
@@ -122,6 +120,7 @@ async function loader(source) {
|
|
|
122
120
|
return callback(null, transformedSource + postfix);
|
|
123
121
|
}
|
|
124
122
|
if (extractedSheets.length > 0 && process.env.NODE_ENV === 'development') {
|
|
123
|
+
const optInCSS = (0, compiler_1.optimizer)(extractedSheets.join(''));
|
|
125
124
|
const LOCK_DIR_PATH = VIRTUAL_FILE_PATH + '.lock';
|
|
126
125
|
await (0, file_lock_1.acquireLock)(LOCK_DIR_PATH);
|
|
127
126
|
let currentCss = '';
|
|
@@ -142,7 +141,7 @@ async function loader(source) {
|
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
if (hasNewRule) {
|
|
145
|
-
const nextCss =
|
|
144
|
+
const nextCss = (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.1",
|
|
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/compiler": "19.
|
|
33
|
-
"@plumeria/utils": "19.4.0"
|
|
32
|
+
"@plumeria/compiler": "19.5.1"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
35
|
"zss-engine": "2.8.0"
|