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.
@@ -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 };
@@ -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 };
@@ -0,0 +1,5 @@
1
+ export { b as buildBundleModule } from './shared/mokup.CsBTglhs.mjs';
2
+ import './shared/mokup.Iqw32OxC.mjs';
3
+ import '@mokup/shared/pathe';
4
+ import '@mokup/shared/path-utils';
5
+ import '@mokup/shared/timing';
package/dist/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
- import { c as RouteDirectoryConfig, b as MiddlewareRegistry, R as RequestHandler, e as RouteRule } from './shared/mokup.CWQ8woZc.cjs';
2
- export { H as HttpMethod, a as MiddlewarePosition, M as MokupPluginOptions, d as RouteResponse, f as RuntimeMode, S as ServiceWorkerOptions, V as VitePluginOptions, g as VitePluginOptionsInput } from './shared/mokup.CWQ8woZc.cjs';
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 { c as RouteDirectoryConfig, b as MiddlewareRegistry, R as RequestHandler, e as RouteRule } from './shared/mokup.CWQ8woZc.mjs';
2
- export { H as HttpMethod, a as MiddlewarePosition, M as MokupPluginOptions, d as RouteResponse, f as RuntimeMode, S as ServiceWorkerOptions, V as VitePluginOptions, g as VitePluginOptionsInput } from './shared/mokup.CWQ8woZc.mjs';
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 { c as RouteDirectoryConfig, b as MiddlewareRegistry, R as RequestHandler, e as RouteRule } from './shared/mokup.CWQ8woZc.js';
4
- export { H as HttpMethod, a as MiddlewarePosition, M as MokupPluginOptions, d as RouteResponse, f as RuntimeMode, S as ServiceWorkerOptions, V as VitePluginOptions, g as VitePluginOptionsInput } from './shared/mokup.CWQ8woZc.js';
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;