Skip to content

Commit f03362e

Browse files
Switch to wmr namespace
1 parent 3456799 commit f03362e

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

examples/demo/public/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import NotFound from './pages/_404.js';
55
import Header from './header.tsx';
66
import { PageRoutes } from './pages/page-routes.js';
77
// import './style.css';
8-
import { routes as pageRoutes } from 'builtins:fs-routes-preact';
8+
import { routes as pageRoutes } from 'wmr:fs-routes-preact';
99

1010
const sleep = t => new Promise(r => setTimeout(r, t));
1111

examples/demo/public/pages/page-routes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { routes } from 'builtins:fs-routes';
1+
import { routes } from 'wmr:fs-routes';
22

33
export function PageRoutes() {
44
return (

packages/wmr/src/plugins/fs-routes-plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ async function readRecursive(root, dir = root) {
4545
* @returns {import('wmr').Plugin}
4646
*/
4747
export default function fsRoutesPlugin({ pagesDir, publicPath, root, cwd }) {
48-
const PUBLIC = 'builtins:fs-routes';
49-
const INTERNAL = '\0builtins:fs-routes';
48+
const PUBLIC = 'wmr:fs-routes';
49+
const INTERNAL = '\0wmr:fs-routes';
5050
return {
5151
name: 'fs-routes',
5252
resolveId(id) {

packages/wmr/src/plugins/fs-routes-preact-plugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* @returns {import('wmr').Plugin}
44
*/
55
export default function fsRoutesPreactPlugin() {
6-
const PUBLIC = 'builtins:fs-routes-preact';
7-
const INTERNAL = '\0builtins:fs-routes-preact';
6+
const PUBLIC = 'wmr:fs-routes-preact';
7+
const INTERNAL = '\0wmr:fs-routes-preact';
88
return {
99
name: 'fs-routes-preact',
1010
resolveId(id) {
@@ -15,7 +15,7 @@ export default function fsRoutesPreactPlugin() {
1515
async load(id) {
1616
if (id !== INTERNAL) return;
1717

18-
return `import { routes as rawRoutes } from 'builtins:fs-routes';
18+
return `import { routes as rawRoutes } from 'wmr:fs-routes';
1919
import { lazy, Route } from 'preact-iso';
2020
import { h } from 'preact';
2121

packages/wmr/types.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ declare interface NodeModule {
8787
}
8888
declare var module: NodeModule;
8989

90+
// Models exposed by internal wmr plugins
91+
declare module 'wmr:fs-routes' {
92+
export const routes: Array<{ route: string; url: string }>;
93+
}
94+
declare module 'wmr:fs-routes-preact' {
95+
export const routes: any[];
96+
}
97+
9098
/** Maps authored classNames to their CSS Modules -suffixed generated classNames. */
9199
type Mapping = Record<string, string>;
92100
declare module '*.module.css' {

0 commit comments

Comments
 (0)