@package-verse/esmpack 1.0.8 → 1.0.9
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/empty.js +1 -0
- package/init.js +0 -12
- package/package.json +1 -1
- package/src/pack/FilePacker.ts +5 -0
package/empty.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// this is just an empty module placeholder for CSS modules
|
package/init.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
const ESMPack = window.ESMPack ||= {};
|
|
2
|
-
ESMPack.installed ||= new Set();
|
|
3
|
-
|
|
4
|
-
ESMPack.markAsInstalled ||= (urls) => Array.isArray(urls)
|
|
5
|
-
? urls.forEach(url => ESMPack.installed.add(url))
|
|
6
|
-
: ESMPack.installed.add(urls);
|
|
7
|
-
|
|
8
2
|
ESMPack.installStyleSheet ||= (url) => {
|
|
9
|
-
|
|
10
3
|
const installCss = (url) => {
|
|
11
4
|
|
|
12
5
|
const link = document.createElement("link");
|
|
@@ -17,11 +10,6 @@ ESMPack.installStyleSheet ||= (url) => {
|
|
|
17
10
|
? "afterbegin"
|
|
18
11
|
: "beforeend", link);
|
|
19
12
|
};
|
|
20
|
-
|
|
21
|
-
if (ESMPack.installed.has(url)) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
ESMPack.installed.add(url);
|
|
25
13
|
if(document.readyState === "complete") {
|
|
26
14
|
installCss(url);
|
|
27
15
|
} else {
|
package/package.json
CHANGED
package/src/pack/FilePacker.ts
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* For App.js following packed scripts will be generated.
|
|
9
9
|
* 1. App.pack.js
|
|
10
10
|
* Push Import Maps script tag
|
|
11
|
+
* Add import map for non js modules as well, and for this
|
|
12
|
+
* every nested dependency must be inspected.
|
|
13
|
+
* Push empty module for CSS
|
|
11
14
|
* Imports all nested dependencies of App.js that should not contain fully qualified path
|
|
12
15
|
* Import dynamically loaded modules as well
|
|
13
16
|
* Loads App.pack.global.css
|
|
@@ -15,6 +18,8 @@
|
|
|
15
18
|
* Imports App.js dynamically so CSS can be ready before hosting the User interface
|
|
16
19
|
* 2. App.pack.global.css
|
|
17
20
|
* 3. App.pack.local.css
|
|
21
|
+
* 4. App.pack.{hash-of-absolute-module-path}.js <-- this will be a dependency for non js module such as image or json etc.
|
|
22
|
+
* This will load an absolute path via resolve
|
|
18
23
|
*/
|
|
19
24
|
export default class FilePacker {
|
|
20
25
|
|