@plumeria/turbopack-loader 10.5.2 → 10.5.3

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -16
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1289,7 +1289,6 @@ async function loader(source) {
1289
1289
  });
1290
1290
  }
1291
1291
  });
1292
- const optInCSS = await (0, utils_1.optimizer)(extractedSheets.join(''));
1293
1292
  const buffer = Buffer.from(source);
1294
1293
  let offset = 0;
1295
1294
  const parts = [];
@@ -1304,26 +1303,17 @@ async function loader(source) {
1304
1303
  });
1305
1304
  parts.push(buffer.subarray(offset));
1306
1305
  const transformedSource = Buffer.concat(parts).toString();
1307
- const VIRTUAL_CSS_PATH = require.resolve(VIRTUAL_FILE_PATH);
1308
- function stringifyRequest(loaderContext, request) {
1309
- const context = loaderContext.context || loaderContext.rootContext;
1310
- const relativePath = path.relative(context, request);
1311
- const requestPath = relativePath.startsWith('.')
1312
- ? relativePath
1313
- : './' + relativePath;
1314
- return JSON.stringify(requestPath);
1306
+ let relativeImportPath = path.relative(path.dirname(resourcePath), VIRTUAL_FILE_PATH);
1307
+ relativeImportPath = relativeImportPath.replace(/\\/g, '/');
1308
+ if (!relativeImportPath.startsWith('.')) {
1309
+ relativeImportPath = './' + relativeImportPath;
1315
1310
  }
1316
- const virtualCssImportPath = path.posix.join(path.posix.relative(path.dirname(resourcePath), path.resolve(__dirname, '..', VIRTUAL_CSS_PATH)));
1317
- let importPath = virtualCssImportPath;
1318
- if (!importPath.startsWith('.')) {
1319
- importPath = './' + importPath;
1320
- }
1321
- const virtualCssRequest = stringifyRequest(this, `${VIRTUAL_CSS_PATH}`);
1322
- const postfix = `\nimport ${virtualCssRequest};`;
1311
+ const postfix = `\nimport "${relativeImportPath}";`;
1323
1312
  if (process.env.NODE_ENV === 'production') {
1324
1313
  return callback(null, transformedSource);
1325
1314
  }
1326
1315
  if (process.env.NODE_ENV === 'development') {
1316
+ const optInCSS = await (0, utils_1.optimizer)(extractedSheets.join(''));
1327
1317
  const projectName = path.basename(this.rootContext);
1328
1318
  const relativeFromRoot = path
1329
1319
  .relative(this.rootContext, resourcePath)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/turbopack-loader",
3
- "version": "10.5.2",
3
+ "version": "10.5.3",
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": "^10.5.2"
25
+ "@plumeria/utils": "^10.5.3"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.21",