@plumeria/turbopack-loader 7.5.1 → 7.5.2
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 +10 -13
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ interface LoaderContext {
|
|
|
7
7
|
clearDependencies: () => void;
|
|
8
8
|
}
|
|
9
9
|
declare global {
|
|
10
|
-
var
|
|
10
|
+
var __plumeriaVirtualCssInitialized: boolean | undefined;
|
|
11
11
|
}
|
|
12
12
|
export default function loader(this: LoaderContext, source: string): Promise<void>;
|
|
13
13
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -5,14 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = loader;
|
|
7
7
|
const core_1 = require("@swc/core");
|
|
8
|
-
const fs_1 = require("fs");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const zss_engine_1 = require("zss-engine");
|
|
11
11
|
const utils_1 = require("@plumeria/utils");
|
|
12
12
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
13
13
|
const VIRTUAL_FILE_PATH = path_1.default.resolve(__dirname, '..', 'zero-virtual.css');
|
|
14
14
|
if (isProduction) {
|
|
15
|
-
|
|
15
|
+
fs_1.default.writeFileSync(VIRTUAL_FILE_PATH, '/** Placeholder file */\n', 'utf-8');
|
|
16
|
+
}
|
|
17
|
+
else if (!global.__plumeriaVirtualCssInitialized) {
|
|
18
|
+
global.__plumeriaVirtualCssInitialized = true;
|
|
19
|
+
fs_1.default.writeFileSync(VIRTUAL_FILE_PATH, '/** Placeholder file */\n', 'utf-8');
|
|
16
20
|
}
|
|
17
21
|
async function loader(source) {
|
|
18
22
|
const callback = this.async();
|
|
@@ -36,16 +40,13 @@ async function loader(source) {
|
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
|
-
const scannedTables = (0, utils_1.scanAll)(
|
|
43
|
+
const scannedTables = (0, utils_1.scanAll)();
|
|
40
44
|
const extractedSheets = [];
|
|
41
45
|
const addSheet = (sheet) => {
|
|
42
46
|
if (!extractedSheets.includes(sheet)) {
|
|
43
47
|
extractedSheets.push(sheet);
|
|
44
48
|
}
|
|
45
49
|
};
|
|
46
|
-
if (scannedTables.extractedSheet) {
|
|
47
|
-
addSheet(scannedTables.extractedSheet);
|
|
48
|
-
}
|
|
49
50
|
const localConsts = (0, utils_1.collectLocalConsts)(ast);
|
|
50
51
|
const importMap = {};
|
|
51
52
|
const createThemeImportMap = {};
|
|
@@ -1161,15 +1162,11 @@ async function loader(source) {
|
|
|
1161
1162
|
}
|
|
1162
1163
|
const virtualCssRequest = stringifyRequest(this, `${VIRTUAL_CSS_PATH}`);
|
|
1163
1164
|
const postfix = `\nimport ${virtualCssRequest};`;
|
|
1164
|
-
if (process.env.NODE_ENV === 'production')
|
|
1165
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1165
1166
|
return callback(null, transformedSource);
|
|
1167
|
+
}
|
|
1166
1168
|
if (extractedSheets.length > 0 && process.env.NODE_ENV === 'development') {
|
|
1167
|
-
|
|
1168
|
-
if (global.cleanupTimeout)
|
|
1169
|
-
clearTimeout(global.cleanupTimeout);
|
|
1170
|
-
global.cleanupTimeout = setTimeout(() => {
|
|
1171
|
-
(0, fs_1.writeFileSync)(VIRTUAL_FILE_PATH, optInCSS, 'utf-8');
|
|
1172
|
-
}, 500);
|
|
1169
|
+
fs_1.default.promises.appendFile(VIRTUAL_FILE_PATH, optInCSS + '\n', 'utf-8');
|
|
1173
1170
|
}
|
|
1174
1171
|
return callback(null, transformedSource + postfix);
|
|
1175
1172
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/turbopack-loader",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.2",
|
|
4
4
|
"description": "Plumeria Turbopack-loader",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"zero-virtual.css"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@plumeria/utils": "^7.5.
|
|
25
|
+
"@plumeria/utils": "^7.5.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@swc/core": "1.15.8",
|