@plumeria/unplugin 19.4.0 → 19.5.1

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/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { UnpluginFactory } from 'unplugin';
2
- import type { PropertyPolicyOptions } from '@plumeria/utils';
2
+ import type { PropertyPolicyOptions } from '@plumeria/compiler';
3
3
  export type CssImportContext = {
4
4
  id: string;
5
5
  cssId: string;
package/dist/core.js CHANGED
@@ -32,16 +32,20 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.unpluginFactory = exports.EXTENSION_PATTERN = void 0;
37
40
  const pluginutils_1 = require("@rollup/pluginutils");
38
41
  const path = __importStar(require("path"));
39
- const utils_1 = require("@plumeria/utils");
42
+ const compiler_1 = __importDefault(require("@plumeria/compiler"));
43
+ const { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } = compiler_1.default;
40
44
  exports.EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
41
45
  const unpluginFactory = (options = {}, unpluginMeta) => {
42
46
  const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude);
43
- const propertyPolicy = (0, utils_1.resolvePropertyPolicy)(options);
44
- const styleProp = options.styleProp ?? utils_1.DEFAULT_STYLE_PROP;
47
+ const propertyPolicy = resolvePropertyPolicy(options);
48
+ const styleProp = options.styleProp ?? DEFAULT_STYLE_PROP;
45
49
  let classProp;
46
50
  const cssLookup = new Map();
47
51
  const cssFileLookup = new Map();
@@ -106,7 +110,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
106
110
  const [baseId] = id.split('?');
107
111
  if (!filter(baseId))
108
112
  return null;
109
- if (!(0, utils_1.needsCompile)(source, styleProp, baseId))
113
+ if (!needsCompile(source, styleProp, baseId))
110
114
  return null;
111
115
  const dependencies = [];
112
116
  const addDependency = (depPath) => {
@@ -115,7 +119,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
115
119
  this.addWatchFile(depPath);
116
120
  }
117
121
  };
118
- const { code: transformedSource, sheets: extractedSheets } = await (0, utils_1.transformSource)({
122
+ const { code: transformedSource, sheets: extractedSheets } = transformSource({
119
123
  source,
120
124
  moduleId: id,
121
125
  filePath: baseId,
@@ -127,7 +131,6 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
127
131
  collectOndemandSheets: true,
128
132
  addDependency,
129
133
  });
130
- const optInCSS = await (0, utils_1.optimizer)(extractedSheets.join(''));
131
134
  const cssFilename = `${baseId.replace(exports.EXTENSION_PATTERN, '')}.zero.css`;
132
135
  const cssId = `/${path.relative(viteRoot, cssFilename).replace(/\\/g, '/')}`;
133
136
  if (isDev) {
@@ -139,11 +142,11 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
139
142
  acc.delete(sheet);
140
143
  acc.add(sheet);
141
144
  });
142
- const accCSS = await (0, utils_1.optimizer)(Array.from(acc).join(''));
145
+ const accCSS = optimizer(Array.from(acc).join(''));
143
146
  cssLookup.set(cssFilename, accCSS);
144
147
  }
145
148
  else {
146
- cssLookup.set(cssFilename, optInCSS);
149
+ cssLookup.set(cssFilename, optimizer(extractedSheets.join('')));
147
150
  }
148
151
  cssFileLookup.set(cssId, cssFilename);
149
152
  if (extractedSheets.length > 0) {
package/dist/core.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createFilter } from '@rollup/pluginutils';
2
2
  import * as path from 'path';
3
- import { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } from '@plumeria/utils';
3
+ import compiler from '@plumeria/compiler';
4
+ const { resolvePropertyPolicy, optimizer, transformSource, DEFAULT_STYLE_PROP, needsCompile, } = compiler;
4
5
  export const EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
5
6
  export const unpluginFactory = (options = {}, unpluginMeta) => {
6
7
  const filter = createFilter(options.include, options.exclude);
@@ -79,7 +80,7 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
79
80
  this.addWatchFile(depPath);
80
81
  }
81
82
  };
