@plumeria/webpack-plugin 3.1.0 → 4.0.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.
Files changed (2) hide show
  1. package/dist/index.js +5 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -10,6 +10,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 VIRTUAL_FILE_PATH = path_1.default.resolve(__dirname, '..', 'zero-virtual.css');
13
+ if (process.env.NODE_ENV === 'production') {
14
+ fs_1.default.writeFileSync(VIRTUAL_FILE_PATH, '/** Placeholder file */', 'utf-8');
15
+ }
13
16
  function loader(source) {
14
17
  const callback = this.async();
15
18
  if (this.resourcePath.includes('node_modules') ||
@@ -167,6 +170,8 @@ function loader(source) {
167
170
  const obj = (0, utils_1.objectExpressionToObject)(args[0].expression, utils_1.tables.staticTable, utils_1.tables.keyframesHashTable, utils_1.tables.viewTransitionHashTable, utils_1.tables.themeTable);
168
171
  const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
169
172
  utils_1.tables.viewTransitionObjectTable[hash] = obj;
173
+ (0, utils_1.extractOndemandStyles)(obj, extractedSheets);
174
+ (0, utils_1.extractOndemandStyles)({ vt: `vt-${hash}` }, extractedSheets);
170
175
  replacements.push({
171
176
  start: node.span.start - ast.span.start,
172
177
  end: node.span.end - ast.span.start,
@@ -446,10 +451,6 @@ function loader(source) {
446
451
  if (extractedSheets.length > 0 && process.env.NODE_ENV === 'development') {
447
452
  fs_1.default.appendFileSync(VIRTUAL_FILE_PATH, extractedSheets.join(''), 'utf-8');
448
453
  }
449
- else if (extractedSheets.length > 0 &&
450
- process.env.NODE_ENV === 'production') {
451
- fs_1.default.writeFileSync(VIRTUAL_FILE_PATH, '');
452
- }
453
454
  const useClientDirective = /^\s*['"]use client['"]/;
454
455
  if (process.env.NODE_ENV === 'production')
455
456
  return callback(null, transformedSource);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/webpack-plugin",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "Plumeria Webpack plugin",
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": "^3.1.0"
25
+ "@plumeria/utils": "^4.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.2",