@udixio/theme 1.0.0 → 1.1.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/CHANGELOG.md +12 -0
- package/dist/adapters/node.adapter.d.ts.map +1 -1
- package/dist/index.cjs +24 -15
- package/dist/index.js +23 -15
- package/package.json +3 -1
- package/src/adapters/node.adapter.ts +24 -16
- package/vite.config.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 1.1.0 (2025-08-25)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **tailwind:** enhance file utilities and integrate `pathe` for path normalization ([2c73d40](https://github.com/Udixio/UI/commit/2c73d40))
|
|
6
|
+
- **theme:** integrate `jiti` for enhanced TypeScript config loading ([21b07a6](https://github.com/Udixio/UI/commit/21b07a6))
|
|
7
|
+
- **theme:** integrate `pathe` for path resolution and improve config handling ([5a5aaf8](https://github.com/Udixio/UI/commit/5a5aaf8))
|
|
8
|
+
|
|
9
|
+
### ❤️ Thank You
|
|
10
|
+
|
|
11
|
+
- Joël VIGREUX
|
|
12
|
+
|
|
1
13
|
# 1.0.0 (2025-08-04)
|
|
2
14
|
|
|
3
15
|
### 🚀 Features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/node.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"node.adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/node.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAI9D,qBAAa,WAAY,SAAQ,eAAe;IAC3B,UAAU;gBAAV,UAAU,SAAmB;IAI1C,SAAS;CA+ChB"}
|
package/dist/index.cjs
CHANGED
|
@@ -26,9 +26,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
26
26
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
27
27
|
const awilix = require("awilix");
|
|
28
28
|
const materialColorUtilities = require("@material/material-color-utilities");
|
|
29
|
+
const pathe = require("pathe");
|
|
30
|
+
const jiti = require("jiti");
|
|
29
31
|
const vite = require("vite");
|
|
30
32
|
const path = require("node:path");
|
|
31
33
|
const fs = require("node:fs");
|
|
34
|
+
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
32
35
|
function _interopNamespaceDefault(e) {
|
|
33
36
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
34
37
|
if (e) {
|
|
@@ -2904,29 +2907,35 @@ class NodeAdapter extends AdapterAbstract {
|
|
|
2904
2907
|
}
|
|
2905
2908
|
async getConfig() {
|
|
2906
2909
|
if (typeof process !== "undefined" && process.release && process.release.name === "node") {
|
|
2907
|
-
const path2 = (await import("path")).default;
|
|
2908
2910
|
const fs2 = (await import("fs")).default;
|
|
2909
|
-
const
|
|
2910
|
-
|
|
2911
|
-
|
|
2911
|
+
const jiti$1 = jiti.createJiti(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href, {
|
|
2912
|
+
// Options optionnelles
|
|
2913
|
+
debug: process.env.NODE_ENV === "development",
|
|
2914
|
+
cache: true,
|
|
2915
|
+
// Cache les transpilations
|
|
2916
|
+
interopDefault: true
|
|
2917
|
+
// Gère automatiquement les exports par défaut
|
|
2918
|
+
});
|
|
2919
|
+
const base = pathe.resolve(this.configPath);
|
|
2920
|
+
const extensions = [".ts", ".js", ".mjs", ".cjs"];
|
|
2921
|
+
let config = null;
|
|
2912
2922
|
for (const ext of extensions) {
|
|
2913
|
-
const
|
|
2914
|
-
if (fs2.existsSync(
|
|
2915
|
-
|
|
2916
|
-
|
|
2923
|
+
const configFilePath = base + ext;
|
|
2924
|
+
if (fs2.existsSync(configFilePath)) {
|
|
2925
|
+
try {
|
|
2926
|
+
config = await jiti$1.import(configFilePath, { default: true });
|
|
2927
|
+
break;
|
|
2928
|
+
} catch (error) {
|
|
2929
|
+
console.warn(`Failed to load ${configFilePath}:`, error);
|
|
2930
|
+
continue;
|
|
2931
|
+
}
|
|
2917
2932
|
}
|
|
2918
2933
|
}
|
|
2919
|
-
if (!
|
|
2934
|
+
if (!config) {
|
|
2920
2935
|
throw new Error(
|
|
2921
2936
|
`Configuration file not found, looked for: ${base} with extensions: ${extensions.join(", ")}`
|
|
2922
2937
|
);
|
|
2923
2938
|
}
|
|
2924
|
-
let config;
|
|
2925
|
-
if ("default" in configImport) {
|
|
2926
|
-
config = configImport.default;
|
|
2927
|
-
} else {
|
|
2928
|
-
config = configImport;
|
|
2929
|
-
}
|
|
2930
2939
|
return config;
|
|
2931
2940
|
} else {
|
|
2932
2941
|
throw new Error(
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { asClass, createContainer, InjectionMode, asValue } from "awilix";
|
|
5
5
|
import { lerp, argbFromLstar, sanitizeDegreesDouble, yFromLstar, argbFromLinrgb, Cam16, signum, matrixMultiply, ViewingConditions, lstarFromArgb, lstarFromY, Contrast, clampDouble, hexFromArgb, argbFromHex, DynamicColor as DynamicColor$1, TonalPalette } from "@material/material-color-utilities";
|
|
6
|
+
import { resolve } from "pathe";
|
|
7
|
+
import { createJiti } from "jiti";
|
|
6
8
|
import { loadConfigFromFile } from "vite";
|
|
7
9
|
import * as path from "node:path";
|
|
8
10
|
import * as fs from "node:fs";
|
|
@@ -2863,29 +2865,35 @@ class NodeAdapter extends AdapterAbstract {
|
|
|
2863
2865
|
}
|
|
2864
2866
|
async getConfig() {
|
|
2865
2867
|
if (typeof process !== "undefined" && process.release && process.release.name === "node") {
|
|
2866
|
-
const path2 = (await import("path")).default;
|
|
2867
2868
|
const fs2 = (await import("fs")).default;
|
|
2868
|
-
const
|
|
2869
|
-
|
|
2870
|
-
|
|
2869
|
+
const jiti = createJiti(import.meta.url, {
|
|
2870
|
+
// Options optionnelles
|
|
2871
|
+
debug: process.env.NODE_ENV === "development",
|
|
2872
|
+
cache: true,
|
|
2873
|
+
// Cache les transpilations
|
|
2874
|
+
interopDefault: true
|
|
2875
|
+
// Gère automatiquement les exports par défaut
|
|
2876
|
+
});
|
|
2877
|
+
const base = resolve(this.configPath);
|
|
2878
|
+
const extensions = [".ts", ".js", ".mjs", ".cjs"];
|
|
2879
|
+
let config = null;
|
|
2871
2880
|
for (const ext of extensions) {
|
|
2872
|
-
const
|
|
2873
|
-
if (fs2.existsSync(
|
|
2874
|
-
|
|
2875
|
-
|
|
2881
|
+
const configFilePath = base + ext;
|
|
2882
|
+
if (fs2.existsSync(configFilePath)) {
|
|
2883
|
+
try {
|
|
2884
|
+
config = await jiti.import(configFilePath, { default: true });
|
|
2885
|
+
break;
|
|
2886
|
+
} catch (error) {
|
|
2887
|
+
console.warn(`Failed to load ${configFilePath}:`, error);
|
|
2888
|
+
continue;
|
|
2889
|
+
}
|
|
2876
2890
|
}
|
|
2877
2891
|
}
|
|
2878
|
-
if (!
|
|
2892
|
+
if (!config) {
|
|
2879
2893
|
throw new Error(
|
|
2880
2894
|
`Configuration file not found, looked for: ${base} with extensions: ${extensions.join(", ")}`
|
|
2881
2895
|
);
|
|
2882
2896
|
}
|
|
2883
|
-
let config;
|
|
2884
|
-
if ("default" in configImport) {
|
|
2885
|
-
config = configImport.default;
|
|
2886
|
-
} else {
|
|
2887
|
-
config = configImport;
|
|
2888
|
-
}
|
|
2889
2897
|
return config;
|
|
2890
2898
|
} else {
|
|
2891
2899
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udixio/theme",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"pathe": "^2.0.3",
|
|
20
|
+
"jiti": "^2.5.1",
|
|
19
21
|
"awilix": "^12.0.5",
|
|
20
22
|
"@material/material-color-utilities": "^0.3.0",
|
|
21
23
|
"replace-in-file": "^8.3.0",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AdapterAbstract, ConfigInterface } from '../adapter';
|
|
2
|
+
import { resolve } from 'pathe';
|
|
3
|
+
import { createJiti } from 'jiti';
|
|
2
4
|
|
|
3
5
|
export class NodeAdapter extends AdapterAbstract {
|
|
4
6
|
constructor(public configPath = './theme.config') {
|
|
@@ -11,34 +13,40 @@ export class NodeAdapter extends AdapterAbstract {
|
|
|
11
13
|
process.release &&
|
|
12
14
|
process.release.name === 'node'
|
|
13
15
|
) {
|
|
14
|
-
const path = (await import('path')).default;
|
|
15
16
|
const fs = (await import('fs')).default;
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
// Créer une instance jiti pour importer des fichiers TypeScript
|
|
19
|
+
const jiti = createJiti(import.meta.url, {
|
|
20
|
+
// Options optionnelles
|
|
21
|
+
debug: process.env.NODE_ENV === 'development',
|
|
22
|
+
cache: true, // Cache les transpilations
|
|
23
|
+
interopDefault: true, // Gère automatiquement les exports par défaut
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const base = resolve(this.configPath);
|
|
27
|
+
const extensions = ['.ts', '.js', '.mjs', '.cjs']; // .ts en premier
|
|
28
|
+
let config: ConfigInterface | null = null;
|
|
20
29
|
|
|
21
30
|
for (const ext of extensions) {
|
|
22
|
-
const
|
|
23
|
-
if (fs.existsSync(
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
const configFilePath = base + ext;
|
|
32
|
+
if (fs.existsSync(configFilePath)) {
|
|
33
|
+
try {
|
|
34
|
+
// jiti peut importer directement des fichiers .ts
|
|
35
|
+
config = await jiti.import(configFilePath, { default: true });
|
|
36
|
+
break;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.warn(`Failed to load ${configFilePath}:`, error);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
26
41
|
}
|
|
27
42
|
}
|
|
28
43
|
|
|
29
|
-
if (!
|
|
44
|
+
if (!config) {
|
|
30
45
|
throw new Error(
|
|
31
46
|
`Configuration file not found, looked for: ${base} with extensions: ${extensions.join(', ')}`,
|
|
32
47
|
);
|
|
33
48
|
}
|
|
34
49
|
|
|
35
|
-
let config: unknown;
|
|
36
|
-
if ('default' in configImport) {
|
|
37
|
-
config = configImport.default;
|
|
38
|
-
} else {
|
|
39
|
-
config = configImport;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
50
|
return config as ConfigInterface;
|
|
43
51
|
} else {
|
|
44
52
|
throw new Error(
|