@plumeria/unplugin 19.9.0 → 19.10.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.
package/README.md CHANGED
@@ -158,6 +158,7 @@ plumeria.vite({
158
158
  | `styleProp` | `'classStyle'` | The JSX prop that carries styles. |
159
159
  | `withoutLogicalProperties` | `false` | Reject the logical name of a property that also has a physical name. Takes `true` or `{ sizes?: boolean }`. |
160
160
  | `withoutPhysicalProperties` | `false` | Reject the physical name of a property that also has a logical name. Takes `true` or `{ sizes?: boolean }`. |
161
+ | `lint` | `true` | Lint with `@plumeria/eslint-plugin` during a production build, integrated into the build so it needs no setup. Every bundler except esbuild and Bun. `false` builds without it. |
161
162
 
162
163
  The two spelling options contradict each other, so enabling both is a configuration error. See [the docs](https://plumeria.dev/docs/api-reference/plugins/unplugin) for why the pair has to be settled and how it lines up with the lint rules.
163
164
 
package/dist/core.d.ts CHANGED
@@ -12,6 +12,7 @@ export interface PluginOptions extends PropertyPolicyOptions {
12
12
  exclude?: string | RegExp | Array<string | RegExp>;
13
13
  devEmitToDisk?: boolean;
14
14
  styleProp?: string;
15
+ lint?: boolean;
15
16
  }
16
17
  export declare const EXTENSION_PATTERN: RegExp;
17
18
  export declare const unpluginFactory: UnpluginFactory<PluginOptions | undefined>;
package/dist/core.js CHANGED
@@ -40,6 +40,7 @@ exports.unpluginFactory = exports.EXTENSION_PATTERN = void 0;
40
40
  const pluginutils_1 = require("@rollup/pluginutils");
41
41
  const path = __importStar(require("path"));
42
42
  const compiler_1 = __importDefault(require("@plumeria/compiler"));
43
+ const guard_1 = require("@plumeria/eslint-plugin/guard");
43
44
  const { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } = compiler_1.default;
44
45
  exports.EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
45
46
  const unpluginFactory = (options = {}, unpluginMeta) => {
@@ -54,9 +55,43 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
54
55
  let isDev = false;
55
56
  let cssImport = null;
56
57
  let viteRoot = process.cwd();
58
+ const lint = options.lint !== false;
59
+ const startLint = () => {
60
+ (0, guard_1.startLintGuard)((0, guard_1.spellingRules)(options));
61
+ };
62
+ const lintOnRun = (bundler) => {
63
+ if (!lint)
64
+ return;
65
+ bundler.hooks.run.tap('@plumeria/unplugin', () => {
66
+ startLint();
67
+ });
68
+ };
69
+ const lintUnlessWatching = {
70
+ buildStart() {
71
+ if (lint && !this.meta.watchMode)
72
+ startLint();
73
+ },
74
+ };
57
75
  return {
58
76
  name: '@plumeria/unplugin',
59
77
  enforce: 'pre',
78
+ webpack: lintOnRun,
79
+ rspack: lintOnRun,
80
+ rollup: lintUnlessWatching,
81
+ rolldown: lintUnlessWatching,
82
+ vite: {
83
+ config(_config, { command }) {
84
+ if (lint && command === 'build')
85
+ startLint();
86
+ },
87
+ },
88
+ farm: {
89
+ config(config) {
90
+ if (lint && config?.compilation?.mode === 'production')
91
+ startLint();
92
+ return config;
93
+ },
94
+ },
60
95
  __plumeriaInternal: {
61
96
  cssLookup,
62
97
  cssFileLookup,
package/dist/core.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createFilter } from '@rollup/pluginutils';
2
2
  import * as path from 'path';
3
3
  import compiler from '@plumeria/compiler';
4
+ import { spellingRules, startLintGuard } from '@plumeria/eslint-plugin/guard';
4
5
  const { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } = compiler;
5
6
  export const EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
6
7
  export const unpluginFactory = (options = {}, unpluginMeta) => {
@@ -15,9 +16,43 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
15
16
  let isDev = false;
16
17
  let cssImport = null;
17
18
  let viteRoot = process.cwd();
19
+ const lint = options.lint !== false;
20
+ const startLint = () => {
21
+ startLintGuard(spellingRules(options));
22
+ };
23
+ const lintOnRun = (bundler) => {
24
+ if (!lint)
25
+ return;
26
+ bundler.hooks.run.tap('@plumeria/unplugin', () => {
27
+ startLint();
28
+ });
29
+ };
30
+ const lintUnlessWatching = {
31
+ buildStart() {
32
+ if (lint && !this.meta.watchMode)
33
+ startLint();
34
+ },
35
+ };
18
36
  return {
19
37
  name: '@plumeria/unplugin',
20
38
  enforce: 'pre',
39
+ webpack: lintOnRun,
40
+ rspack: lintOnRun,
41
+ rollup: lintUnlessWatching,
42
+ rolldown: lintUnlessWatching,
43
+ vite: {
44
+ config(_config, { command }) {
45
+ if (lint && command === 'build')
46
+ startLint();
47
+ },
48
+ },
49
+ farm: {
50
+ config(config) {
51
+ if (lint && config?.compilation?.mode === 'production')
52
+ startLint();
53
+ return config;
54
+ },
55
+ },
21
56
  __plumeriaInternal: {
22
57
  cssLookup,
23
58
  cssFileLookup,
package/dist/farm.js CHANGED
@@ -9,8 +9,10 @@ function attachFarmHooks(plugin) {
9
9
  let farmRoot = process.cwd();
10
10
  const diskCssImport = (0, disk_css_1.createDiskCssImport)(() => farmRoot);
11
11
  setCssImport((ctx) => isDev ? diskCssImport(ctx) : `\nimport ${JSON.stringify(ctx.cssId)};`);
12
+ const coreFarm = plugin.farm;
12
13
  plugin.farm = {
13
14
  config(config) {
15
+ coreFarm?.config?.(config);
14
16
  if (plugin.__plumeriaInternal) {
15
17
  if (config?.root) {
16
18
  farmRoot = config.root;
package/dist/farm.mjs CHANGED
@@ -7,8 +7,10 @@ function attachFarmHooks(plugin) {
7
7
  let farmRoot = process.cwd();
8
8
  const diskCssImport = createDiskCssImport(() => farmRoot);
9
9
  setCssImport((ctx) => isDev ? diskCssImport(ctx) : `\nimport ${JSON.stringify(ctx.cssId)};`);
10
+ const coreFarm = plugin.farm;
10
11
  plugin.farm = {
11
12
  config(config) {
13
+ coreFarm?.config?.(config);
12
14
  if (plugin.__plumeriaInternal) {
13
15
  if (config?.root) {
14
16
  farmRoot = config.root;
package/dist/vite.js CHANGED
@@ -162,7 +162,9 @@ function attachViteHooks(plugin, options) {
162
162
  const vitePlugin = {
163
163
  ...plugin,
164
164
  name: '@plumeria/unplugin:vite',
165
+ vite: undefined,
165
166
  config(userConfig, { command }) {
167
+ plugin.vite?.config?.(userConfig, { command });
166
168
  const configToReturn = {
167
169
  optimizeDeps: {
168
170
  exclude: [
package/dist/vite.mjs CHANGED
@@ -124,7 +124,9 @@ function attachViteHooks(plugin, options) {
124
124
  const vitePlugin = {
125
125
  ...plugin,
126
126
  name: '@plumeria/unplugin:vite',
127
+ vite: undefined,
127
128
  config(userConfig, { command }) {
129
+ plugin.vite?.config?.(userConfig, { command });
128
130
  const configToReturn = {
129
131
  optimizeDeps: {
130
132
  exclude: [
package/dist/webpack.js CHANGED
@@ -94,6 +94,7 @@ function attachWebpackHooks(plugin) {
94
94
  const hookFn = (compiler) => {
95
95
  if (compiler.isChild())
96
96
  return;
97
+ plugin.webpack?.(compiler);
97
98
  setRoot(compiler.context);
98
99
  if (compiler.options.mode === 'development') {
99
100
  setDev(true);
package/dist/webpack.mjs CHANGED
@@ -58,6 +58,7 @@ export function attachWebpackHooks(plugin) {
58
58
  const hookFn = (compiler) => {
59
59
  if (compiler.isChild())
60
60
  return;
61
+ plugin.webpack?.(compiler);
61
62
  setRoot(compiler.context);
62
63
  if (compiler.options.mode === 'development') {
63
64
  setDev(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/unplugin",
3
- "version": "19.9.0",
3
+ "version": "19.10.0",
4
4
  "description": "Universal Plumeria plugin for various build tools",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -93,7 +93,8 @@
93
93
  "dependencies": {
94
94
  "@rollup/pluginutils": "^5.4.0",
95
95
  "unplugin": "^3.0.0",
96
- "@plumeria/compiler": "19.9.0"
96
+ "@plumeria/compiler": "19.10.0",
97
+ "@plumeria/eslint-plugin": "19.10.0"
97
98
  },
98
99
  "devDependencies": {
99
100
  "vite": "^8.0.13"