viewlogic 1.0.0 → 1.0.2
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.
|
@@ -22,8 +22,25 @@
|
|
|
22
22
|
return (options && options.environment) || 'development';
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function getBaseUrl() {
|
|
26
|
+
// Try to detect current script URL to determine base path
|
|
27
|
+
if (typeof document !== 'undefined') {
|
|
28
|
+
const currentScript = document.currentScript ||
|
|
29
|
+
Array.from(document.scripts).find(script =>
|
|
30
|
+
script.src.includes('viewlogic-router.umd.js'));
|
|
31
|
+
if (currentScript && currentScript.src) {
|
|
32
|
+
const url = new URL(currentScript.src);
|
|
33
|
+
return url.origin + url.pathname.replace(/\/[^\/]*$/, '/');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Fallback to CDN if detection fails
|
|
38
|
+
return 'https://cdn.jsdelivr.net/npm/viewlogic/dist/';
|
|
39
|
+
}
|
|
40
|
+
|
|
25
41
|
function getRouterPath(environment) {
|
|
26
|
-
|
|
42
|
+
const baseUrl = getBaseUrl();
|
|
43
|
+
return environment === 'production' ? baseUrl + 'viewlogic-router.min.js' : baseUrl + 'viewlogic-router.js';
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
function setGlobalRouter(router) {
|
|
@@ -57,7 +74,8 @@
|
|
|
57
74
|
|
|
58
75
|
if (environment === 'production' && isLoadError) {
|
|
59
76
|
console.warn('Failed to load minified version, falling back to regular version');
|
|
60
|
-
|
|
77
|
+
const baseUrl = getBaseUrl();
|
|
78
|
+
return import(baseUrl + 'viewlogic-router.js').then(module => {
|
|
61
79
|
RouterClass = module.ViewLogicRouter;
|
|
62
80
|
return RouterClass;
|
|
63
81
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viewlogic",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A lightweight, file-based routing system for Vue 3 applications with zero build configuration",
|
|
5
5
|
"main": "dist/viewlogic-router.umd.js",
|
|
6
6
|
"module": "src/viewlogic-router.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"dist/viewlogic-router.js",
|
|
14
14
|
"dist/viewlogic-router.js.map",
|
|
15
|
-
"dist/viewlogic-router.min.js",
|
|
15
|
+
"dist/viewlogic-router.min.js",
|
|
16
16
|
"dist/viewlogic-router.min.js.map",
|
|
17
17
|
"dist/viewlogic-router.umd.js",
|
|
18
18
|
"src/**/*.js",
|
package/src/viewlogic-router.js
CHANGED
|
@@ -112,9 +112,13 @@ export class ViewLogicRouter {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
if (this.config.useComponents) {
|
|
115
|
+
// 현재 사이트의 도메인을 기준으로 컴포넌트 경로 설정
|
|
116
|
+
const currentOrigin = window.location.origin;
|
|
117
|
+
const componentsBasePath = `${currentOrigin}${this.config.basePath}/components`;
|
|
118
|
+
|
|
115
119
|
this.componentLoader = new ComponentLoader(this, {
|
|
116
120
|
...this.config,
|
|
117
|
-
basePath:
|
|
121
|
+
basePath: componentsBasePath,
|
|
118
122
|
cache: true,
|
|
119
123
|
componentNames: this.config.componentNames
|
|
120
124
|
});
|