@plumeria/next-plugin 19.12.1 → 19.14.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 +21 -34
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -35,39 +35,18 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.withPlumeria = withPlumeria;
37
37
  const fs = __importStar(require("fs"));
38
+ const turbopack_loader_1 = require("@plumeria/turbopack-loader");
38
39
  const guard_1 = require("@plumeria/eslint-plugin/guard");
39
40
  const lint_1 = require("./lint");
40
41
  const isRuleConfigItem = (rule) => !Array.isArray(rule) && typeof rule === 'object' && rule !== null;
41
- function supportsRuleCondition() {
42
- try {
43
- const { version } = require('next/package.json');
44
- return Number(version.split('.')[0]) >= 16;
45
- }
46
- catch {
47
- return false;
48
- }
49
- }
50
42
  function withPlumeria(nextConfig = {}, { lint = true, ...options } = {}) {
51
43
  if (lint)
52
44
  (0, lint_1.startNextLintGuard)((0, guard_1.lintOverrides)(options));
53
45
  const globalRef = global;
54
- if (!globalRef.__PLUMERIA_RESET_DONE__) {
55
- globalRef.__PLUMERIA_RESET_DONE__ = true;
56
- try {
57
- const VIRTUAL_FILE_PATH = require.resolve('@plumeria/turbopack-loader/zero-virtual.css');
58
- const LOCK_DIR_PATH = VIRTUAL_FILE_PATH + '.lock';
59
- if (fs.existsSync(LOCK_DIR_PATH)) {
60
- try {
61
- fs.rmdirSync(LOCK_DIR_PATH);
62
- }
63
- catch (e) {
64
- }
65
- }
66
- fs.writeFileSync(VIRTUAL_FILE_PATH, '/** Placeholder file */\n', 'utf-8');
67
- }
68
- catch (e) {
69
- console.error('Failed to reset Plumeria virtual CSS file:', e);
70
- }
46
+ if (process.env.NODE_ENV === 'development' &&
47
+ !globalRef.__PLUMERIA_DEV_CSS_RESET__) {
48
+ globalRef.__PLUMERIA_DEV_CSS_RESET__ = true;
49
+ fs.rmSync((0, turbopack_loader_1.devGenerationsPath)(process.cwd()), { force: true });
71
50
  }
72
51
  const originalWebpack = nextConfig.webpack;
73
52
  const turbopackLoaders = [
@@ -81,19 +60,22 @@ function withPlumeria(nextConfig = {}, { lint = true, ...options } = {}) {
81
60
  const start = /^\w/.test(styleProp) ? '(?:^|[^\\w.])' : '';
82
61
  const end = /\w$/.test(styleProp) ? '\\b' : '';
83
62
  const content = new RegExp(`@plumeria/core|${start}${escapedStyleProp}${end}`);
84
- const ruleItem = supportsRuleCondition()
85
- ? {
86
- loaders: turbopackLoaders,
87
- condition: {
88
- all: [{ not: 'foreign' }, { content }],
89
- },
90
- }
91
- : { loaders: turbopackLoaders };
63
+ const ruleItem = {
64
+ loaders: turbopackLoaders,
65
+ condition: {
66
+ all: [{ not: 'foreign' }, { content }],
67
+ },
68
+ };
69
+ const cssLoader = {
70
+ loader: '@plumeria/turbopack-loader/css',
71
+ options: options,
72
+ };
92
73
  const plumeriaRules = {
93
74
  '*.ts': ruleItem,
94
75
  '*.tsx': ruleItem,
95
76
  '*.js': ruleItem,
96
77
  '*.jsx': ruleItem,
78
+ 'zero-virtual.css': { loaders: [cssLoader], as: '*.css' },
97
79
  };
98
80
  const mergeTurbopackRules = (existingRules = {}, newRules) => {
99
81
  const mergedRules = { ...existingRules };
@@ -149,6 +131,11 @@ function withPlumeria(nextConfig = {}, { lint = true, ...options } = {}) {
149
131
  exclude: [/node_modules/, /\.next/, /\.git/],
150
132
  use: { loader: '@plumeria/turbopack-loader', options },
151
133
  });
134
+ config.module?.rules?.unshift({
135
+ enforce: 'pre',
136
+ test: /zero-virtual\.css$/,
137
+ use: { loader: '@plumeria/turbopack-loader/css', options },
138
+ });
152
139
  return config;
153
140
  },
154
141
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/next-plugin",
3
- "version": "19.12.1",
3
+ "version": "19.14.0",
4
4
  "description": "Plumeria Next.js plugin",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -37,8 +37,8 @@
37
37
  "dist/"
38
38
  ],
39
39
  "dependencies": {
40
- "@plumeria/eslint-plugin": "19.12.1",
41
- "@plumeria/turbopack-loader": "19.12.1"
40
+ "@plumeria/eslint-plugin": "19.14.0",
41
+ "@plumeria/turbopack-loader": "19.14.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "next": "^16.3.8",