@cocreate/lazy-loader 1.23.7 → 1.24.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/.github/workflows/automated.yml +23 -10
- package/.github/workflows/manual.yml +1 -2
- package/CHANGELOG.md +23 -0
- package/package.json +24 -14
- package/release.config.js +12 -4
- package/src/client.js +10 -5
- package/src/server.js +740 -955
- package/src/index.js +0 -14
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
name: Automated Workflow
|
|
2
|
+
|
|
2
3
|
on:
|
|
3
4
|
push:
|
|
4
5
|
branches:
|
|
5
6
|
- master
|
|
7
|
+
|
|
6
8
|
jobs:
|
|
7
9
|
about:
|
|
8
10
|
runs-on: ubuntu-latest
|
|
@@ -18,26 +20,37 @@ jobs:
|
|
|
18
20
|
with:
|
|
19
21
|
direction: overwrite-github
|
|
20
22
|
githubToken: "${{ secrets.GITHUB }}"
|
|
23
|
+
|
|
21
24
|
release:
|
|
22
25
|
runs-on: ubuntu-latest
|
|
23
26
|
steps:
|
|
24
27
|
- name: Checkout
|
|
25
28
|
uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
fetch-depth: 0 # Required so semantic-release can trace git tags/history
|
|
31
|
+
|
|
26
32
|
- name: Setup Node.js
|
|
27
33
|
uses: actions/setup-node@v4
|
|
28
34
|
with:
|
|
29
|
-
node-version: 22
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@semantic-release/changelog
|
|
35
|
+
node-version: 22
|
|
36
|
+
|
|
37
|
+
- name: Install Semantic Release & Plugins
|
|
38
|
+
# Installs semantic-release and its plugins on the runner
|
|
39
|
+
run: |
|
|
40
|
+
npm install -g semantic-release \
|
|
41
|
+
@semantic-release/changelog \
|
|
42
|
+
@semantic-release/npm \
|
|
43
|
+
@semantic-release/github \
|
|
36
44
|
@semantic-release/git
|
|
37
|
-
|
|
45
|
+
|
|
46
|
+
- name: Run Semantic Release (Native)
|
|
47
|
+
id: semantic
|
|
48
|
+
# This will automatically pick up your export default config file in the repository root
|
|
49
|
+
run: npx semantic-release
|
|
38
50
|
env:
|
|
39
|
-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
51
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
40
52
|
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
53
|
+
|
|
41
54
|
outputs:
|
|
42
55
|
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
|
|
43
|
-
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
|
56
|
+
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# [1.24.0](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.23.8...v1.24.0) (2026-07-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* update automated workflow and release configuration for improved semantic release handling ([402b240](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/402b240a40f7a39b7ffeb35b0870b7e33f9a8a9a))
|
|
7
|
+
|
|
8
|
+
## [1.23.8](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.23.7...v1.23.8) (2026-07-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add module type declaration in package.json ([4f9b67f](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/4f9b67f20db9e8708c0f826abf9fe1d6c66b04e0))
|
|
14
|
+
* bump package versions ([779ea8c](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/779ea8cb007e583c0df446a7c76eac8bfae15bfa))
|
|
15
|
+
* improve error handling in lazyLoad and dependency functions ([8714c1e](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/8714c1ebae9d1f2d7c365532bb29c23f7b3ff760))
|
|
16
|
+
* removed post install and add add packages to apprved list ([548411f](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/548411fe0063c90f6db0cc098de2d04058e0a191))
|
|
17
|
+
* root factory variable Module ([440438e](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/440438e86d8806f39c0f38b0ed8c9a5e6667e197))
|
|
18
|
+
* root factory variable Module ([cafc18d](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/cafc18d58e3ab6962eba00e181cb4c924d3dc3b6))
|
|
19
|
+
* semantic version handling ([c2570b5](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/c2570b503ebaa2b3201406f42b73af0f0c8caee6))
|
|
20
|
+
* update main and browser entry points in package.json ([3f89582](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/3f89582955d61e634fe5c9bc9e08669f5ad9568a))
|
|
21
|
+
* update module export to ES6 syntax in release.config.js ([dacc0e1](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/dacc0e18df0f70d04aedb4da852d29e87f64ff97))
|
|
22
|
+
* update package.json and refactor for module compatibility ([5cc1d94](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/5cc1d9440093f7fac265085a4b5dc087d2f19122))
|
|
23
|
+
|
|
1
24
|
## [1.23.7](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.23.6...v1.23.7) (2026-02-04)
|
|
2
25
|
|
|
3
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/lazy-loader",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "A simple lazy-loader component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lazy-loader",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "npx webpack --config webpack.config.js",
|
|
20
20
|
"build": "npx webpack --mode=production --config webpack.config.js",
|
|
21
|
-
"dev": "npx webpack --config webpack.config.js --watch"
|
|
22
|
-
"postinstall": "node -e \"const { execSync } = require('child_process'); try { execSync('coc --version', { stdio: 'ignore' }); } catch (error) { try { execSync('npm install -g @cocreate/cli', { stdio: 'inherit' }); console.log('Installed \"@cocreate/cli\" globally.'); } catch (error) { console.error('Failed to install \"@cocreate/cli\" globally:', error); } }\""
|
|
21
|
+
"dev": "npx webpack --config webpack.config.js --watch"
|
|
23
22
|
},
|
|
24
23
|
"repository": {
|
|
25
24
|
"type": "git",
|
|
@@ -35,18 +34,29 @@
|
|
|
35
34
|
"type": "GitHub Sponsors ❤",
|
|
36
35
|
"url": "https://github.com/sponsors/CoCreate-app"
|
|
37
36
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
"type": "module",
|
|
38
|
+
"main": "./src/server.js",
|
|
39
|
+
"browser": "./src/client.js",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"node": "./src/server.js",
|
|
43
|
+
"deno": "./src/server.js",
|
|
44
|
+
"browser": "./src/client.js",
|
|
45
|
+
"default": "./src/server.js"
|
|
46
|
+
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@cocreate/config": "^1.13.
|
|
50
|
-
"@cocreate/
|
|
49
|
+
"@cocreate/config": "^1.13.4",
|
|
50
|
+
"@cocreate/file-server": "^1.19.1",
|
|
51
|
+
"@cocreate/observer": "^1.19.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@cocreate/webpack": "^1.4.3"
|
|
55
|
+
},
|
|
56
|
+
"allowScripts": {
|
|
57
|
+
"@cocreate/config@1.13.4": true,
|
|
58
|
+
"@cocreate/observer@1.19.0": true,
|
|
59
|
+
"@cocreate/utils@1.42.2": true,
|
|
60
|
+
"@cocreate/webpack@1.4.3": true
|
|
51
61
|
}
|
|
52
62
|
}
|
package/release.config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default {
|
|
2
2
|
dryRun: false,
|
|
3
3
|
branches: ["master"],
|
|
4
4
|
plugins: [
|
|
@@ -10,12 +10,20 @@ module.exports = {
|
|
|
10
10
|
changelogFile: "CHANGELOG.md",
|
|
11
11
|
},
|
|
12
12
|
],
|
|
13
|
-
"@semantic-release/npm",
|
|
14
|
-
"@semantic-release/github",
|
|
13
|
+
"@semantic-release/npm",
|
|
15
14
|
[
|
|
16
|
-
"@semantic-release/
|
|
15
|
+
"@semantic-release/github",
|
|
17
16
|
{
|
|
17
|
+
successComment: false,
|
|
18
|
+
failTitle: false,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"@semantic-release/git",
|
|
23
|
+
{
|
|
24
|
+
// Only stage and commit the changelog and package.json
|
|
18
25
|
assets: ["CHANGELOG.md", "package.json"],
|
|
26
|
+
message: "chore(release): ${nextRelease.version} [skip ci]",
|
|
19
27
|
},
|
|
20
28
|
],
|
|
21
29
|
],
|
package/src/client.js
CHANGED
|
@@ -54,11 +54,16 @@ function listen(name, callback, selector) {
|
|
|
54
54
|
|
|
55
55
|
// ToDo: accept an array of items and lazyLoad or load then fire CoCreateLoaded event
|
|
56
56
|
export async function lazyLoad(name, selector, callback) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
try {
|
|
58
|
+
if (document.querySelector(selector)) {
|
|
59
|
+
await dependency(name, await callback());
|
|
60
|
+
} else {
|
|
61
|
+
listen(name, callback, selector);
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error("error lazy loading chunck: ", error);
|
|
61
65
|
}
|
|
66
|
+
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
export async function dependency(name, promise) {
|
|
@@ -70,7 +75,7 @@ export async function dependency(name, promise) {
|
|
|
70
75
|
dispatchComponentLoaded(name);
|
|
71
76
|
}
|
|
72
77
|
} catch (error) {
|
|
73
|
-
console.error("error loading chunck: ", error);
|
|
78
|
+
console.error("error loading dependency chunck: ", error);
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
|