@markless/bundler 0.6.0 → 0.7.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.
|
@@ -5,6 +5,7 @@ const MARKLESS_DEV_ERROR_CLEAR_EVENT = "markless:dev-error-clear";
|
|
|
5
5
|
const MARKLESS_DEV_ERROR_CLIENT_ID = "virtual:markless:dev-error-client";
|
|
6
6
|
const MARKLESS_DEV_RELOADS_EVENT = "markless:dev-reloads";
|
|
7
7
|
const MARKLESS_DEV_RELOADS_ATTRIBUTE = "data-markless-dev-reloads";
|
|
8
|
+
const MARKLESS_DEV_PAGE_EDIT_EVENT = "markless:dev-page-edit";
|
|
8
9
|
const PLUGIN_CODE_KIND = "markless-dev-error";
|
|
9
10
|
const PLUGIN_CODE_VERSION = 1;
|
|
10
11
|
var MarklessCompileError = class extends Error {
|
|
@@ -173,4 +174,4 @@ const documentStyles = `
|
|
|
173
174
|
.panel{width:min(60rem,100%);padding:clamp(1.25rem,3vw,2.5rem);border:1px solid color-mix(in srgb,CanvasText 20%,transparent);border-top:4px solid #c9362b;border-radius:.5rem;background:Canvas;box-shadow:0 1rem 3rem #0002}
|
|
174
175
|
header{display:flex;flex-direction:column;gap:.6rem;margin-bottom:1rem}.badge{align-self:flex-start;padding:.15rem .45rem;border-radius:.25rem;background:color-mix(in srgb,#c9362b 14%,Canvas);color:#c9362b;font:600 .75rem ui-monospace,monospace}h1{margin:0;font-size:clamp(1.4rem,3vw,2rem);line-height:1.2}h2{margin:1rem 0 .25rem;font-size:.8rem;text-transform:uppercase;letter-spacing:.06em;color:color-mix(in srgb,CanvasText 65%,transparent)}p{margin:.3rem 0 1rem;line-height:1.55}a{color:LinkText}.location{display:inline-block;margin-bottom:.5rem;font:500 .9rem ui-monospace,monospace}.frame,details pre{overflow:auto;padding:1rem;border-radius:.35rem;background:color-mix(in srgb,CanvasText 7%,Canvas);font: .85rem/1.55 ui-monospace,monospace;white-space:pre}details{margin-top:1rem;border-top:1px solid color-mix(in srgb,CanvasText 15%,transparent);padding-top:1rem}summary{cursor:pointer;font-weight:600}.recovery{margin:1.5rem 0 0;color:color-mix(in srgb,CanvasText 65%,transparent);font-size:.9rem}`;
|
|
175
176
|
//#endregion
|
|
176
|
-
export {
|
|
177
|
+
export { MARKLESS_DEV_RELOADS_ATTRIBUTE as a, createCompileErrorPayload as c, renderMarklessDevErrorDocument as d, renderMarklessDevErrorPlainText as f, MARKLESS_DEV_PAGE_EDIT_EVENT as i, formatMarklessSourceFrame as l, MARKLESS_DEV_ERROR_CLIENT_ID as n, MARKLESS_DEV_RELOADS_EVENT as o, serializeMarklessDevError as p, MARKLESS_DEV_ERROR_EVENT as r, MarklessCompileError as s, MARKLESS_DEV_ERROR_CLEAR_EVENT as t, normalizeMarklessDevError as u };
|
package/dist/dev-error.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const MARKLESS_DEV_ERROR_CLEAR_EVENT = "markless:dev-error-clear"
|
|
|
5
5
|
export declare const MARKLESS_DEV_ERROR_CLIENT_ID = "virtual:markless:dev-error-client";
|
|
6
6
|
export declare const MARKLESS_DEV_RELOADS_EVENT = "markless:dev-reloads";
|
|
7
7
|
export declare const MARKLESS_DEV_RELOADS_ATTRIBUTE = "data-markless-dev-reloads";
|
|
8
|
+
export declare const MARKLESS_DEV_PAGE_EDIT_EVENT = "markless:dev-page-edit";
|
|
8
9
|
export interface MarklessDevDiagnostic {
|
|
9
10
|
readonly code: string;
|
|
10
11
|
readonly message: string;
|
package/dist/dev-error.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { MARKLESS_DEV_ERROR_CLEAR_EVENT, MARKLESS_DEV_ERROR_CLIENT_ID, MARKLESS_DEV_ERROR_EVENT, MARKLESS_DEV_RELOADS_ATTRIBUTE, MARKLESS_DEV_RELOADS_EVENT, MarklessCompileError, createCompileErrorPayload, formatMarklessSourceFrame, normalizeMarklessDevError, renderMarklessDevErrorDocument, renderMarklessDevErrorPlainText, serializeMarklessDevError };
|
|
1
|
+
import { a as MARKLESS_DEV_RELOADS_ATTRIBUTE, c as createCompileErrorPayload, d as renderMarklessDevErrorDocument, f as renderMarklessDevErrorPlainText, i as MARKLESS_DEV_PAGE_EDIT_EVENT, l as formatMarklessSourceFrame, n as MARKLESS_DEV_ERROR_CLIENT_ID, o as MARKLESS_DEV_RELOADS_EVENT, p as serializeMarklessDevError, r as MARKLESS_DEV_ERROR_EVENT, s as MarklessCompileError, t as MARKLESS_DEV_ERROR_CLEAR_EVENT, u as normalizeMarklessDevError } from "./dev-error-BEduK_R3.js";
|
|
2
|
+
export { MARKLESS_DEV_ERROR_CLEAR_EVENT, MARKLESS_DEV_ERROR_CLIENT_ID, MARKLESS_DEV_ERROR_EVENT, MARKLESS_DEV_PAGE_EDIT_EVENT, MARKLESS_DEV_RELOADS_ATTRIBUTE, MARKLESS_DEV_RELOADS_EVENT, MarklessCompileError, createCompileErrorPayload, formatMarklessSourceFrame, normalizeMarklessDevError, renderMarklessDevErrorDocument, renderMarklessDevErrorPlainText, serializeMarklessDevError };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as createCompileErrorPayload, s as MarklessCompileError } from "./dev-error-BEduK_R3.js";
|
|
2
2
|
import { $ as MARKLESS_BUNDLE_GRAPH, A as isSymbolOnlySourceRequest, At as executionLogVirtualModuleSource, B as sourceForResumeVirtualImporter, C as isMarklessRuntimeModule, Ct as symbolVirtualModuleId, D as isResumeSourceRequest, Dt as MARKLESS_EXECUTION_LOG_GLOBAL, E as isRenderDataSourceRequest, Et as EXECUTION_LOG_DISPATCH_MODULE_IDS, F as resolveVirtualId, Ft as requalifyExecutionLogModuleHook, G as virtualModuleSourceForLoad, H as sourceForSymbolVirtualImporter, I as resolverVirtualModuleSourceFile, J as planPrerenderTriggerGroups, K as emitPrerenderBoundaryRendererModule, L as serverSharedSourceRequest, Lt as planModulePreloads, M as normalizeVirtualId$2, Mt as injectExecutionLogModuleHook, N as pathname$1, O as isRouteNavigationSourceRequest, Ot as MARKLESS_EXECUTION_LOG_MODULE_ID, P as renderDataReachedFromQuery, Pt as normalizeExecutionLogMode, Q as MARKLESS_BUILD_PREFIX, R as sharedReachedRenderDataRequest, S as isClientPrimarySourceRequest, St as symbolEntryVirtualModuleId, T as isRelativeImport, Tt as withoutFirstUse, U as sourceForTriggerGroupVirtualImporter, V as sourceForSettleVirtualImporter, W as stripBuildPrefix, X as adaptImportedCaptureResolver, Y as triggerGroupVirtualModuleId, Z as MARKLESS_BUILD_METADATA_FILES, _ as clientSymbolEntries, a as isStartupPack, at as outputDefaults, b as emittedBundleModuleIds, bt as scopedSymbolExportName, c as planRoutePackGroups, d as warmPacksSuffix, dt as emitResumeModule, et as MARKLESS_BYTE_ATTRIBUTION, f as MARKLESS_INTERACTION_CLOSURES_ASSET, ft as emitSettleModule, g as clientRouteArtifactReference, gt as prerenderWakeVirtualModuleId, h as TSRX_SOURCE_FILE$1, ht as payloadModule, it as MARKLESS_PUBLIC_BUILD_METADATA_FILES, j as materializedReachedRenderDataSource, jt as hasExecutionLogModuleHook, k as isScalarPlanSourceRequest, kt as executionLogActivationInjection, l as startupPackOfLazy, lt as demandsOverlay, m as MARKLESS_ROUTE_SOURCE_QUERY_RE, mt as encodedSymbolSource, nt as MARKLESS_EXECUTION_SIZES, ot as MARKLESS_VIRTUAL_PREFIX, pt as emitSourceModule, q as emitPrerenderTriggerGroupModule, rt as MARKLESS_INTERACTION_CLOSURES, s as marklessDeferredChunkFileNames, tt as MARKLESS_EXECUTION_DEMAND, ut as emitOverlayLoaderInstall, v as devBrowserSourceModuleUrl, vt as resumeVirtualModuleId, w as isPrerenderWakeSourceRequest, wt as symbolVirtualModuleSourceFile, x as executionLogRuntimeModuleId, xt as settleVirtualModuleId, y as devBrowserVirtualModuleUrl, yt as rewriteSymbolModuleExport, z as sourceForPrerenderWakeVirtualImporter } from "./route-pack-groups-BXc755qH.js";
|
|
3
3
|
import { joinURL, parsePath, withLeadingSlash, withQuery, withoutLeadingSlash } from "ufo";
|
|
4
4
|
import { PROTOCOL_EVENT_ACTION_KIND, PROTOCOL_IDLE_EVENT_NAME, createStorageSeedMetadataFromGraphNodeId, jsonSourceWithNonFiniteNumbers } from "@markless/serializer";
|
|
@@ -9264,4 +9264,4 @@ function pluginName(environment) {
|
|
|
9264
9264
|
return `markless:rolldown:${environment}`;
|
|
9265
9265
|
}
|
|
9266
9266
|
//#endregion
|
|
9267
|
-
export { createInlineDeferTriggerSource as A, MARKLESS_IMPORT_MAP_ASSET as C, preflightTsrxModuleDiagnostics as D, prefetchChunkParses as E, transformTsrxModule as O, MARKLESS_CHUNK_SPECIFIER_PREFIX as S, insertImportMapScript as T, createPreloadGraphAdder as _, collapseInitFacadeImports as a, marklessBuildManifestPath as b, collectHeadLinkInjections as c, nativePackingEnabled as d, nativePackingPlugins as f, convertManifestToBundleGraph as g, withUndemandedReExportDoors as h, marklessServer as i, inlineDeferSource as j, INLINE_DEFER_LOADER_SOURCE as k, marklessRuntimeSpecifierId as l, undemandedRuntimeModules as m, marklessClient as n, unwrapAsyncImportWrappers as o, isReExportDoor as p, marklessLib as r, createBuildMetadata as s, createMarklessRolldownPlugin as t, DEPRECATED_NATIVE_PACKING_WARNING as u, runtimeModuleIdFromOrigin as v, importMapScript as w, marklessImportMapPath as x, marklessBuildManifestDir as y };
|
|
9267
|
+
export { createInlineDeferTriggerSource as A, MARKLESS_IMPORT_MAP_ASSET as C, preflightTsrxModuleDiagnostics as D, prefetchChunkParses as E, moduleIdFor as M, transformTsrxModule as O, MARKLESS_CHUNK_SPECIFIER_PREFIX as S, insertImportMapScript as T, createPreloadGraphAdder as _, collapseInitFacadeImports as a, marklessBuildManifestPath as b, collectHeadLinkInjections as c, nativePackingEnabled as d, nativePackingPlugins as f, convertManifestToBundleGraph as g, withUndemandedReExportDoors as h, marklessServer as i, inlineDeferSource as j, INLINE_DEFER_LOADER_SOURCE as k, marklessRuntimeSpecifierId as l, undemandedRuntimeModules as m, marklessClient as n, unwrapAsyncImportWrappers as o, isReExportDoor as p, marklessLib as r, createBuildMetadata as s, createMarklessRolldownPlugin as t, DEPRECATED_NATIVE_PACKING_WARNING as u, runtimeModuleIdFromOrigin as v, importMapScript as w, marklessImportMapPath as x, marklessBuildManifestDir as y };
|
package/dist/rolldown.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { $ as MARKLESS_BUNDLE_GRAPH, Q as MARKLESS_BUILD_PREFIX, Z as MARKLESS_BUILD_METADATA_FILES, at as outputDefaults, gt as prerenderWakeVirtualModuleId, it as MARKLESS_PUBLIC_BUILD_METADATA_FILES, ot as MARKLESS_VIRTUAL_PREFIX, vt as resumeVirtualModuleId } from "./route-pack-groups-BXc755qH.js";
|
|
2
|
-
import { C as MARKLESS_IMPORT_MAP_ASSET, O as transformTsrxModule, S as MARKLESS_CHUNK_SPECIFIER_PREFIX, T as insertImportMapScript, _ as createPreloadGraphAdder, b as marklessBuildManifestPath, c as collectHeadLinkInjections, g as convertManifestToBundleGraph, i as marklessServer, n as marklessClient, r as marklessLib, s as createBuildMetadata, t as createMarklessRolldownPlugin, w as importMapScript, x as marklessImportMapPath, y as marklessBuildManifestDir } from "./rolldown-
|
|
2
|
+
import { C as MARKLESS_IMPORT_MAP_ASSET, O as transformTsrxModule, S as MARKLESS_CHUNK_SPECIFIER_PREFIX, T as insertImportMapScript, _ as createPreloadGraphAdder, b as marklessBuildManifestPath, c as collectHeadLinkInjections, g as convertManifestToBundleGraph, i as marklessServer, n as marklessClient, r as marklessLib, s as createBuildMetadata, t as createMarklessRolldownPlugin, w as importMapScript, x as marklessImportMapPath, y as marklessBuildManifestDir } from "./rolldown-DpkfQO1h.js";
|
|
3
3
|
export { MARKLESS_BUILD_METADATA_FILES, MARKLESS_BUILD_PREFIX, MARKLESS_BUNDLE_GRAPH, MARKLESS_CHUNK_SPECIFIER_PREFIX, MARKLESS_IMPORT_MAP_ASSET, MARKLESS_PUBLIC_BUILD_METADATA_FILES, MARKLESS_VIRTUAL_PREFIX, collectHeadLinkInjections, convertManifestToBundleGraph, createBuildMetadata, createMarklessRolldownPlugin, createPreloadGraphAdder, importMapScript, insertImportMapScript, marklessBuildManifestDir, marklessBuildManifestPath, marklessClient, marklessImportMapPath, marklessLib, marklessServer, outputDefaults, prerenderWakeVirtualModuleId, resumeVirtualModuleId, transformTsrxModule };
|
package/dist/vite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as MARKLESS_DEV_RELOADS_ATTRIBUTE, d as renderMarklessDevErrorDocument, i as MARKLESS_DEV_PAGE_EDIT_EVENT, n as MARKLESS_DEV_ERROR_CLIENT_ID, o as MARKLESS_DEV_RELOADS_EVENT, r as MARKLESS_DEV_ERROR_EVENT, t as MARKLESS_DEV_ERROR_CLEAR_EVENT, u as normalizeMarklessDevError } from "./dev-error-BEduK_R3.js";
|
|
2
2
|
import { N as pathname, R as sharedReachedRenderDataRequest, at as outputDefaults, ct as STORAGE_FREE_RESUME_ENTRY_SPECIFIER, kt as executionLogActivationInjection, st as RESUME_ENTRY_SPECIFIER, t as MARKLESS_DEFERRED_PACK } from "./route-pack-groups-BXc755qH.js";
|
|
3
3
|
import { n as includeOptimizedDeps, t as excludeSourceShippedDeps } from "./optimized-deps-BfzxSm6C.js";
|
|
4
|
-
import { A as createInlineDeferTriggerSource, D as preflightTsrxModuleDiagnostics, E as prefetchChunkParses, _ as createPreloadGraphAdder, a as collapseInitFacadeImports, d as nativePackingEnabled, f as nativePackingPlugins, h as withUndemandedReExportDoors, j as inlineDeferSource, k as INLINE_DEFER_LOADER_SOURCE, l as marklessRuntimeSpecifierId, m as undemandedRuntimeModules, o as unwrapAsyncImportWrappers, p as isReExportDoor, t as createMarklessRolldownPlugin, u as DEPRECATED_NATIVE_PACKING_WARNING, v as runtimeModuleIdFromOrigin } from "./rolldown-
|
|
4
|
+
import { A as createInlineDeferTriggerSource, D as preflightTsrxModuleDiagnostics, E as prefetchChunkParses, M as moduleIdFor, _ as createPreloadGraphAdder, a as collapseInitFacadeImports, d as nativePackingEnabled, f as nativePackingPlugins, h as withUndemandedReExportDoors, j as inlineDeferSource, k as INLINE_DEFER_LOADER_SOURCE, l as marklessRuntimeSpecifierId, m as undemandedRuntimeModules, o as unwrapAsyncImportWrappers, p as isReExportDoor, t as createMarklessRolldownPlugin, u as DEPRECATED_NATIVE_PACKING_WARNING, v as runtimeModuleIdFromOrigin } from "./rolldown-DpkfQO1h.js";
|
|
5
5
|
import { n as marklessRosterPositions, r as marklessRosterRenderContext, t as marklessRosterPositionSeeds } from "./shared-seed-slot-ihIVCD2S.js";
|
|
6
6
|
import { joinURL, parsePath, withQuery } from "ufo";
|
|
7
7
|
import { ASYNC_PROTOCOL_VERSION, PROTOCOL_CONTAINER_HOST_NODE_ID, STORAGE_SLOT_SYMBOL_KEY, escapeScriptJson, serializeRuntimeAsyncSnapshots, serializeRuntimeStateCells, storageAttributeName, storageCookieName, storageSlotEntryKeyFromGraphNodeId } from "@markless/serializer";
|
|
@@ -1354,6 +1354,7 @@ const ERROR_EVENT = ${JSON.stringify(MARKLESS_DEV_ERROR_EVENT)};
|
|
|
1354
1354
|
const CLEAR_EVENT = ${JSON.stringify(MARKLESS_DEV_ERROR_CLEAR_EVENT)};
|
|
1355
1355
|
const RELOADS_EVENT = ${JSON.stringify(MARKLESS_DEV_RELOADS_EVENT)};
|
|
1356
1356
|
const RELOADS_ATTRIBUTE = ${JSON.stringify(MARKLESS_DEV_RELOADS_ATTRIBUTE)};
|
|
1357
|
+
const PAGE_EDIT_EVENT = ${JSON.stringify(MARKLESS_DEV_PAGE_EDIT_EVENT)};
|
|
1357
1358
|
const ELEMENT = 'markless-dev-error-overlay';
|
|
1358
1359
|
const SUPPRESSION = 'data-markless-vite-overlay-suppression';
|
|
1359
1360
|
const OPEN_IN_EDITOR = ${JSON.stringify(`${base}/__open-in-editor`)};
|
|
@@ -1428,7 +1429,9 @@ hot.on('vite:beforeFullReload', reset);
|
|
|
1428
1429
|
addEventListener('keydown', (event) => { if (event.key === 'Escape') document.querySelector(ELEMENT)?.remove(); });
|
|
1429
1430
|
if (window.__MARKLESS_DEV_ERROR__) show(window.__MARKLESS_DEV_ERROR__);
|
|
1430
1431
|
const servedAfter = document.querySelector('script[' + RELOADS_ATTRIBUTE + ']')?.getAttribute(RELOADS_ATTRIBUTE);
|
|
1431
|
-
|
|
1432
|
+
const report = (edit) => hot.send(RELOADS_EVENT, { reloads: servedAfter != null ? Number(servedAfter) : edit, href: location.href });
|
|
1433
|
+
if (servedAfter != null) report();
|
|
1434
|
+
hot.on(PAGE_EDIT_EVENT, ({ edit }) => report(edit));
|
|
1432
1435
|
`;
|
|
1433
1436
|
}
|
|
1434
1437
|
//#endregion
|
|
@@ -1493,12 +1496,19 @@ function createViteHmr(options) {
|
|
|
1493
1496
|
let recheckingInvalidSources = false;
|
|
1494
1497
|
const preflightByFile = /* @__PURE__ */ new Map();
|
|
1495
1498
|
const unreportedInvalidations = /* @__PURE__ */ new Map();
|
|
1496
|
-
|
|
1499
|
+
const edits = [];
|
|
1497
1500
|
let lastReloadedEdit;
|
|
1498
|
-
function
|
|
1499
|
-
if (edit === lastReloadedEdit) return;
|
|
1501
|
+
function recordEdit(edit, pages) {
|
|
1502
|
+
if (edit === lastReloadedEdit) return void 0;
|
|
1500
1503
|
lastReloadedEdit = edit;
|
|
1501
|
-
|
|
1504
|
+
return edits.push(pages) - 1;
|
|
1505
|
+
}
|
|
1506
|
+
function servedPageIsStale(data) {
|
|
1507
|
+
const since = typeof data?.reloads === "number" ? data.reloads : edits.length;
|
|
1508
|
+
const later = edits.slice(Math.max(0, since));
|
|
1509
|
+
if (later.length === 0) return false;
|
|
1510
|
+
const page = typeof data?.href === "string" && options.pageForUrl ? options.pageForUrl(data.href) : void 0;
|
|
1511
|
+
return later.some((pages) => pages === "all" || page === void 0 || pages.has(page));
|
|
1502
1512
|
}
|
|
1503
1513
|
let hotUpdatePasses = 0;
|
|
1504
1514
|
let hotUpdateCycle;
|
|
@@ -1624,7 +1634,7 @@ function createViteHmr(options) {
|
|
|
1624
1634
|
recovered = true;
|
|
1625
1635
|
}
|
|
1626
1636
|
if (recovered) {
|
|
1627
|
-
|
|
1637
|
+
recordEdit(`recovered\0${Date.now()}`, "all");
|
|
1628
1638
|
server?.environments?.[options.clientEnvironment]?.hot?.send?.({ type: "full-reload" });
|
|
1629
1639
|
}
|
|
1630
1640
|
} finally {
|
|
@@ -1654,10 +1664,10 @@ function createViteHmr(options) {
|
|
|
1654
1664
|
if (options.enabled) {
|
|
1655
1665
|
installFetchViteClient(nextServer, options, async () => {
|
|
1656
1666
|
await settledHotUpdate();
|
|
1657
|
-
return
|
|
1667
|
+
return edits.length;
|
|
1658
1668
|
});
|
|
1659
1669
|
nextServer.environments?.[options.clientEnvironment]?.hot?.on?.(MARKLESS_DEV_RELOADS_EVENT, (data, client) => {
|
|
1660
|
-
if (data
|
|
1670
|
+
if (servedPageIsStale(data)) client.send({ type: "full-reload" });
|
|
1661
1671
|
});
|
|
1662
1672
|
}
|
|
1663
1673
|
},
|
|
@@ -1699,6 +1709,38 @@ function createViteHmr(options) {
|
|
|
1699
1709
|
}
|
|
1700
1710
|
return !answered;
|
|
1701
1711
|
}
|
|
1712
|
+
function editedPages(targets, file) {
|
|
1713
|
+
const isPage = options.isPage;
|
|
1714
|
+
const root = server?.config?.root;
|
|
1715
|
+
if (!isPage || !options.pageForUrl || !root) return "all";
|
|
1716
|
+
const pageOf = (module) => {
|
|
1717
|
+
const id = module.file ? moduleIdFor(module.file, root) : void 0;
|
|
1718
|
+
return id !== void 0 && isPage(id) ? id : void 0;
|
|
1719
|
+
};
|
|
1720
|
+
const pending = [];
|
|
1721
|
+
for (const [target, scope] of targets) {
|
|
1722
|
+
if (scope !== "server") continue;
|
|
1723
|
+
pending.push(...target.moduleGraph?.getModulesByFile?.(parsePath(file).pathname) ?? []);
|
|
1724
|
+
}
|
|
1725
|
+
if (pending.length === 0) return "all";
|
|
1726
|
+
const pages = /* @__PURE__ */ new Set();
|
|
1727
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1728
|
+
while (pending.length > 0) {
|
|
1729
|
+
const module = pending.pop();
|
|
1730
|
+
if (seen.has(module)) continue;
|
|
1731
|
+
seen.add(module);
|
|
1732
|
+
const page = pageOf(module);
|
|
1733
|
+
const importers = [...module.importers ?? []];
|
|
1734
|
+
if (page) {
|
|
1735
|
+
pages.add(page);
|
|
1736
|
+
pending.push(...importers.filter((importer) => pageOf(importer)));
|
|
1737
|
+
continue;
|
|
1738
|
+
}
|
|
1739
|
+
if (importers.length === 0) return "all";
|
|
1740
|
+
pending.push(...importers);
|
|
1741
|
+
}
|
|
1742
|
+
return pages;
|
|
1743
|
+
}
|
|
1702
1744
|
async function runHotUpdate(environment, ctx) {
|
|
1703
1745
|
if (!environment) return;
|
|
1704
1746
|
const env = marklessEnvironment(environment);
|
|
@@ -1717,7 +1759,22 @@ function createViteHmr(options) {
|
|
|
1717
1759
|
}
|
|
1718
1760
|
const modules = new Set(ctx.modules ?? []);
|
|
1719
1761
|
if (ctx.file) for (const target of targets.keys()) for (const module of target.moduleGraph?.getModulesByFile?.(ctx.file) ?? []) modules.add(module);
|
|
1762
|
+
const listingModules = /* @__PURE__ */ new Map();
|
|
1763
|
+
if (ctx.type !== "update") {
|
|
1764
|
+
listingModules.set(environment, new Set(ctx.modules ?? []));
|
|
1765
|
+
for (const target of targets.keys()) for (const module of await globImporters(target, ctx)) {
|
|
1766
|
+
const listed = listingModules.get(target) ?? /* @__PURE__ */ new Set();
|
|
1767
|
+
listed.add(module);
|
|
1768
|
+
listingModules.set(target, listed);
|
|
1769
|
+
modules.add(module);
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1720
1772
|
if (modules.size === 0 && ctx.file && !loadedOrInvalid(targets.keys(), ctx.file)) return [];
|
|
1773
|
+
for (const [target, listed] of listingModules) for (const module of listed) {
|
|
1774
|
+
const invalidated = /* @__PURE__ */ new Set();
|
|
1775
|
+
target.moduleGraph?.invalidateModule?.(module, invalidated, ctx.timestamp, true);
|
|
1776
|
+
recordUnreportedInvalidation(target, invalidated);
|
|
1777
|
+
}
|
|
1721
1778
|
const files = changedFiles([...modules]);
|
|
1722
1779
|
const root = server?.config?.root;
|
|
1723
1780
|
if (ctx.file && SOURCE_FILE_EXTENSION.test(ctx.file)) {
|
|
@@ -1781,15 +1838,31 @@ function createViteHmr(options) {
|
|
|
1781
1838
|
recordUnreportedInvalidation(targetEnvironment, invalidated);
|
|
1782
1839
|
}
|
|
1783
1840
|
reloadModuleRunner();
|
|
1784
|
-
|
|
1785
|
-
|
|
1841
|
+
const pages = ctx.type === "update" && ctx.file ? editedPages(targets, ctx.file) : "all";
|
|
1842
|
+
const edit = recordEdit(`${ctx.file}\0${ctx.timestamp}`, pages);
|
|
1843
|
+
if (pages === "all") hot.send({
|
|
1786
1844
|
type: "full-reload",
|
|
1787
1845
|
path: firstChangedFile(files),
|
|
1788
1846
|
triggeredBy: ctx.file
|
|
1789
1847
|
});
|
|
1848
|
+
else if (edit !== void 0) hot.send({
|
|
1849
|
+
type: "custom",
|
|
1850
|
+
event: MARKLESS_DEV_PAGE_EDIT_EVENT,
|
|
1851
|
+
data: { edit }
|
|
1852
|
+
});
|
|
1790
1853
|
return [];
|
|
1791
1854
|
}
|
|
1792
1855
|
}
|
|
1856
|
+
async function globImporters(environment, ctx) {
|
|
1857
|
+
const hook = (environment.plugins?.find((candidate) => candidate.name === "vite:import-glob"))?.hotUpdate;
|
|
1858
|
+
const handler = typeof hook === "function" ? hook : hook?.handler;
|
|
1859
|
+
if (!handler) return [];
|
|
1860
|
+
const modules = await handler.call({ environment }, {
|
|
1861
|
+
...ctx,
|
|
1862
|
+
modules: []
|
|
1863
|
+
});
|
|
1864
|
+
return Array.isArray(modules) ? modules : [];
|
|
1865
|
+
}
|
|
1793
1866
|
async function fetchedModuleNode(environment, id) {
|
|
1794
1867
|
const resolved = id.startsWith(VITE_ID_PREFIX) ? id.slice(5).replace(VITE_NULL_BYTE, "\0") : id;
|
|
1795
1868
|
return environment.moduleGraph.getModuleById(resolved) ?? await environment.moduleGraph.getModuleByUrl(id).catch(() => void 0);
|
|
@@ -2018,7 +2091,9 @@ function markless(options = {}) {
|
|
|
2018
2091
|
clientEnvironment: viteEnvironmentName("client", options),
|
|
2019
2092
|
enabled: false,
|
|
2020
2093
|
invalidateGeneratedModules: (parent, environment, nextSource) => marklessPlugin.api.invalidateGeneratedModules(parent, environment, nextSource),
|
|
2021
|
-
invalidatePrerenderSnapshots: void 0
|
|
2094
|
+
invalidatePrerenderSnapshots: void 0,
|
|
2095
|
+
isPage: void 0,
|
|
2096
|
+
pageForUrl: void 0
|
|
2022
2097
|
};
|
|
2023
2098
|
let devPrerender;
|
|
2024
2099
|
const devTags = createDevTags();
|
|
@@ -2036,6 +2111,13 @@ function markless(options = {}) {
|
|
|
2036
2111
|
sharedDuringBuild: true,
|
|
2037
2112
|
api: {
|
|
2038
2113
|
...basePlugin.api,
|
|
2114
|
+
declareRouteModules: (isRoute) => {
|
|
2115
|
+
basePlugin.api.declareRouteModules(isRoute);
|
|
2116
|
+
hmrOptions.isPage = isRoute;
|
|
2117
|
+
},
|
|
2118
|
+
declarePageForUrl: (pageForUrl) => {
|
|
2119
|
+
hmrOptions.pageForUrl = pageForUrl;
|
|
2120
|
+
},
|
|
2039
2121
|
registerBundleGraphAdder: (adder) => bundleGraphAdders.add(adder),
|
|
2040
2122
|
registerDevInjection: (injection) => devTags.register(injection),
|
|
2041
2123
|
registerPreloadGraphEntries: (adder) => bundleGraphAdders.add(createPreloadGraphAdder(adder))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markless/bundler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Markless build plugins for Rolldown and Vite.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@thi.ng/dgraph": "^2.1.205",
|
|
40
40
|
"pathe": "^2.0.3",
|
|
41
41
|
"ufo": "^1.6.4",
|
|
42
|
-
"@markless/compiler": "0.
|
|
43
|
-
"@markless/
|
|
44
|
-
"@markless/
|
|
42
|
+
"@markless/compiler": "0.7.0",
|
|
43
|
+
"@markless/web": "0.7.0",
|
|
44
|
+
"@markless/serializer": "0.7.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@markless/analyzer": "0.
|
|
47
|
+
"@markless/analyzer": "0.7.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"rolldown": "1.2.7",
|