@plumeria/utils 8.0.3 → 9.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.
package/dist/parser.js CHANGED
@@ -32,9 +32,6 @@ 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
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.t = void 0;
40
37
  exports.traverse = traverse;
@@ -45,8 +42,8 @@ exports.extractOndemandStyles = extractOndemandStyles;
45
42
  exports.deepMerge = deepMerge;
46
43
  const createTheme_1 = require("./createTheme");
47
44
  const core_1 = require("@swc/core");
48
- const path_1 = __importDefault(require("path"));
49
- const fs_1 = __importDefault(require("fs"));
45
+ const path = __importStar(require("path"));
46
+ const fs = __importStar(require("fs"));
50
47
  const rs = __importStar(require("@rust-gear/glob"));
51
48
  const zss_engine_1 = require("zss-engine");
52
49
  const viewTransition_1 = require("./viewTransition");
@@ -110,7 +107,7 @@ function traverse(node, visitor) {
110
107
  walk(node);
111
108
  }
112
109
  const PROJECT_ROOT = process.cwd().split('node_modules')[0];
113
- const PATTERN_PATH = path_1.default.join(PROJECT_ROOT, '**/*.{js,jsx,ts,tsx}');
110
+ const PATTERN_PATH = path.join(PROJECT_ROOT, '**/*.{js,jsx,ts,tsx}');
114
111
  const GLOB_OPTIONS = {
115
112
  exclude: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.next/**'],
116
113
  cwd: PROJECT_ROOT,
@@ -557,7 +554,7 @@ function scanAll() {
557
554
  const isFirstPass = passNumber === 1;
558
555
  for (const filePath of files) {
559
556
  try {
560
- const stats = fs_1.default.statSync(filePath);
557
+ const stats = fs.statSync(filePath);
561
558
  const cached = fileCache[filePath];
562
559
  if (cached && cached.mtimeMs === stats.mtimeMs) {
563
560
  if (cached.hasCssUsage) {
@@ -620,7 +617,7 @@ function scanAll() {
620
617
  }
621
618
  continue;
622
619
  }
623
- const source = fs_1.default.readFileSync(filePath, 'utf8');
620
+ const source = fs.readFileSync(filePath, 'utf8');
624
621
  if (!source.includes('@plumeria/core')) {
625
622
  fileCache[filePath] = {
626
623
  mtimeMs: stats.mtimeMs,
@@ -753,7 +750,7 @@ function scanAll() {
753
750
  const objectName = callee.object.value;
754
751
  const propertyName = callee.property.value;
755
752
  const alias = plumeriaAliases[objectName];
756
- if (alias === 'NAMESPACE' || objectName === 'css') {
753
+ if (alias === 'NAMESPACE') {
757
754
  method = propertyName;
758
755
  }
759
756
  }
package/dist/resolver.js CHANGED
@@ -1,11 +1,41 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
5
35
  Object.defineProperty(exports, "__esModule", { value: true });
6
36
  exports.resolveImportPath = resolveImportPath;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
9
39
  const tsConfigCache = new Map();
10
40
  const tsConfigPathCache = new Map();
11
41
  function getTsConfig(startDir) {
@@ -16,12 +46,12 @@ function getTsConfig(startDir) {
16
46
  return null;
17
47
  return {
18
48
  config: tsConfigCache.get(cachedPath) ?? null,
19
- basePath: path_1.default.dirname(cachedPath),
49
+ basePath: path.dirname(cachedPath),
20
50
  };
21
51
  }
22
- while (currentDir !== path_1.default.parse(currentDir).root) {
23
- const tsConfigPath = path_1.default.join(process.cwd(), 'tsconfig.json');
24
- if (fs_1.default.existsSync(tsConfigPath)) {
52
+ while (currentDir !== path.parse(currentDir).root) {
53
+ const tsConfigPath = path.join(process.cwd(), 'tsconfig.json');
54
+ if (fs.existsSync(tsConfigPath)) {
25
55
  if (!tsConfigCache.has(tsConfigPath)) {
26
56
  try {
27
57
  const config = require(tsConfigPath);
@@ -34,10 +64,10 @@ function getTsConfig(startDir) {
34
64
  tsConfigPathCache.set(startDir, tsConfigPath);
35
65
  return {
36
66
  config: tsConfigCache.get(tsConfigPath) ?? null,
37
- basePath: path_1.default.dirname(tsConfigPath),
67
+ basePath: path.dirname(tsConfigPath),
38
68
  };
39
69
  }
40
- currentDir = path_1.default.dirname(currentDir);
70
+ currentDir = path.dirname(currentDir);
41
71
  }
42
72
  tsConfigPathCache.set(startDir, null);
43
73
  return null;
@@ -53,20 +83,20 @@ const extensions = [
53
83
  '/index.jsx',
54
84
  ];
55
85
  function resolveWithExtension(basePath) {
56
- if (fs_1.default.existsSync(basePath) && fs_1.default.statSync(basePath).isFile())
86
+ if (fs.existsSync(basePath) && fs.statSync(basePath).isFile())
57
87
  return basePath;
58
88
  for (const ext of extensions) {
59
89
  const fullPath = basePath + ext;
60
- if (fs_1.default.existsSync(fullPath) && fs_1.default.statSync(fullPath).isFile())
90
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isFile())
61
91
  return fullPath;
62
92
  }
63
93
  return null;
64
94
  }
65
95
  function resolveImportPath(importPath, importerPath) {
66
96
  if (importPath.startsWith('.')) {
67
- return resolveWithExtension(path_1.default.resolve(path_1.default.dirname(importerPath), importPath));
97
+ return resolveWithExtension(path.resolve(path.dirname(importerPath), importPath));
68
98
  }
69
- const tsConfig = getTsConfig(path_1.default.dirname(importerPath));
99
+ const tsConfig = getTsConfig(path.dirname(importerPath));
70
100
  const config = tsConfig?.config;
71
101
  if (config?.paths) {
72
102
  const root = tsConfig.basePath;
@@ -75,7 +105,7 @@ function resolveImportPath(importPath, importerPath) {
75
105
  if (importPath.startsWith(prefix)) {
76
106
  for (const target of targets) {
77
107
  const resolvedTarget = target.replace(/\*$/, '');
78
- const candidate = path_1.default.resolve(root, resolvedTarget + importPath.slice(prefix.length));
108
+ const candidate = path.resolve(root, resolvedTarget + importPath.slice(prefix.length));
79
109
  const result = resolveWithExtension(candidate);
80
110
  if (result)
81
111
  return result;
@@ -83,12 +113,12 @@ function resolveImportPath(importPath, importerPath) {
83
113
  }
84
114
  }
85
115
  }
86
- let currentDir = path_1.default.dirname(importerPath);
87
- while (currentDir !== path_1.default.parse(currentDir).root) {
88
- if (fs_1.default.existsSync(path_1.default.join(currentDir, 'package.json'))) {
89
- return resolveWithExtension(path_1.default.resolve(currentDir, importPath));
116
+ let currentDir = path.dirname(importerPath);
117
+ while (currentDir !== path.parse(currentDir).root) {
118
+ if (fs.existsSync(path.join(currentDir, 'package.json'))) {
119
+ return resolveWithExtension(path.resolve(currentDir, importPath));
90
120
  }
91
- currentDir = path_1.default.dirname(currentDir);
121
+ currentDir = path.dirname(currentDir);
92
122
  }
93
123
  return null;
94
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/utils",
3
- "version": "8.0.3",
3
+ "version": "9.0.0",
4
4
  "description": "Plumeria Utils",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",