mokup 2.2.0 → 2.2.3
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/bundle.cjs +11 -0
- package/dist/bundle.d.cts +27 -0
- package/dist/bundle.d.mts +27 -0
- package/dist/bundle.d.ts +27 -0
- package/dist/bundle.mjs +5 -0
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/shared/mokup.BXPIIxtS.cjs +47 -0
- package/dist/shared/{mokup.CYGG6ENd.cjs → mokup.Cn9uLpN8.cjs} +57 -350
- package/dist/shared/mokup.CsBTglhs.mjs +45 -0
- package/dist/shared/{mokup.ClsvLg8n.mjs → mokup.DJ2QlqTp.mjs} +29 -316
- package/dist/shared/{mokup.CWQ8woZc.d.cts → mokup.DeotZ0g8.d.cts} +69 -2
- package/dist/shared/{mokup.CWQ8woZc.d.mts → mokup.DeotZ0g8.d.mts} +69 -2
- package/dist/shared/{mokup.CWQ8woZc.d.ts → mokup.DeotZ0g8.d.ts} +69 -2
- package/dist/shared/mokup.Dy9VDphS.cjs +181 -0
- package/dist/shared/mokup.Iqw32OxC.mjs +174 -0
- package/dist/types/virtual.d.ts +2 -2
- package/dist/vite.cjs +15 -52
- package/dist/vite.d.cts +3 -2
- package/dist/vite.d.mts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.mjs +6 -43
- package/dist/webpack.cjs +10 -6
- package/dist/webpack.d.cts +3 -2
- package/dist/webpack.d.mts +3 -2
- package/dist/webpack.d.ts +3 -2
- package/dist/webpack.mjs +5 -1
- package/package.json +11 -6
package/dist/bundle.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const bundle = require('./shared/mokup.BXPIIxtS.cjs');
|
|
4
|
+
require('./shared/mokup.Dy9VDphS.cjs');
|
|
5
|
+
require('@mokup/shared/pathe');
|
|
6
|
+
require('@mokup/shared/path-utils');
|
|
7
|
+
require('@mokup/shared/timing');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.buildBundleModule = bundle.buildBundleModule;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { R as RouteTable } from './shared/mokup.DeotZ0g8.cjs';
|
|
2
|
+
export { a as ResolvedRoute } from './shared/mokup.DeotZ0g8.cjs';
|
|
3
|
+
import '@mokup/runtime';
|
|
4
|
+
import '@mokup/shared';
|
|
5
|
+
import '@mokup/shared/hono';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Build the source for a virtual mokup bundle module.
|
|
9
|
+
*
|
|
10
|
+
* @param params - Bundle build parameters.
|
|
11
|
+
* @param params.routes - Resolved routes to serialize.
|
|
12
|
+
* @param params.root - Workspace root path.
|
|
13
|
+
* @param params.resolveModulePath - Optional module resolver.
|
|
14
|
+
* @returns JavaScript source string.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* import { buildBundleModule } from 'mokup/bundle'
|
|
18
|
+
*
|
|
19
|
+
* const source = buildBundleModule({ routes: [], root: '/project' })
|
|
20
|
+
*/
|
|
21
|
+
declare function buildBundleModule(params: {
|
|
22
|
+
routes: RouteTable;
|
|
23
|
+
root: string;
|
|
24
|
+
resolveModulePath?: (file: string, root: string) => string;
|
|
25
|
+
}): string;
|
|
26
|
+
|
|
27
|
+
export { RouteTable, buildBundleModule };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { R as RouteTable } from './shared/mokup.DeotZ0g8.mjs';
|
|
2
|
+
export { a as ResolvedRoute } from './shared/mokup.DeotZ0g8.mjs';
|
|
3
|
+
import '@mokup/runtime';
|
|
4
|
+
import '@mokup/shared';
|
|
5
|
+
import '@mokup/shared/hono';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Build the source for a virtual mokup bundle module.
|
|
9
|
+
*
|
|
10
|
+
* @param params - Bundle build parameters.
|
|
11
|
+
* @param params.routes - Resolved routes to serialize.
|
|
12
|
+
* @param params.root - Workspace root path.
|
|
13
|
+
* @param params.resolveModulePath - Optional module resolver.
|
|
14
|
+
* @returns JavaScript source string.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* import { buildBundleModule } from 'mokup/bundle'
|
|
18
|
+
*
|
|
19
|
+
* const source = buildBundleModule({ routes: [], root: '/project' })
|
|
20
|
+
*/
|
|
21
|
+
declare function buildBundleModule(params: {
|
|
22
|
+
routes: RouteTable;
|
|
23
|
+
root: string;
|
|
24
|
+
resolveModulePath?: (file: string, root: string) => string;
|
|
25
|
+
}): string;
|
|
26
|
+
|
|
27
|
+
export { RouteTable, buildBundleModule };
|
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { R as RouteTable } from './shared/mokup.DeotZ0g8.js';
|
|
2
|
+
export { a as ResolvedRoute } from './shared/mokup.DeotZ0g8.js';
|
|
3
|
+
import '@mokup/runtime';
|
|
4
|
+
import '@mokup/shared';
|
|
5
|
+
import '@mokup/shared/hono';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Build the source for a virtual mokup bundle module.
|
|
9
|
+
*
|
|
10
|
+
* @param params - Bundle build parameters.
|
|
11
|
+
* @param params.routes - Resolved routes to serialize.
|
|
12
|
+
* @param params.root - Workspace root path.
|
|
13
|
+
* @param params.resolveModulePath - Optional module resolver.
|
|
14
|
+
* @returns JavaScript source string.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* import { buildBundleModule } from 'mokup/bundle'
|
|
18
|
+
*
|
|
19
|
+
* const source = buildBundleModule({ routes: [], root: '/project' })
|
|
20
|
+
*/
|
|
21
|
+
declare function buildBundleModule(params: {
|
|
22
|
+
routes: RouteTable;
|
|
23
|
+
root: string;
|
|
24
|
+
resolveModulePath?: (file: string, root: string) => string;
|
|
25
|
+
}): string;
|
|
26
|
+
|
|
27
|
+
export { RouteTable, buildBundleModule };
|
package/dist/bundle.mjs
ADDED
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { H as HttpMethod,
|
|
1
|
+
import { e as RouteDirectoryConfig, c as MiddlewareRegistry, d as RequestHandler, g as RouteRule } from './shared/mokup.DeotZ0g8.cjs';
|
|
2
|
+
export { H as HttpMethod, b as MiddlewarePosition, M as MokupPluginOptions, f as RouteResponse, h as RuntimeMode, S as ServiceWorkerOptions, V as VitePluginOptions, i as VitePluginOptionsInput } from './shared/mokup.DeotZ0g8.cjs';
|
|
3
3
|
export { Context, MiddlewareHandler } from '@mokup/shared/hono';
|
|
4
4
|
export { PlaygroundOptionsInput } from '@mokup/shared';
|
|
5
|
+
import '@mokup/runtime';
|
|
5
6
|
|
|
6
7
|
type DefineConfigFactory = (context: {
|
|
7
8
|
pre: MiddlewareRegistry;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { H as HttpMethod,
|
|
1
|
+
import { e as RouteDirectoryConfig, c as MiddlewareRegistry, d as RequestHandler, g as RouteRule } from './shared/mokup.DeotZ0g8.mjs';
|
|
2
|
+
export { H as HttpMethod, b as MiddlewarePosition, M as MokupPluginOptions, f as RouteResponse, h as RuntimeMode, S as ServiceWorkerOptions, V as VitePluginOptions, i as VitePluginOptionsInput } from './shared/mokup.DeotZ0g8.mjs';
|
|
3
3
|
export { Context, MiddlewareHandler } from '@mokup/shared/hono';
|
|
4
4
|
export { PlaygroundOptionsInput } from '@mokup/shared';
|
|
5
|
+
import '@mokup/runtime';
|
|
5
6
|
|
|
6
7
|
type DefineConfigFactory = (context: {
|
|
7
8
|
pre: MiddlewareRegistry;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference path="./types/virtual.d.ts" />
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
export { H as HttpMethod,
|
|
3
|
+
import { e as RouteDirectoryConfig, c as MiddlewareRegistry, d as RequestHandler, g as RouteRule } from './shared/mokup.DeotZ0g8.js';
|
|
4
|
+
export { H as HttpMethod, b as MiddlewarePosition, M as MokupPluginOptions, f as RouteResponse, h as RuntimeMode, S as ServiceWorkerOptions, V as VitePluginOptions, i as VitePluginOptionsInput } from './shared/mokup.DeotZ0g8.js';
|
|
5
5
|
export { Context, MiddlewareHandler } from '@mokup/shared/hono';
|
|
6
6
|
export { PlaygroundOptionsInput } from '@mokup/shared';
|
|
7
|
+
import '@mokup/runtime';
|
|
7
8
|
|
|
8
9
|
type DefineConfigFactory = (context: {
|
|
9
10
|
pre: MiddlewareRegistry;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const manifest = require('./mokup.Dy9VDphS.cjs');
|
|
4
|
+
|
|
5
|
+
function buildBundleModule(params) {
|
|
6
|
+
const { manifest: manifest$1, modules } = manifest.buildManifestData({
|
|
7
|
+
routes: params.routes,
|
|
8
|
+
root: params.root,
|
|
9
|
+
...params.resolveModulePath ? { resolveModulePath: params.resolveModulePath } : {}
|
|
10
|
+
});
|
|
11
|
+
const imports = [];
|
|
12
|
+
const moduleEntries = [];
|
|
13
|
+
let moduleIndex = 0;
|
|
14
|
+
for (const entry of modules) {
|
|
15
|
+
const name = `module${moduleIndex++}`;
|
|
16
|
+
imports.push(`import * as ${name} from '${entry.id}'`);
|
|
17
|
+
moduleEntries.push({ id: entry.id, name });
|
|
18
|
+
}
|
|
19
|
+
const lines = [];
|
|
20
|
+
if (imports.length > 0) {
|
|
21
|
+
lines.push(...imports, "");
|
|
22
|
+
}
|
|
23
|
+
lines.push(
|
|
24
|
+
`const manifest = ${JSON.stringify(manifest$1, null, 2)}`,
|
|
25
|
+
""
|
|
26
|
+
);
|
|
27
|
+
if (moduleEntries.length > 0) {
|
|
28
|
+
lines.push("const moduleMap = {");
|
|
29
|
+
for (const entry of moduleEntries) {
|
|
30
|
+
lines.push(
|
|
31
|
+
` ${JSON.stringify(entry.id)}: ${entry.name},`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
lines.push("}", "");
|
|
35
|
+
}
|
|
36
|
+
const runtimeOptions = moduleEntries.length > 0 ? "{ manifest, moduleMap }" : "{ manifest }";
|
|
37
|
+
lines.push(
|
|
38
|
+
`const mokupBundle = ${runtimeOptions}`,
|
|
39
|
+
"",
|
|
40
|
+
"export default mokupBundle",
|
|
41
|
+
"export { mokupBundle }",
|
|
42
|
+
""
|
|
43
|
+
);
|
|
44
|
+
return lines.join("\n");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.buildBundleModule = buildBundleModule;
|