hifun-tools 1.3.25 → 1.3.26

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.
@@ -7,7 +7,10 @@ export function getResource(path) {
7
7
  const isWebpack = typeof __webpack_require__ === "function" ||
8
8
  (typeof require !== "undefined" &&
9
9
  typeof require.context === "function");
10
- if (isVite) {
10
+ if (process.env.__rspack__) {
11
+ return;
12
+ }
13
+ else if (isVite) {
11
14
  // ---------------- VITE ----------------
12
15
  const modules = import.meta.glob([
13
16
  "/config/**/*.json",
@@ -28,7 +31,7 @@ export function getResource(path) {
28
31
  const [, mod] = match;
29
32
  return mod;
30
33
  }
31
- if (isWebpack) {
34
+ else if (isWebpack) {
32
35
  // ---------------- WEBPACK ----------------
33
36
  const ctx = require.context("/config", true, /\.(json|png|jpg|jpeg|svg|webp)$/);
34
37
  const files = ctx.keys();
@@ -97,7 +97,7 @@ class InitCls {
97
97
  this.tenant = tenantInfo.tenant;
98
98
  this.tenantConfig = getResource(`${tenantInfo.tenant}/config.json`);
99
99
  this.initialized = true;
100
- console.info(`🏢 严格加载租户成功: ${this.tenant}`, this.getImgPath("logo-default.png"));
100
+ console.info(`🏢 严格加载租户成功: ${this.tenant}`);
101
101
  return this.tenant;
102
102
  }
103
103
  catch (error) {
@@ -0,0 +1 @@
1
+ export declare function viteLoadSync(path: string): any;
@@ -0,0 +1,13 @@
1
+ // viteResource.ts
2
+ export function viteLoadSync(path) {
3
+ const modules = import.meta.glob([
4
+ "/config/**/*.json",
5
+ "/config/**/*.png",
6
+ "/config/**/*.jpg",
7
+ "/config/**/*.jpeg",
8
+ "/config/**/*.svg",
9
+ "/config/**/*.webp",
10
+ ], { eager: true, import: "default" });
11
+ const match = Object.entries(modules).find(([key]) => key.endsWith(path));
12
+ return match ? match[1] : null;
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hifun-tools",
3
- "version": "1.3.25",
3
+ "version": "1.3.26",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",