piral-ng 1.5.6-beta.7113 → 1.5.6-beta.7114

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.
Files changed (2) hide show
  1. package/compiler-dynamic.js +24 -11
  2. package/package.json +3 -3
@@ -1,17 +1,24 @@
1
1
  import info from '@angular/compiler/package.json';
2
2
 
3
- const url = new URL('.', __system_context__.meta.url);
4
-
5
3
  if (typeof window.ngVersions === 'undefined') {
6
4
  window.ngVersions = {};
7
5
  }
8
6
 
9
- window.ngVersions[url.href] = info.version;
10
-
7
+ const defaultVersion = 'default';
11
8
  const existing = Object.getOwnPropertyDescriptor(window, 'ng');
12
9
 
10
+ function setUrl(url, version) {
11
+ if (version) {
12
+ window.ngVersions[url] = version;
13
+ return version;
14
+ }
15
+
16
+ return defaultVersion;
17
+ }
18
+
19
+ setUrl(new URL('.', __system_context__.meta.url).href, info.version);
20
+
13
21
  if (existing?.get === undefined) {
14
- const defaultVersion = 'default';
15
22
  const ngs = {
16
23
  [defaultVersion]: existing?.value,
17
24
  };
@@ -32,13 +39,19 @@ if (existing?.get === undefined) {
32
39
  }
33
40
 
34
41
  function getNgVersion(url) {
35
- try {
36
- const baseUrl = new URL('.', url);
37
- const version = window.ngVersions[baseUrl];
38
- return version || defaultVersion;
39
- } catch {
40
- return defaultVersion;
42
+ const version = window.ngVersions[url];
43
+
44
+ if (!version) {
45
+ try {
46
+ const baseUrl = new URL('.', url);
47
+ const baseVersion = window.ngVersions[baseUrl.href];
48
+ return setUrl(url, baseVersion);
49
+ } catch {
50
+ return defaultVersion;
51
+ }
41
52
  }
53
+
54
+ return version;
42
55
  }
43
56
 
44
57
  Object.defineProperty(window, 'ng', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-ng",
3
- "version": "1.5.6-beta.7113",
3
+ "version": "1.5.6-beta.7114",
4
4
  "description": "Plugin for integrating Angular components in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -94,9 +94,9 @@
94
94
  "@angular/platform-browser": "^16.0.0",
95
95
  "@angular/platform-browser-dynamic": "^16.0.0",
96
96
  "@angular/router": "^16.0.0",
97
- "piral-core": "1.5.6-beta.7113",
97
+ "piral-core": "1.5.6-beta.7114",
98
98
  "piral-ng-common": "^16.0.0",
99
99
  "rxjs": "^7.3.0"
100
100
  },
101
- "gitHead": "a39f961d4616ea8acf9610436dd7c94d89cc46ca"
101
+ "gitHead": "aa8dcfe0f2f197ced33f525ee86bbf041f5e280f"
102
102
  }