@mdwrk/mdwrkspace 1.4.19 → 1.4.28

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/dist/sw.js CHANGED
@@ -1,15 +1,20 @@
1
- const CACHE_PREFIX = 'lattice-architect-';
2
- const META_CACHE = 'lattice-architect-meta';
3
- const META_KEY = '/pwa-meta';
4
- const CURRENT_VERSION = new URL(self.location.href).searchParams.get('version') || 'dev';
1
+ const SCOPE_URL = new URL(self.registration.scope);
2
+ const SCOPE_PATH = SCOPE_URL.pathname.endsWith('/') ? SCOPE_URL.pathname : `${SCOPE_URL.pathname}/`;
3
+ const SCOPE_KEY = SCOPE_PATH.replace(/[^\w-]+/g, '_');
4
+ const VERSION_MATCH = SCOPE_PATH.match(/\/client\/versions\/([^/]+)\//);
5
+ const CURRENT_VERSION = VERSION_MATCH?.[1] || 'dev';
6
+ const CACHE_PREFIX = `mdwork-${SCOPE_KEY}-`;
7
+ const META_CACHE = 'mdwork-meta';
8
+ const META_KEY = `/pwa-meta/${SCOPE_KEY}`;
5
9
  const CURRENT_CACHE = `${CACHE_PREFIX}${CURRENT_VERSION}`;
10
+ const INDEX_CACHE_KEY = `${SCOPE_PATH}index.html`;
6
11
  const CORE_ASSETS = [
7
- '/',
8
- '/index.html',
9
- '/manifest.webmanifest',
10
- '/favicon.svg',
11
- '/icons/icon-192.svg',
12
- '/icons/icon-512.svg',
12
+ SCOPE_PATH,
13
+ INDEX_CACHE_KEY,
14
+ `${SCOPE_PATH}manifest.webmanifest`,
15
+ `${SCOPE_PATH}favicon.svg`,
16
+ `${SCOPE_PATH}icons/icon-192.svg`,
17
+ `${SCOPE_PATH}icons/icon-512.svg`,
13
18
  ];
14
19
  const EXTERNAL_ASSETS = [
15
20
  'https://cdn.tailwindcss.com',
@@ -69,53 +74,19 @@ const isFailedVersion = (version) => metaState.failedVersions.includes(version);
69
74
 
70
75
  const getCacheNameForVersion = (version) => `${CACHE_PREFIX}${version}`;
71
76
 
72
- const isAppCache = (name) => name.startsWith(CACHE_PREFIX);
73
-
74
- const findFallbackResponse = async (request, cacheNames) => {
75
- for (const cacheName of cacheNames) {
76
- const cache = await caches.open(cacheName);
77
- const cachedResponse = await cache.match(request);
78
- if (cachedResponse) {
79
- return cachedResponse;
80
- }
81
- }
82
- return undefined;
83
- };
84
-
85
- const getFallbackCacheNames = async (activeCacheName) => {
86
- const cacheNames = await caches.keys();
87
- const appCacheNames = cacheNames.filter(isAppCache);
88
- const prioritized = [];
89
-
90
- if (activeCacheName && appCacheNames.includes(activeCacheName)) {
91
- prioritized.push(activeCacheName);
92
- }
93
-
94
- if (CURRENT_CACHE !== activeCacheName && appCacheNames.includes(CURRENT_CACHE)) {
95
- prioritized.push(CURRENT_CACHE);
77
+ const normalizeRequest = (request) => {
78
+ if (typeof request === 'string') {
79
+ return request;
96
80
  }
97
-
98
- if (metaState.lastKnownGoodVersion) {
99
- const lastKnownGoodCache = getCacheNameForVersion(metaState.lastKnownGoodVersion);
100
- if (!prioritized.includes(lastKnownGoodCache) && appCacheNames.includes(lastKnownGoodCache)) {
101
- prioritized.push(lastKnownGoodCache);
102
- }
103
- }
104
-
105
- appCacheNames.forEach((cacheName) => {
106
- if (!prioritized.includes(cacheName)) {
107
- prioritized.push(cacheName);
108
- }
109
- });
110
-
111
- return prioritized;
81
+ const url = new URL(request.url);
82
+ return url.toString();
112
83
  };
113
84
 
114
85
  const getCachedAppShell = async (activeCacheName) => {
115
- const fallbackCacheNames = await getFallbackCacheNames(activeCacheName);
86
+ const cache = await caches.open(activeCacheName);
116
87
  return (
117
- (await findFallbackResponse('/index.html', fallbackCacheNames)) ||
118
- (await findFallbackResponse('/', fallbackCacheNames))
88
+ (await cache.match(INDEX_CACHE_KEY)) ||
89
+ (await cache.match(SCOPE_PATH))
119
90
  );
120
91
  };
121
92
 
@@ -131,7 +102,7 @@ const isSuccessfulResponse = (response) => Boolean(response) && response.ok;
131
102
  const fetchAndCache = async ({ request, cache, cacheKey = request, allowOpaque = false }) => {
132
103
  const response = await fetch(request);
133
104
  if (isSuccessfulResponse(response) || (allowOpaque && response.type === 'opaque')) {
134
- cache.put(cacheKey, response.clone());
105
+ await cache.put(cacheKey, response.clone());
135
106
  return response;
136
107
  }
137
108
  return undefined;
@@ -179,7 +150,11 @@ self.addEventListener('activate', (event) => {
179
150
  if (metaState.lastKnownGoodVersion) {
180
151
  keep.add(getCacheNameForVersion(metaState.lastKnownGoodVersion));
181
152
  }
182
- await Promise.all(keys.filter((key) => !keep.has(key)).map((key) => caches.delete(key)));
153
+ await Promise.all(
154
+ keys
155
+ .filter((key) => key.startsWith(CACHE_PREFIX) && !keep.has(key))
156
+ .map((key) => caches.delete(key))
157
+ );
183
158
  await self.clients.claim();
184
159
  if ('periodicSync' in self.registration) {
185
160
  try {
@@ -264,11 +239,6 @@ self.addEventListener('fetch', (event) => {
264
239
  if (cachedResponse) {
265
240
  return cachedResponse;
266
241
  }
267
- const fallbackCacheNames = await getFallbackCacheNames(getActiveCacheName());
268
- const crossCacheResponse = await findFallbackResponse(event.request, fallbackCacheNames);
269
- if (crossCacheResponse) {
270
- return crossCacheResponse;
271
- }
272
242
  throw error;
273
243
  }
274
244
  })()
@@ -285,7 +255,7 @@ self.addEventListener('fetch', (event) => {
285
255
  const response = await fetchAndCache({
286
256
  request: event.request,
287
257
  cache,
288
- cacheKey: '/index.html',
258
+ cacheKey: INDEX_CACHE_KEY,
289
259
  });
290
260
  if (!response) {
291
261
  throw new Error('Navigation response was not successful');
@@ -293,13 +263,13 @@ self.addEventListener('fetch', (event) => {
293
263
  return response;
294
264
  } catch (error) {
295
265
  const cache = await caches.open(activeCacheName);
296
- const cachedResponse = await cache.match('/index.html');
266
+ const cachedResponse = await cache.match(INDEX_CACHE_KEY);
297
267
  if (cachedResponse) {
298
268
  return cachedResponse;
299
269
  }
300
- const crossCacheAppShell = await getCachedAppShell(activeCacheName);
301
- if (crossCacheAppShell) {
302
- return crossCacheAppShell;
270
+ const cachedAppShell = await getCachedAppShell(activeCacheName);
271
+ if (cachedAppShell) {
272
+ return cachedAppShell;
303
273
  }
304
274
  throw error;
305
275
  }
@@ -311,9 +281,9 @@ self.addEventListener('fetch', (event) => {
311
281
  event.respondWith(
312
282
  (async () => {
313
283
  const cache = await caches.open(getActiveCacheName());
314
- const cachedResponse = await cache.match(event.request);
315
-
316
- const fetchPromise = fetchAndCache({ request: event.request, cache, allowOpaque: true }).catch(() => undefined);
284
+ const cacheKey = normalizeRequest(event.request);
285
+ const cachedResponse = await cache.match(cacheKey) || await cache.match(event.request);
286
+ const fetchPromise = fetchAndCache({ request: event.request, cache, cacheKey, allowOpaque: true }).catch(() => undefined);
317
287
 
318
288
  if (cachedResponse) {
319
289
  event.waitUntil(fetchPromise);
@@ -328,7 +298,7 @@ self.addEventListener('fetch', (event) => {
328
298
  if (cachedAppShell) {
329
299
  return cachedAppShell;
330
300
  }
331
- return caches.match('/index.html');
301
+ return caches.match(INDEX_CACHE_KEY);
332
302
  })()
333
303
  );
334
304
  });
package/package.json CHANGED
@@ -1,18 +1,22 @@
1
1
  {
2
2
  "name": "@mdwrk/mdwrkspace",
3
3
  "private": false,
4
- "version": "1.4.19",
4
+ "version": "1.4.28",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
- "build": "tsc && vite build",
9
- "build:lib": "tsc && vite build --config vite.lib.config.ts",
8
+ "build:deps": "npm --prefix ../.. run build:extensions",
9
+ "build:no-deps": "tsc && node ../../tools/release/build-versioned-client.mjs",
10
+ "build": "npm run build:deps && tsc && node ../../tools/release/build-versioned-client.mjs",
11
+ "build:lib:no-deps": "tsc && vite build --config vite.lib.config.ts",
12
+ "build:lib": "npm run build:deps && tsc && vite build --config vite.lib.config.ts",
10
13
  "preview": "vite preview",
11
14
  "test": "vitest",
12
15
  "test:ui": "vitest --ui",
13
16
  "test:run": "vitest run",
14
17
  "screenshots:matrix": "node ./tests/generate-theme-screenshots.mjs",
15
- "typecheck": "tsc --noEmit -p tsconfig.json",
18
+ "typecheck:no-deps": "tsc --noEmit -p tsconfig.json",
19
+ "typecheck": "npm run build:deps && tsc --noEmit -p tsconfig.json",
16
20
  "lint": "npm run typecheck",
17
21
  "prepack": "npm run build:lib"
18
22
  },
@@ -29,25 +33,28 @@
29
33
  "access": "public"
30
34
  },
31
35
  "dependencies": {
32
- "@mdwrk/extension-gemini-agent": "^1.1.1",
33
- "@mdwrk/extension-host": "^1.0.2",
34
- "@mdwrk/extension-language-pack-studio": "^1.0.3",
35
- "@mdwrk/extension-manager": "^1.1.6",
36
- "@mdwrk/extension-manifest": "^1.0.1",
37
- "@mdwrk/extension-runtime": "^1.1.3",
38
- "@mdwrk/i18n": "^1.2.1",
39
- "@mdwrk/icons": "^1.0.1",
40
- "@mdwrk/markdown-editor-react": "^1.1.1",
41
- "@mdwrk/markdown-renderer-core": "^1.1.1",
42
- "@mdwrk/markdown-renderer-react": "^1.1.1",
43
- "@mdwrk/theme-contract": "^1.1.1",
44
- "@mdwrk/ui-tokens": "^1.2.1",
36
+ "@mdwrk/extension-gemini-agent": "^1.2.2",
37
+ "@mdwrk/extension-git-ops": "^1.2.2",
38
+ "@mdwrk/extension-host": "^1.0.5",
39
+ "@mdwrk/extension-language-pack-studio": "^1.0.6",
40
+ "@mdwrk/extension-manager": "^1.2.2",
41
+ "@mdwrk/extension-manifest": "^1.0.3",
42
+ "@mdwrk/extension-runtime": "^1.2.2",
43
+ "@mdwrk/extension-workspace-files": "^1.2.2",
44
+ "@mdwrk/i18n": "^1.2.4",
45
+ "@mdwrk/icons": "^1.0.3",
46
+ "@mdwrk/markdown-edit-in-renderer-react": "^1.0.11",
47
+ "@mdwrk/markdown-editor-react": "^1.1.6",
48
+ "@mdwrk/markdown-renderer-core": "^1.1.6",
49
+ "@mdwrk/markdown-renderer-react": "^1.1.6",
50
+ "@mdwrk/theme-contract": "^1.1.3",
51
+ "@mdwrk/ui-tokens": "^1.2.4",
45
52
  "jszip": "^3.10.1",
46
53
  "lucide-react": "^0.475.0",
47
54
  "react": "^19.0.0",
48
55
  "react-dom": "^19.0.0",
49
56
  "react-syntax-highlighter": "^15.6.1",
50
- "@mdwrk/extension-theme-studio": "^1.1.5"
57
+ "@mdwrk/extension-theme-studio": "^1.2.2"
51
58
  },
52
59
  "devDependencies": {
53
60
  "@testing-library/dom": "^10.4.0",
@@ -1,18 +0,0 @@
1
- import { l as e } from "./esm-entry-DRKc2b9U.js";
2
- const a = {
3
- locale: "en",
4
- messages: {
5
- [e.manifestDisplayName.key]: e.manifestDisplayName.defaultMessage,
6
- [e.manifestDescription.key]: e.manifestDescription.defaultMessage,
7
- [e.commandOpenTitle.key]: e.commandOpenTitle.defaultMessage,
8
- [e.commandOpenDescription.key]: e.commandOpenDescription.defaultMessage,
9
- [e.viewTitle.key]: e.viewTitle.defaultMessage,
10
- [e.viewDescription.key]: e.viewDescription.defaultMessage,
11
- [e.railTitle.key]: e.railTitle.defaultMessage,
12
- [e.settingsTitle.key]: e.settingsTitle.defaultMessage,
13
- [e.settingsDescription.key]: e.settingsDescription.defaultMessage
14
- }
15
- };
16
- export {
17
- a as languagePackStudioEnCatalog
18
- };
@@ -1,56 +0,0 @@
1
- const e = {
2
- locale: "es",
3
- messages: {
4
- "manifest.displayName": "Agente Gemini",
5
- "manifest.description": "Asistente Gemini integrado para resumir archivos, redactar reescrituras de selecciones y preparar escrituras seguras.",
6
- "commands.open.title": "Abrir Agente Gemini",
7
- "commands.open.description": "Abre la vista operativa del Agente Gemini.",
8
- "commands.summarize.title": "Resumir archivo actual",
9
- "commands.summarize.description": "Resume el documento markdown activo en la vista del Agente Gemini.",
10
- "commands.rewrite.title": "Redactar reescritura de la selección",
11
- "commands.rewrite.description": "Genera un borrador de reescritura para la selección actual en la vista del Agente Gemini.",
12
- "commands.applySelection.title": "Aplicar borrador Gemini a la selección",
13
- "commands.applySelection.description": "Aplica el borrador actual de Gemini a la selección activa cuando la escritura está habilitada.",
14
- "commands.replaceDocument.title": "Reemplazar documento con borrador Gemini",
15
- "commands.replaceDocument.description": "Reemplaza el documento actual con el último borrador de Gemini cuando la escritura está habilitada.",
16
- "view.title": "Agente Gemini",
17
- "view.description": "Ejecuta flujos Gemini sobre el documento markdown activo y gestiona la escritura segura de borradores.",
18
- "rail.title": "Gemini",
19
- "settings.title": "Configuración del Agente Gemini",
20
- "settings.description": "Configura la conectividad del proveedor, el contexto automático y el comportamiento de escritura segura de la extensión Gemini.",
21
- "settings.sections.general.title": "Proveedor",
22
- "settings.sections.general.description": "Configura el endpoint de Gemini, el modelo, la autenticación y el comportamiento de la solicitud.",
23
- "settings.sections.context.title": "Contexto",
24
- "settings.sections.context.description": "Controla cómo se adjuntan el documento activo y la selección actual a los prompts ad hoc.",
25
- "settings.sections.writeback.title": "Escritura",
26
- "settings.sections.writeback.description": "Controla si los borradores de Gemini pueden aplicarse explícitamente de nuevo en el editor.",
27
- "status.configured": "Configurado",
28
- "status.missingConfiguration": "Falta configuración",
29
- "status.writebackDisabled": "Escritura deshabilitada",
30
- "status.writebackEnabled": "Escritura habilitada",
31
- "status.idle": "Listo",
32
- "status.running": "Ejecutando solicitud Gemini…",
33
- "panel.title": "Agente Gemini",
34
- "panel.subtitle": "Flujos con contexto de documento, borradores por selección y escritura explícita segura.",
35
- "panel.close": "Cerrar",
36
- "panel.refresh": "Actualizar contexto",
37
- "panel.runPrompt": "Ejecutar prompt",
38
- "panel.summarize": "Resumir archivo",
39
- "panel.rewriteSelection": "Redactar reescritura de la selección",
40
- "panel.applySelection": "Aplicar borrador a la selección",
41
- "panel.replaceDocument": "Reemplazar documento con borrador",
42
- "panel.clearDraft": "Limpiar borrador",
43
- "panel.clearResult": "Limpiar respuesta",
44
- "panel.context": "Contexto",
45
- "panel.response": "Respuesta",
46
- "panel.draft": "Borrador",
47
- "panel.settings": "Configuración efectiva",
48
- "panel.prompt": "Prompt",
49
- "panel.lastError": "Último error",
50
- "panel.lastInfo": "Estado",
51
- "diagnostics.ready": "Agente Gemini activado correctamente."
52
- }
53
- };
54
- export {
55
- e as geminiAgentEsCatalog
56
- };
@@ -1,29 +0,0 @@
1
- import { T as e } from "./esm-entry-DRKc2b9U.js";
2
- const r = {
3
- locale: "es",
4
- messages: {
5
- [`${e}.manifest.displayName`]: "Estudio de Temas",
6
- [`${e}.manifest.description`]: "Extensión integrada para crear temas, inspeccionar tokens, previsualizar puentes de render/editor y exportar artefactos portátiles.",
7
- [`${e}.commands.open.title`]: "Abrir Estudio de Temas",
8
- [`${e}.commands.open.description`]: "Abre el espacio integrado de edición de temas.",
9
- [`${e}.view.title`]: "Estudio de Temas",
10
- [`${e}.view.description`]: "Inspecciona, previsualiza, aplica, revierte y exporta temas según el contrato formal de tokens y clases.",
11
- [`${e}.rail.title`]: "Temas",
12
- [`${e}.panel.header.title`]: "Estudio de Temas",
13
- [`${e}.panel.header.subtitle`]: "Inspector de tokens, inspector de relaciones clase/token, vistas previas de render/editor y exportaciones portátiles.",
14
- [`${e}.panel.actions.close`]: "Cerrar",
15
- [`${e}.panel.actions.refresh`]: "Actualizar",
16
- [`${e}.panel.actions.preview`]: "Previsualizar borrador",
17
- [`${e}.panel.actions.apply`]: "Aplicar borrador",
18
- [`${e}.panel.actions.revert`]: "Revertir borrador",
19
- [`${e}.panel.actions.export`]: "Generar exportaciones",
20
- [`${e}.status.ready`]: "Listo",
21
- [`${e}.status.busy`]: "Procesando…",
22
- [`${e}.status.applied`]: "Borrador aplicado",
23
- [`${e}.status.reverted`]: "Borrador revertido",
24
- [`${e}.status.exported`]: "Exportaciones generadas"
25
- }
26
- };
27
- export {
28
- r as themeStudioEsCatalog
29
- };