82
- const { code: transformedSource, sheets: extractedSheets } = await transformSource({
83
+ const { code: transformedSource, sheets: extractedSheets } = transformSource({
83
84
  source,
84
85
  moduleId: id,
85
86
  filePath: baseId,
@@ -91,7 +92,6 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
91
92
  collectOndemandSheets: true,
92
93
  addDependency,
93
94
  });
94
- const optInCSS = await optimizer(extractedSheets.join(''));
95
95
  const cssFilename = `${baseId.replace(EXTENSION_PATTERN, '')}.zero.css`;
96
96
  const cssId = `/${path.relative(viteRoot, cssFilename).replace(/\\/g, '/')}`;
97
97
  if (isDev) {
@@ -103,11 +103,11 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
103
103
  acc.delete(sheet);
104
104
  acc.add(sheet);
105
105
  });
106
- const accCSS = await optimizer(Array.from(acc).join(''));
106
+ const accCSS = optimizer(Array.from(acc).join(''));
107
107
  cssLookup.set(cssFilename, accCSS);
108
108
  }
109
109
  else {
110
- cssLookup.set(cssFilename, optInCSS);
110
+ cssLookup.set(cssFilename, optimizer(extractedSheets.join('')));
111
111
  }
112
112
  cssFileLookup.set(cssId, cssFilename);
113
113
  if (extractedSheets.length > 0) {
package/dist/vite.js CHANGED
@@ -32,12 +32,16 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  const unplugin_1 = require("unplugin");
37
40
  const core_1 = require("./core");
38
- const utils_1 = require("@plumeria/utils");
41
+ const compiler_1 = __importDefault(require("@plumeria/compiler"));
39
42
  const path = __importStar(require("path"));
40
43
  const disk_css_1 = require("./disk-css");
44
+ const { scanAll, optimizer } = compiler_1.default;
41
45
  function isRscConfig(userConfig) {
42
46
  if (userConfig.environments?.rsc)
43
47
  return true;
@@ -65,7 +69,7 @@ function attachViteHooks(plugin, options) {
65
69
  let propsTableSnapshot = {};
66
70
  const snapshotPropsTable = () => {
67
71
  const snap = {};
68
- const table = (0, utils_1.scanAll)().componentPropsTable || {};
72
+ const table = scanAll().componentPropsTable || {};
69
73
  for (const compKey of Object.keys(table)) {
70
74
  snap[compKey] = {};
71
75
  for (const propName of Object.keys(table[compKey])) {
@@ -190,7 +194,7 @@ function attachViteHooks(plugin, options) {
190
194
  return;
191
195
  if (this.environment?.name !== 'rsc')
192
196
  return;
193
- const source = await (0, utils_1.optimizer)([...cssLookup.keys()]
197
+ const source = optimizer([...cssLookup.keys()]
194
198
  .sort()
195
199
  .map((key) => cssLookup.get(key))
196
200
  .join(''));
package/dist/vite.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import { createVitePlugin } from 'unplugin';
2
2
  import { unpluginFactory, EXTENSION_PATTERN } from './core.mjs';
3
- import { scanAll, optimizer } from '@plumeria/utils';
3
+ import compiler from '@plumeria/compiler';
4
4
  import * as path from 'path';
5
5
  import { createDiskCssImport } from './disk-css.mjs';
6
+ const { scanAll, optimizer } = compiler;
6
7
  function isRscConfig(userConfig) {
7
8
  if (userConfig.environments?.rsc)
8
9
  return true;
@@ -155,7 +156,7 @@ function attachViteHooks(plugin, options) {
155
156
  return;
156
157
  if (this.environment?.name !== 'rsc')
157
158
  return;
158
- const source = await optimizer([...cssLookup.keys()]
159
+ const source = optimizer([...cssLookup.keys()]
159
160
  .sort()
160
161
  .map((key) => cssLookup.get(key))
161
162
  .join(''));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/unplugin",
3
- "version": "19.4.0",
3
+ "version": "19.5.1",
4
4
  "description": "Universal Plumeria plugin for various build tools",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -94,7 +94,7 @@
94
94
  "dependencies": {
95
95
  "@rollup/pluginutils": "^5.4.0",
96
96
  "unplugin": "^3.0.0",
97
- "@plumeria/utils": "19.4.0"
97
+ "@plumeria/compiler": "19.5.1"
98
98
  },
99
99
  "devDependencies": {
100
100
  "vite": "^8.0.13"