@plumeria/unplugin 16.2.2 → 16.2.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.
package/dist/core.js CHANGED
@@ -143,6 +143,10 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
143
143
  const actualPath = (0, utils_1.resolveImportPath)(sourcePath, id);
144
144
  if (actualPath) {
145
145
  addDependency(actualPath);
146
+ const transDeps = (0, utils_1.getFileDependencies)(actualPath);
147
+ for (const dep of transDeps) {
148
+ addDependency(dep);
149
+ }
146
150
  }
147
151
  }
148
152
  }
@@ -194,12 +198,20 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
194
198
  const actualPath = (0, utils_1.resolveImportPath)(sourcePath, resourcePath);
195
199
  if (actualPath) {
196
200
  node.specifiers.forEach((specifier) => {
197
- if (specifier.type === 'ImportSpecifier') {
198
- const importedName = specifier.imported
199
- ? specifier.imported.value
200
- : specifier.local.value;
201
+ if (specifier.type === 'ImportSpecifier' ||
202
+ specifier.type === 'ImportDefaultSpecifier') {
203
+ const importedName = specifier.type === 'ImportDefaultSpecifier'
204
+ ? 'default'
205
+ : specifier.imported
206
+ ? specifier.imported.value
207
+ : specifier.local.value;
201
208
  const localName = specifier.local.value;
202
- const uniqueKey = `${actualPath}-${importedName}`;
209
+ let resolvedKey = `${actualPath}-${importedName}`;
210
+ const resolved = (0, utils_1.resolveExport)(actualPath, importedName);
211
+ if (resolved) {
212
+ resolvedKey = `${resolved.filePath}-${resolved.localName}`;
213
+ }
214
+ const uniqueKey = resolvedKey;
203
215
  localImports[localName] = { actualPath, importedName };
204
216
  if (scannedTables.staticTable[uniqueKey]) {
205
217
  importMap[localName] = scannedTables.staticTable[uniqueKey];
package/dist/core.mjs CHANGED
@@ -2,7 +2,7 @@ import { createFilter } from '@rollup/pluginutils';
2
2
  import { parseSync } from '@swc/core';
3
3
  import * as path from 'path';
4
4
  import { applyCssValue, genBase36Hash, exceptionCamelCase, camelToKebabCase, isAtRule, } from 'zss-engine';
5
- import { traverse, getStyleRecords, collectLocalConsts, objectExpressionToObject, t, extractOndemandStyles, deepMerge, scanAll, resolveImportPath, getLeadingCommentLength, optimizer, } from '@plumeria/utils';
5
+ import { traverse, getStyleRecords, collectLocalConsts, objectExpressionToObject, t, extractOndemandStyles, deepMerge, scanAll, resolveImportPath, getLeadingCommentLength, optimizer, getFileDependencies, resolveExport, } from '@plumeria/utils';
6
6
  export const TARGET_EXTENSIONS = ['ts', 'tsx', 'js', 'jsx'];
7
7
  export const EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
8
8
  export const unpluginFactory = (options = {}, unpluginMeta) => {
@@ -107,6 +107,10 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
107
107
  const actualPath = resolveImportPath(sourcePath, id);
108
108
  if (actualPath) {
109
109
  addDependency(actualPath);
110
+ const transDeps = getFileDependencies(actualPath);
111
+ for (const dep of transDeps) {
112
+ addDependency(dep);
113
+ }
110
114
  }
111
115
  }
112
116
  }
@@ -158,12 +162,20 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
158
162
  const actualPath = resolveImportPath(sourcePath, resourcePath);
159
163
  if (actualPath) {
160
164
  node.specifiers.forEach((specifier) => {
161
- if (specifier.type === 'ImportSpecifier') {
162
- const importedName = specifier.imported
163
- ? specifier.imported.value
164
- : specifier.local.value;
165
+ if (specifier.type === 'ImportSpecifier' ||
166
+ specifier.type === 'ImportDefaultSpecifier') {
167
+ const importedName = specifier.type === 'ImportDefaultSpecifier'
168
+ ? 'default'
169
+ : specifier.imported
170
+ ? specifier.imported.value
171
+ : specifier.local.value;
165
172
  const localName = specifier.local.value;
166
- const uniqueKey = `${actualPath}-${importedName}`;
173
+ let resolvedKey = `${actualPath}-${importedName}`;
174
+ const resolved = resolveExport(actualPath, importedName);
175
+ if (resolved) {
176
+ resolvedKey = `${resolved.filePath}-${resolved.localName}`;
177
+ }
178
+ const uniqueKey = resolvedKey;
167
179
  localImports[localName] = { actualPath, importedName };
168
180
  if (scannedTables.staticTable[uniqueKey]) {
169
181
  importMap[localName] = scannedTables.staticTable[uniqueKey];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/unplugin",
3
- "version": "16.2.2",
3
+ "version": "16.2.3",
4
4
  "description": "Universal Plumeria plugin for various build tools",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -89,7 +89,7 @@
89
89
  "dependencies": {
90
90
  "@rollup/pluginutils": "^5.4.0",
91
91
  "unplugin": "^3.0.0",
92
- "@plumeria/utils": "^16.2.2"
92
+ "@plumeria/utils": "^16.2.3"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@swc/core": "1.15.43",