@van1s1mys/ai-router-plugin-next 1.0.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.
- package/dist/index.cjs +77 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +92 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
withAiRouter: () => withAiRouter
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
var import_ai_router_plugin_webpack = require("@van1s1mys/ai-router-plugin-webpack");
|
|
27
|
+
function withAiRouter(nextConfig = {}, options) {
|
|
28
|
+
const pluginOptions = {
|
|
29
|
+
dirs: ["app", "pages", "src/app", "src/pages"],
|
|
30
|
+
exclude: [
|
|
31
|
+
// Next.js internal files
|
|
32
|
+
"_app",
|
|
33
|
+
"_document",
|
|
34
|
+
"_error",
|
|
35
|
+
"layout",
|
|
36
|
+
"loading",
|
|
37
|
+
"error",
|
|
38
|
+
"not-found",
|
|
39
|
+
"template",
|
|
40
|
+
"default",
|
|
41
|
+
"icon",
|
|
42
|
+
"apple-icon",
|
|
43
|
+
"opengraph-image",
|
|
44
|
+
"twitter-image",
|
|
45
|
+
"sitemap",
|
|
46
|
+
"robots",
|
|
47
|
+
"manifest",
|
|
48
|
+
"middleware",
|
|
49
|
+
"instrumentation",
|
|
50
|
+
"global-error",
|
|
51
|
+
"route",
|
|
52
|
+
// API routes
|
|
53
|
+
"__tests__",
|
|
54
|
+
".test.",
|
|
55
|
+
".spec.",
|
|
56
|
+
"api/"
|
|
57
|
+
// API directory
|
|
58
|
+
],
|
|
59
|
+
...options
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
...nextConfig,
|
|
63
|
+
webpack(config, context) {
|
|
64
|
+
config.plugins = config.plugins || [];
|
|
65
|
+
config.plugins.push(new import_ai_router_plugin_webpack.AiRouterPlugin(pluginOptions));
|
|
66
|
+
if (typeof nextConfig.webpack === "function") {
|
|
67
|
+
return nextConfig.webpack(config, context);
|
|
68
|
+
}
|
|
69
|
+
return config;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
withAiRouter
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Next.js plugin for ai-router.\n *\n * Wraps the webpack plugin with Next.js-specific defaults —\n * automatically scans `app/`, `pages/`, `src/app/`, and `src/pages/`\n * while excluding Next.js internal files (layouts, loading states, API routes, etc.).\n *\n * @example\n * ```js\n * // next.config.js\n * const { withAiRouter } = require('ai-router-plugin-next');\n *\n * module.exports = withAiRouter({\n * // your Next.js config\n * });\n * ```\n *\n * ```ts\n * // app/providers.tsx\n * import { routes } from 'virtual:ai-router';\n * import { SmartRouter } from 'ai-router';\n *\n * const router = new SmartRouter({ routes });\n * ```\n *\n * @module\n */\n\nimport { AiRouterPlugin } from '@van1s1mys/ai-router-plugin-webpack';\nimport type { PluginOptions } from '@ai-router/shared';\n\nexport type { PluginOptions } from '@ai-router/shared';\n\n/** Minimal webpack config shape used by Next.js. */\ninterface WebpackConfig {\n plugins?: { apply(compiler: unknown): void }[];\n [key: string]: unknown;\n}\n\n/** Minimal Next.js `webpack()` context. */\ninterface WebpackContext {\n dev: boolean;\n isServer: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Next.js configuration object.\n * Accepts any Next.js config property plus an optional `webpack` function.\n */\ninterface NextConfig {\n webpack?: (config: WebpackConfig, context: WebpackContext) => WebpackConfig;\n [key: string]: unknown;\n}\n\n/**\n * Wraps a Next.js config with ai-router route scanning.\n *\n * Injects the {@link AiRouterPlugin} into the webpack config with\n * sensible defaults for Next.js projects. Auto-detects standard\n * directory conventions (`app/`, `pages/`, `src/app/`, `src/pages/`)\n * and excludes framework internals.\n *\n * @param nextConfig - Your existing Next.js configuration.\n * @param options - Override scan directories, exclusions, or provide manual routes.\n * Defaults are merged, not replaced.\n * @returns A new Next.js config with the ai-router webpack plugin applied.\n *\n * @example\n * ```js\n * // Basic usage — auto-detects app/ and pages/ directories\n * module.exports = withAiRouter({});\n * ```\n *\n * @example\n * ```js\n * // With manual route overrides\n * module.exports = withAiRouter(nextConfig, {\n * routes: [\n * { path: '/pricing', title: 'Pricing', description: 'cost, plans, billing' },\n * ],\n * });\n * ```\n *\n * @example\n * ```js\n * // Custom directories only\n * module.exports = withAiRouter(nextConfig, {\n * dirs: ['src/app'],\n * });\n * ```\n */\nexport function withAiRouter(nextConfig: NextConfig = {}, options?: PluginOptions): NextConfig {\n const pluginOptions: PluginOptions = {\n dirs: ['app', 'pages', 'src/app', 'src/pages'],\n exclude: [\n // Next.js internal files\n '_app',\n '_document',\n '_error',\n 'layout',\n 'loading',\n 'error',\n 'not-found',\n 'template',\n 'default',\n 'icon',\n 'apple-icon',\n 'opengraph-image',\n 'twitter-image',\n 'sitemap',\n 'robots',\n 'manifest',\n 'middleware',\n 'instrumentation',\n 'global-error',\n 'route', // API routes\n '__tests__',\n '.test.',\n '.spec.',\n 'api/', // API directory\n ],\n ...options,\n };\n\n return {\n ...nextConfig,\n webpack(config: WebpackConfig, context: WebpackContext) {\n config.plugins = config.plugins || [];\n config.plugins.push(new AiRouterPlugin(pluginOptions));\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(config, context);\n }\n\n return config;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BA,sCAA+B;AAgExB,SAAS,aAAa,aAAyB,CAAC,GAAG,SAAqC;AAC7F,QAAM,gBAA+B;AAAA,IACnC,MAAM,CAAC,OAAO,SAAS,WAAW,WAAW;AAAA,IAC7C,SAAS;AAAA;AAAA,MAEP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,QAAuB,SAAyB;AACtD,aAAO,UAAU,OAAO,WAAW,CAAC;AACpC,aAAO,QAAQ,KAAK,IAAI,+CAAe,aAAa,CAAC;AAErD,UAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,eAAO,WAAW,QAAQ,QAAQ,OAAO;AAAA,MAC3C;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { PluginOptions } from '@ai-router/shared';
|
|
2
|
+
export { PluginOptions } from '@ai-router/shared';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Next.js plugin for ai-router.
|
|
6
|
+
*
|
|
7
|
+
* Wraps the webpack plugin with Next.js-specific defaults —
|
|
8
|
+
* automatically scans `app/`, `pages/`, `src/app/`, and `src/pages/`
|
|
9
|
+
* while excluding Next.js internal files (layouts, loading states, API routes, etc.).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* // next.config.js
|
|
14
|
+
* const { withAiRouter } = require('ai-router-plugin-next');
|
|
15
|
+
*
|
|
16
|
+
* module.exports = withAiRouter({
|
|
17
|
+
* // your Next.js config
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* // app/providers.tsx
|
|
23
|
+
* import { routes } from 'virtual:ai-router';
|
|
24
|
+
* import { SmartRouter } from 'ai-router';
|
|
25
|
+
*
|
|
26
|
+
* const router = new SmartRouter({ routes });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @module
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** Minimal webpack config shape used by Next.js. */
|
|
33
|
+
interface WebpackConfig {
|
|
34
|
+
plugins?: {
|
|
35
|
+
apply(compiler: unknown): void;
|
|
36
|
+
}[];
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
/** Minimal Next.js `webpack()` context. */
|
|
40
|
+
interface WebpackContext {
|
|
41
|
+
dev: boolean;
|
|
42
|
+
isServer: boolean;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Next.js configuration object.
|
|
47
|
+
* Accepts any Next.js config property plus an optional `webpack` function.
|
|
48
|
+
*/
|
|
49
|
+
interface NextConfig {
|
|
50
|
+
webpack?: (config: WebpackConfig, context: WebpackContext) => WebpackConfig;
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Wraps a Next.js config with ai-router route scanning.
|
|
55
|
+
*
|
|
56
|
+
* Injects the {@link AiRouterPlugin} into the webpack config with
|
|
57
|
+
* sensible defaults for Next.js projects. Auto-detects standard
|
|
58
|
+
* directory conventions (`app/`, `pages/`, `src/app/`, `src/pages/`)
|
|
59
|
+
* and excludes framework internals.
|
|
60
|
+
*
|
|
61
|
+
* @param nextConfig - Your existing Next.js configuration.
|
|
62
|
+
* @param options - Override scan directories, exclusions, or provide manual routes.
|
|
63
|
+
* Defaults are merged, not replaced.
|
|
64
|
+
* @returns A new Next.js config with the ai-router webpack plugin applied.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```js
|
|
68
|
+
* // Basic usage — auto-detects app/ and pages/ directories
|
|
69
|
+
* module.exports = withAiRouter({});
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```js
|
|
74
|
+
* // With manual route overrides
|
|
75
|
+
* module.exports = withAiRouter(nextConfig, {
|
|
76
|
+
* routes: [
|
|
77
|
+
* { path: '/pricing', title: 'Pricing', description: 'cost, plans, billing' },
|
|
78
|
+
* ],
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```js
|
|
84
|
+
* // Custom directories only
|
|
85
|
+
* module.exports = withAiRouter(nextConfig, {
|
|
86
|
+
* dirs: ['src/app'],
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare function withAiRouter(nextConfig?: NextConfig, options?: PluginOptions): NextConfig;
|
|
91
|
+
|
|
92
|
+
export { withAiRouter };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { PluginOptions } from '@ai-router/shared';
|
|
2
|
+
export { PluginOptions } from '@ai-router/shared';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Next.js plugin for ai-router.
|
|
6
|
+
*
|
|
7
|
+
* Wraps the webpack plugin with Next.js-specific defaults —
|
|
8
|
+
* automatically scans `app/`, `pages/`, `src/app/`, and `src/pages/`
|
|
9
|
+
* while excluding Next.js internal files (layouts, loading states, API routes, etc.).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* // next.config.js
|
|
14
|
+
* const { withAiRouter } = require('ai-router-plugin-next');
|
|
15
|
+
*
|
|
16
|
+
* module.exports = withAiRouter({
|
|
17
|
+
* // your Next.js config
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* // app/providers.tsx
|
|
23
|
+
* import { routes } from 'virtual:ai-router';
|
|
24
|
+
* import { SmartRouter } from 'ai-router';
|
|
25
|
+
*
|
|
26
|
+
* const router = new SmartRouter({ routes });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @module
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** Minimal webpack config shape used by Next.js. */
|
|
33
|
+
interface WebpackConfig {
|
|
34
|
+
plugins?: {
|
|
35
|
+
apply(compiler: unknown): void;
|
|
36
|
+
}[];
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
/** Minimal Next.js `webpack()` context. */
|
|
40
|
+
interface WebpackContext {
|
|
41
|
+
dev: boolean;
|
|
42
|
+
isServer: boolean;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Next.js configuration object.
|
|
47
|
+
* Accepts any Next.js config property plus an optional `webpack` function.
|
|
48
|
+
*/
|
|
49
|
+
interface NextConfig {
|
|
50
|
+
webpack?: (config: WebpackConfig, context: WebpackContext) => WebpackConfig;
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Wraps a Next.js config with ai-router route scanning.
|
|
55
|
+
*
|
|
56
|
+
* Injects the {@link AiRouterPlugin} into the webpack config with
|
|
57
|
+
* sensible defaults for Next.js projects. Auto-detects standard
|
|
58
|
+
* directory conventions (`app/`, `pages/`, `src/app/`, `src/pages/`)
|
|
59
|
+
* and excludes framework internals.
|
|
60
|
+
*
|
|
61
|
+
* @param nextConfig - Your existing Next.js configuration.
|
|
62
|
+
* @param options - Override scan directories, exclusions, or provide manual routes.
|
|
63
|
+
* Defaults are merged, not replaced.
|
|
64
|
+
* @returns A new Next.js config with the ai-router webpack plugin applied.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```js
|
|
68
|
+
* // Basic usage — auto-detects app/ and pages/ directories
|
|
69
|
+
* module.exports = withAiRouter({});
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```js
|
|
74
|
+
* // With manual route overrides
|
|
75
|
+
* module.exports = withAiRouter(nextConfig, {
|
|
76
|
+
* routes: [
|
|
77
|
+
* { path: '/pricing', title: 'Pricing', description: 'cost, plans, billing' },
|
|
78
|
+
* ],
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```js
|
|
84
|
+
* // Custom directories only
|
|
85
|
+
* module.exports = withAiRouter(nextConfig, {
|
|
86
|
+
* dirs: ['src/app'],
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare function withAiRouter(nextConfig?: NextConfig, options?: PluginOptions): NextConfig;
|
|
91
|
+
|
|
92
|
+
export { withAiRouter };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { AiRouterPlugin } from "@van1s1mys/ai-router-plugin-webpack";
|
|
3
|
+
function withAiRouter(nextConfig = {}, options) {
|
|
4
|
+
const pluginOptions = {
|
|
5
|
+
dirs: ["app", "pages", "src/app", "src/pages"],
|
|
6
|
+
exclude: [
|
|
7
|
+
// Next.js internal files
|
|
8
|
+
"_app",
|
|
9
|
+
"_document",
|
|
10
|
+
"_error",
|
|
11
|
+
"layout",
|
|
12
|
+
"loading",
|
|
13
|
+
"error",
|
|
14
|
+
"not-found",
|
|
15
|
+
"template",
|
|
16
|
+
"default",
|
|
17
|
+
"icon",
|
|
18
|
+
"apple-icon",
|
|
19
|
+
"opengraph-image",
|
|
20
|
+
"twitter-image",
|
|
21
|
+
"sitemap",
|
|
22
|
+
"robots",
|
|
23
|
+
"manifest",
|
|
24
|
+
"middleware",
|
|
25
|
+
"instrumentation",
|
|
26
|
+
"global-error",
|
|
27
|
+
"route",
|
|
28
|
+
// API routes
|
|
29
|
+
"__tests__",
|
|
30
|
+
".test.",
|
|
31
|
+
".spec.",
|
|
32
|
+
"api/"
|
|
33
|
+
// API directory
|
|
34
|
+
],
|
|
35
|
+
...options
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
...nextConfig,
|
|
39
|
+
webpack(config, context) {
|
|
40
|
+
config.plugins = config.plugins || [];
|
|
41
|
+
config.plugins.push(new AiRouterPlugin(pluginOptions));
|
|
42
|
+
if (typeof nextConfig.webpack === "function") {
|
|
43
|
+
return nextConfig.webpack(config, context);
|
|
44
|
+
}
|
|
45
|
+
return config;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
withAiRouter
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Next.js plugin for ai-router.\n *\n * Wraps the webpack plugin with Next.js-specific defaults —\n * automatically scans `app/`, `pages/`, `src/app/`, and `src/pages/`\n * while excluding Next.js internal files (layouts, loading states, API routes, etc.).\n *\n * @example\n * ```js\n * // next.config.js\n * const { withAiRouter } = require('ai-router-plugin-next');\n *\n * module.exports = withAiRouter({\n * // your Next.js config\n * });\n * ```\n *\n * ```ts\n * // app/providers.tsx\n * import { routes } from 'virtual:ai-router';\n * import { SmartRouter } from 'ai-router';\n *\n * const router = new SmartRouter({ routes });\n * ```\n *\n * @module\n */\n\nimport { AiRouterPlugin } from '@van1s1mys/ai-router-plugin-webpack';\nimport type { PluginOptions } from '@ai-router/shared';\n\nexport type { PluginOptions } from '@ai-router/shared';\n\n/** Minimal webpack config shape used by Next.js. */\ninterface WebpackConfig {\n plugins?: { apply(compiler: unknown): void }[];\n [key: string]: unknown;\n}\n\n/** Minimal Next.js `webpack()` context. */\ninterface WebpackContext {\n dev: boolean;\n isServer: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Next.js configuration object.\n * Accepts any Next.js config property plus an optional `webpack` function.\n */\ninterface NextConfig {\n webpack?: (config: WebpackConfig, context: WebpackContext) => WebpackConfig;\n [key: string]: unknown;\n}\n\n/**\n * Wraps a Next.js config with ai-router route scanning.\n *\n * Injects the {@link AiRouterPlugin} into the webpack config with\n * sensible defaults for Next.js projects. Auto-detects standard\n * directory conventions (`app/`, `pages/`, `src/app/`, `src/pages/`)\n * and excludes framework internals.\n *\n * @param nextConfig - Your existing Next.js configuration.\n * @param options - Override scan directories, exclusions, or provide manual routes.\n * Defaults are merged, not replaced.\n * @returns A new Next.js config with the ai-router webpack plugin applied.\n *\n * @example\n * ```js\n * // Basic usage — auto-detects app/ and pages/ directories\n * module.exports = withAiRouter({});\n * ```\n *\n * @example\n * ```js\n * // With manual route overrides\n * module.exports = withAiRouter(nextConfig, {\n * routes: [\n * { path: '/pricing', title: 'Pricing', description: 'cost, plans, billing' },\n * ],\n * });\n * ```\n *\n * @example\n * ```js\n * // Custom directories only\n * module.exports = withAiRouter(nextConfig, {\n * dirs: ['src/app'],\n * });\n * ```\n */\nexport function withAiRouter(nextConfig: NextConfig = {}, options?: PluginOptions): NextConfig {\n const pluginOptions: PluginOptions = {\n dirs: ['app', 'pages', 'src/app', 'src/pages'],\n exclude: [\n // Next.js internal files\n '_app',\n '_document',\n '_error',\n 'layout',\n 'loading',\n 'error',\n 'not-found',\n 'template',\n 'default',\n 'icon',\n 'apple-icon',\n 'opengraph-image',\n 'twitter-image',\n 'sitemap',\n 'robots',\n 'manifest',\n 'middleware',\n 'instrumentation',\n 'global-error',\n 'route', // API routes\n '__tests__',\n '.test.',\n '.spec.',\n 'api/', // API directory\n ],\n ...options,\n };\n\n return {\n ...nextConfig,\n webpack(config: WebpackConfig, context: WebpackContext) {\n config.plugins = config.plugins || [];\n config.plugins.push(new AiRouterPlugin(pluginOptions));\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(config, context);\n }\n\n return config;\n },\n };\n}\n"],"mappings":";AA4BA,SAAS,sBAAsB;AAgExB,SAAS,aAAa,aAAyB,CAAC,GAAG,SAAqC;AAC7F,QAAM,gBAA+B;AAAA,IACnC,MAAM,CAAC,OAAO,SAAS,WAAW,WAAW;AAAA,IAC7C,SAAS;AAAA;AAAA,MAEP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,QAAuB,SAAyB;AACtD,aAAO,UAAU,OAAO,WAAW,CAAC;AACpC,aAAO,QAAQ,KAAK,IAAI,eAAe,aAAa,CAAC;AAErD,UAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,eAAO,WAAW,QAAQ,QAAQ,OAAO;AAAA,MAC3C;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@van1s1mys/ai-router-plugin-next",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Next.js plugin for ai-router — auto-scan app/pages dirs and generate route config",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"dev": "tsup --watch"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"next",
|
|
30
|
+
"nextjs",
|
|
31
|
+
"ai-router"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@ai-router/shared": "workspace:*",
|
|
36
|
+
"@van1s1mys/ai-router-plugin-webpack": "workspace:*"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"next": ">=13.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|