twd-js 1.3.3 → 1.4.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.
@@ -11,7 +11,7 @@ var F;
11
11
  function re() {
12
12
  if (F) return _;
13
13
  F = 1;
14
- var o = Symbol.for("react.transitional.element"), l = Symbol.for("react.fragment");
14
+ var o = /* @__PURE__ */ Symbol.for("react.transitional.element"), l = /* @__PURE__ */ Symbol.for("react.fragment");
15
15
  function i(f, s, u) {
16
16
  var m = null;
17
17
  if (u !== void 0 && (m = "" + u), s.key !== void 0 && (m = "" + s.key), "key" in s) {
@@ -226,7 +226,7 @@ React keys must be passed directly to JSX without using spread:
226
226
  function y(e) {
227
227
  return typeof e == "object" && e !== null && e.$$typeof === j;
228
228
  }
229
- var R = ee, j = Symbol.for("react.transitional.element"), W = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), q = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), V = Symbol.for("react.context"), z = Symbol.for("react.forward_ref"), G = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), Z = Symbol.for("react.client.reference"), k = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, Q = Array.isArray, O = console.createTask ? console.createTask : function() {
229
+ var R = ee, j = /* @__PURE__ */ Symbol.for("react.transitional.element"), W = /* @__PURE__ */ Symbol.for("react.portal"), v = /* @__PURE__ */ Symbol.for("react.fragment"), U = /* @__PURE__ */ Symbol.for("react.strict_mode"), q = /* @__PURE__ */ Symbol.for("react.profiler"), J = /* @__PURE__ */ Symbol.for("react.consumer"), V = /* @__PURE__ */ Symbol.for("react.context"), z = /* @__PURE__ */ Symbol.for("react.forward_ref"), G = /* @__PURE__ */ Symbol.for("react.suspense"), X = /* @__PURE__ */ Symbol.for("react.suspense_list"), B = /* @__PURE__ */ Symbol.for("react.memo"), T = /* @__PURE__ */ Symbol.for("react.lazy"), H = /* @__PURE__ */ Symbol.for("react.activity"), Z = /* @__PURE__ */ Symbol.for("react.client.reference"), k = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, Q = Array.isArray, O = console.createTask ? console.createTask : function() {
230
230
  return null;
231
231
  };
232
232
  R = {
package/dist/mock-sw.js CHANGED
@@ -1,4 +1,4 @@
1
- const h=e=>{try{return new RegExp(e),!0}catch{return!1}},u=e=>{const s=e.split("?")[0];return/\.([a-zA-Z0-9]+)$/.test(s)};function f(e,s,n){return n.find(t=>{const o=t.method.toLowerCase()===e.toLowerCase();if(t.urlRegex&&h(t.url)){const a=new RegExp(t.url);return o&&a.test(s)}if(u(t.url))return o&&s.includes(t.url);const l=t.url===s||s.includes(t.url);return o&&l&&!u(s)})}function p(e,s,n){e.forEach(t=>t.postMessage({type:"EXECUTED",alias:s.alias,request:n}))}const y=(e,s,n)=>{const o=![204,205,304].includes(s),i=o?JSON.stringify(e):null;return new Response(i,{status:s,headers:o?n||{"Content-Type":"application/json"}:n||{}})},c="1.3.3";let r=[];const g=async e=>{const{method:s}=e.request,n=e.request.url,t=f(s,n,r);t&&(console.log("[TWD] Mock hit:",t.alias,s,n),e.respondWith((async()=>{let o=null;const i=e.request.headers.get("content-type")||"application/json";if(i.includes("application/json"))try{o=await e.request.clone().json()}catch{}else if(i.includes("form"))try{const l=await e.request.clone().formData();o={},l.forEach((a,d)=>{o[d]=a})}catch{}else if(i.includes("text"))try{o=await e.request.clone().text()}catch{}else if(i.includes("octet-stream"))try{o=await e.request.clone().arrayBuffer()}catch{}else if(i.includes("image"))try{o=await e.request.clone().blob()}catch{}else try{o=await e.request.clone().text()}catch{}return self.clients.matchAll().then(l=>{p(l,t,o)}),y(t.response,t.status??200,t.responseHeaders)})()))},m=e=>{e!==c&&console.warn(`[TWD] ⚠️ Version mismatch detected:
1
+ const h=e=>{try{return new RegExp(e),!0}catch{return!1}},u=e=>{const s=e.split("?")[0];return/\.([a-zA-Z0-9]+)$/.test(s)};function f(e,s,n){return n.find(t=>{const o=t.method.toLowerCase()===e.toLowerCase();if(t.urlRegex&&h(t.url)){const a=new RegExp(t.url);return o&&a.test(s)}if(u(t.url))return o&&s.includes(t.url);const l=t.url===s||s.includes(t.url);return o&&l&&!u(s)})}function p(e,s,n){e.forEach(t=>t.postMessage({type:"EXECUTED",alias:s.alias,request:n}))}const y=(e,s,n)=>{const o=![204,205,304].includes(s),i=o?JSON.stringify(e):null;return new Response(i,{status:s,headers:o?n||{"Content-Type":"application/json"}:n||{}})},c="1.4.0";let r=[];const g=async e=>{const{method:s}=e.request,n=e.request.url,t=f(s,n,r);t&&(console.log("[TWD] Mock hit:",t.alias,s,n),e.respondWith((async()=>{let o=null;const i=e.request.headers.get("content-type")||"application/json";if(i.includes("application/json"))try{o=await e.request.clone().json()}catch{}else if(i.includes("form"))try{const l=await e.request.clone().formData();o={},l.forEach((a,d)=>{o[d]=a})}catch{}else if(i.includes("text"))try{o=await e.request.clone().text()}catch{}else if(i.includes("octet-stream"))try{o=await e.request.clone().arrayBuffer()}catch{}else if(i.includes("image"))try{o=await e.request.clone().blob()}catch{}else try{o=await e.request.clone().text()}catch{}return self.clients.matchAll().then(l=>{p(l,t,o)}),y(t.response,t.status??200,t.responseHeaders)})()))},m=e=>{e!==c&&console.warn(`[TWD] ⚠️ Version mismatch detected:
2
2
  Client version: ${e}
3
3
  Service Worker version: ${c}
4
4
 
package/dist/ui.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { g as r, j as e } from "./jsx-runtime-DqUUEvWR.mjs";
1
+ import { g as r, j as e } from "./jsx-runtime-BGWd3k7q.mjs";
2
2
  function s({
3
3
  name: n,
4
4
  children: o
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twd-js",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "Test While Developing (TWD) - in-browser testing",
5
5
  "license": "MIT",
6
6
  "author": "BRIKEV",
@@ -67,7 +67,9 @@
67
67
  "dev": "vite",
68
68
  "docs:dev": "vitepress dev docs",
69
69
  "docs:build": "vitepress build docs",
70
- "docs:preview": "vitepress preview docs"
70
+ "docs:preview": "vitepress preview docs",
71
+ "copy:mock-sw": "cp src/dist/mock-sw.js examples/twd-test-app/public/mock-sw.js && cp src/dist/mock-sw.js examples/tutorial-example/public/mock-sw.js && cp src/dist/mock-sw.js examples/vue-twd-example/public/mock-sw.js",
72
+ "copy:dist:vue-twd-example": "cp -r dist examples/vue-twd-example/src"
71
73
  },
72
74
  "peerDependencies": {
73
75
  "react": ">=17.0.0",
@@ -76,18 +78,18 @@
76
78
  "devDependencies": {
77
79
  "@preact/preset-vite": "^2.10.2",
78
80
  "@testing-library/jest-dom": "^6.9.1",
79
- "@testing-library/react": "^16.3.0",
81
+ "@testing-library/react": "^16.3.1",
80
82
  "@types/react": "^19.2.7",
81
83
  "@types/react-dom": "^19.2.3",
82
- "@vitejs/plugin-react": "^5.1.1",
83
- "@vitest/coverage-v8": "^4.0.15",
84
+ "@vitejs/plugin-react": "^5.1.2",
85
+ "@vitest/coverage-v8": "^4.0.16",
84
86
  "conventional-changelog": "^7.1.1",
85
- "jsdom": "^27.2.0",
87
+ "jsdom": "^27.4.0",
86
88
  "typescript": "^5.9.3",
87
- "vite": "^7.2.6",
89
+ "vite": "^7.3.1",
88
90
  "vite-plugin-dts": "^4.5.4",
89
91
  "vitepress": "^2.0.0-alpha.12",
90
- "vitest": "^4.0.15"
92
+ "vitest": "^4.0.16"
91
93
  },
92
94
  "keywords": [
93
95
  "testing",
@@ -103,7 +105,7 @@
103
105
  "@testing-library/dom": "^10.4.1",
104
106
  "@testing-library/user-event": "^14.6.1",
105
107
  "@types/chai": "^5.2.3",
106
- "chai": "^6.2.1",
107
- "preact": "^10.28.0"
108
+ "chai": "^6.2.2",
109
+ "preact": "^10.28.2"
108
110
  }
109
111
  }