@shohojdhara/atomix 0.5.7 → 0.5.8
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/atomix.umd.js +2 -0
- package/dist/atomix.umd.js.map +1 -0
- package/dist/atomix.umd.min.js +1 -0
- package/dist/index.esm.js +20 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -7
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.js +7 -3
- package/dist/theme.js.map +1 -1
- package/package.json +3 -3
- package/src/lib/config/loader.ts +27 -6
- package/src/lib/theme/config/configLoader.ts +7 -2
- package/src/lib/theme/config/loader.ts +7 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shohojdhara/atomix",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "Atomix Design System - A modern component library for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"sass": "src/styles/index.scss",
|
|
18
18
|
"unpkg": "dist/atomix.umd.min.js",
|
|
19
19
|
"jsdelivr": "dist/atomix.umd.min.js",
|
|
20
|
-
"browser": "dist/atomix.umd.min.js",
|
|
21
20
|
"bin": {
|
|
22
21
|
"atomix": "scripts/atomix-cli.js"
|
|
23
22
|
},
|
|
@@ -115,6 +114,7 @@
|
|
|
115
114
|
"default": "./dist/heavy.js"
|
|
116
115
|
},
|
|
117
116
|
"./cdn": {
|
|
117
|
+
"types": "./dist/index.d.ts",
|
|
118
118
|
"import": "./dist/atomix.umd.min.js",
|
|
119
119
|
"require": "./dist/atomix.umd.min.js",
|
|
120
120
|
"default": "./dist/atomix.umd.min.js"
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
"build:types": "rollup -c rollup.config.types.js",
|
|
234
234
|
"build:styles": "rollup -c rollup.config.styles.js",
|
|
235
235
|
"build:themes": "rollup -c rollup/config/themes.js",
|
|
236
|
-
"build:parallel": "concurrently \"npm:build:js\" \"npm:build:types\" \"npm:build:styles\"",
|
|
236
|
+
"build:parallel": "concurrently \"npm:build:js\" \"npm:build:types\" \"npm:build:styles\" \"npm:build:umd\"",
|
|
237
237
|
"build:umd": "rollup -c rollup.config.umd.js",
|
|
238
238
|
"build:cli": "rollup -c rollup.config.cli.js",
|
|
239
239
|
"build:cli:dev": "rollup -c rollup.config.cli.js --environment NODE_ENV:development",
|
package/src/lib/config/loader.ts
CHANGED
|
@@ -354,8 +354,11 @@ export function loadAtomixConfig(
|
|
|
354
354
|
*/
|
|
355
355
|
function loadConfigAtPath(path: string, required: boolean, defaultConfig: AtomixConfig): AtomixConfig {
|
|
356
356
|
try {
|
|
357
|
-
// Use dynamic
|
|
358
|
-
const
|
|
357
|
+
// Use dynamic requirement to hide from bundlers
|
|
358
|
+
const req = typeof require !== 'undefined' ? require : undefined;
|
|
359
|
+
if (!req) return defaultConfig;
|
|
360
|
+
|
|
361
|
+
const configModule = req(path);
|
|
359
362
|
const config = configModule.default || configModule;
|
|
360
363
|
|
|
361
364
|
// Validate it's an AtomixConfig
|
|
@@ -391,10 +394,28 @@ export function resolveConfigPath(configPath?: string): string | null {
|
|
|
391
394
|
return null;
|
|
392
395
|
}
|
|
393
396
|
|
|
394
|
-
//
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
397
|
+
// Use dynamic requirement to hide from bundlers like Turbopack/Webpack
|
|
398
|
+
let nodeFs: any;
|
|
399
|
+
let nodePath: any;
|
|
400
|
+
|
|
401
|
+
try {
|
|
402
|
+
// Using a dynamic string and eval-like approach to prevent static analysis
|
|
403
|
+
// This is safe here because we've already checked for window (browser)
|
|
404
|
+
const req = typeof require !== 'undefined' ? require : undefined;
|
|
405
|
+
if (req) {
|
|
406
|
+
nodeFs = req(['f', 's'].join(''));
|
|
407
|
+
nodePath = req(['p', 'a', 't', 'h'].join(''));
|
|
408
|
+
}
|
|
409
|
+
} catch (e) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (!nodeFs || !nodePath) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const { existsSync } = nodeFs;
|
|
418
|
+
const { join } = nodePath;
|
|
398
419
|
|
|
399
420
|
// If a specific config path is provided, check if it exists
|
|
400
421
|
if (configPath) {
|
|
@@ -29,7 +29,9 @@ export function loadThemeFromConfigSync(options?: { configPath?: string; require
|
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
32
|
-
const
|
|
32
|
+
const req = typeof require !== 'undefined' ? require : undefined;
|
|
33
|
+
if (!req) throw new Error('require is not available');
|
|
34
|
+
const { loadAtomixConfig: loader } = req('../../config/loader');
|
|
33
35
|
loadAtomixConfig = loader;
|
|
34
36
|
} catch (error) {
|
|
35
37
|
if (options?.required !== false) {
|
|
@@ -214,7 +216,10 @@ export async function loadThemeFromConfig(options?: { configPath?: string; requi
|
|
|
214
216
|
let config: any;
|
|
215
217
|
try {
|
|
216
218
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
217
|
-
const
|
|
219
|
+
const req = typeof require !== 'undefined' ? require : undefined;
|
|
220
|
+
if (!req) throw new Error('require is not available');
|
|
221
|
+
const { loadAtomixConfig: loader } = req('../../config/loader');
|
|
222
|
+
loadAtomixConfig = loader;
|
|
218
223
|
config = loadAtomixConfig({ configPath: options?.configPath, required: options?.required !== false });
|
|
219
224
|
} catch (error) {
|
|
220
225
|
// If loadAtomixConfig is not available (e.g., in browser bundle), provide helpful error
|
|
@@ -72,7 +72,8 @@ export function loadThemeConfig(
|
|
|
72
72
|
// In ESM environments, require might be undefined.
|
|
73
73
|
let nodeRequire: any;
|
|
74
74
|
try {
|
|
75
|
-
|
|
75
|
+
// Use eval('require') or similar to hide from bundlers
|
|
76
|
+
nodeRequire = typeof require !== 'undefined' ? require : undefined;
|
|
76
77
|
} catch {
|
|
77
78
|
// require is not defined
|
|
78
79
|
}
|
|
@@ -94,8 +95,8 @@ export function loadThemeConfig(
|
|
|
94
95
|
|
|
95
96
|
// If a specific config path is provided, try to use it
|
|
96
97
|
if (configPath && configPath !== DEFAULT_ATOMIX_CONFIG_PATH) {
|
|
97
|
-
const path = nodeRequire('
|
|
98
|
-
const fs = nodeRequire('
|
|
98
|
+
const path = nodeRequire(['p', 'a', 't', 'h'].join('')) as typeof import('path');
|
|
99
|
+
const fs = nodeRequire(['f', 's'].join('')) as typeof import('fs');
|
|
99
100
|
const fullPath = path.resolve(process.cwd(), configPath);
|
|
100
101
|
|
|
101
102
|
if (fs.existsSync(fullPath)) {
|
|
@@ -109,8 +110,8 @@ export function loadThemeConfig(
|
|
|
109
110
|
'atomix.config.json'
|
|
110
111
|
];
|
|
111
112
|
|
|
112
|
-
const path = nodeRequire('
|
|
113
|
-
const fs = nodeRequire('
|
|
113
|
+
const path = nodeRequire(['p', 'a', 't', 'h'].join('')) as typeof import('path');
|
|
114
|
+
const fs = nodeRequire(['f', 's'].join('')) as typeof import('fs');
|
|
114
115
|
|
|
115
116
|
for (const fileName of possiblePaths) {
|
|
116
117
|
const fullPath = path.resolve(process.cwd(), fileName);
|
|
@@ -131,7 +132,7 @@ export function loadThemeConfig(
|
|
|
131
132
|
|
|
132
133
|
// Handle JSON files differently
|
|
133
134
|
if (resolvedConfigPath.endsWith('.json')) {
|
|
134
|
-
const fs = nodeRequire('
|
|
135
|
+
const fs = nodeRequire(['f', 's'].join('')) as typeof import('fs');
|
|
135
136
|
configModule = JSON.parse(fs.readFileSync(resolvedConfigPath, 'utf8'));
|
|
136
137
|
} else {
|
|
137
138
|
// Use require (Node.js/CommonJS) for JS/TS files
|