@julien-lin/universal-pwa-core 1.3.11 → 1.3.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julien-lin/universal-pwa-core",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "description": "Core engine for scanning, generation, and injection for UniversalPWA",
5
5
  "keywords": [
6
6
  "pwa",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "type": "module",
34
34
  "main": "dist/index.js",
35
- "module": "dist/index.mjs",
35
+ "module": "dist/index.js",
36
36
  "types": "dist/index.d.ts",
37
37
  "exports": {
38
38
  ".": {
@@ -62,7 +62,7 @@
62
62
  "workbox-routing": "^7.4.0",
63
63
  "workbox-strategies": "^7.4.0",
64
64
  "zod": "^4.3.5",
65
- "@julien-lin/universal-pwa-templates": "^1.3.11"
65
+ "@julien-lin/universal-pwa-templates": "^1.3.13"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@vitest/coverage-v8": "^4.0.17",
@@ -1,66 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // src/utils/parallel-processor.ts
9
- async function processInParallel(items, processor, options = {}) {
10
- const {
11
- concurrency = 10,
12
- continueOnError = true,
13
- onProgress
14
- } = options;
15
- const successful = [];
16
- const failed = [];
17
- for (let i = 0; i < items.length; i += concurrency) {
18
- const batch = items.slice(i, i + concurrency);
19
- const batchResults = await Promise.allSettled(
20
- batch.map(async (item) => {
21
- try {
22
- const result = await processor(item);
23
- return { item, result, success: true };
24
- } catch (err) {
25
- const message = err instanceof Error ? err.message : String(err);
26
- if (!continueOnError) {
27
- throw new Error(`Processing failed for item: ${message}`);
28
- }
29
- return { item, error: message, success: false };
30
- }
31
- })
32
- );
33
- for (const result of batchResults) {
34
- if (result.status === "fulfilled") {
35
- if (result.value.success) {
36
- successful.push({ item: result.value.item, result: result.value.result });
37
- } else {
38
- failed.push({ item: result.value.item, error: result.value.error });
39
- }
40
- } else {
41
- const errorMessage = result.reason instanceof Error ? result.reason.message : String(result.reason);
42
- failed.push({ item: batch[batch.length - 1], error: errorMessage });
43
- }
44
- }
45
- if (onProgress) {
46
- const processed = Math.min(i + concurrency, items.length);
47
- onProgress(processed, items.length);
48
- }
49
- }
50
- return {
51
- successful,
52
- failed,
53
- totalProcessed: successful.length,
54
- totalFailed: failed.length
55
- };
56
- }
57
- async function processInParallelSimple(items, processor, concurrency = 10) {
58
- const result = await processInParallel(items, processor, { concurrency, continueOnError: true });
59
- return result.successful.map((s) => s.result);
60
- }
61
-
62
- export {
63
- __require,
64
- processInParallel,
65
- processInParallelSimple
66
- };
@@ -1,8 +0,0 @@
1
- import {
2
- processInParallel,
3
- processInParallelSimple
4
- } from "./chunk-TG3GYC5C.js";
5
- export {
6
- processInParallel,
7
- processInParallelSimple
8
- };
@@ -1,57 +0,0 @@
1
- // src/utils/parallel-processor.ts
2
- async function processInParallel(items, processor, options = {}) {
3
- const {
4
- concurrency = 10,
5
- continueOnError = true,
6
- onProgress
7
- } = options;
8
- const successful = [];
9
- const failed = [];
10
- for (let i = 0; i < items.length; i += concurrency) {
11
- const batch = items.slice(i, i + concurrency);
12
- const batchResults = await Promise.allSettled(
13
- batch.map(async (item) => {
14
- try {
15
- const result = await processor(item);
16
- return { item, result, success: true };
17
- } catch (err) {
18
- const message = err instanceof Error ? err.message : String(err);
19
- if (!continueOnError) {
20
- throw new Error(`Processing failed for item: ${message}`);
21
- }
22
- return { item, error: message, success: false };
23
- }
24
- })
25
- );
26
- for (const result of batchResults) {
27
- if (result.status === "fulfilled") {
28
- if (result.value.success) {
29
- successful.push({ item: result.value.item, result: result.value.result });
30
- } else {
31
- failed.push({ item: result.value.item, error: result.value.error });
32
- }
33
- } else {
34
- const errorMessage = result.reason instanceof Error ? result.reason.message : String(result.reason);
35
- failed.push({ item: batch[batch.length - 1], error: errorMessage });
36
- }
37
- }
38
- if (onProgress) {
39
- const processed = Math.min(i + concurrency, items.length);
40
- onProgress(processed, items.length);
41
- }
42
- }
43
- return {
44
- successful,
45
- failed,
46
- totalProcessed: successful.length,
47
- totalFailed: failed.length
48
- };
49
- }
50
- async function processInParallelSimple(items, processor, concurrency = 10) {
51
- const result = await processInParallel(items, processor, { concurrency, continueOnError: true });
52
- return result.successful.map((s) => s.result);
53
- }
54
- export {
55
- processInParallel,
56
- processInParallelSimple
57
- };