nitrostack 1.0.7 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitrostack",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "NitroStack - Build powerful MCP servers with TypeScript",
5
5
  "type": "module",
6
6
  "main": "dist/core/index.js",
@@ -105,4 +105,4 @@
105
105
  "url": "https://github.com/abhishekpanditofficial/nitrostack/issues"
106
106
  },
107
107
  "homepage": "https://nitrostack.vercel.app"
108
- }
108
+ }
@@ -16,23 +16,46 @@ const nextConfig = {
16
16
  eslint: {
17
17
  ignoreDuringBuilds: true,
18
18
  },
19
- webpack: (config, { defaultLoaders, isServer }) => {
19
+ transpilePackages: ['nitrostack'],
20
+ webpack: (config) => {
20
21
  // Explicitly configure webpack to resolve @ alias
21
22
  config.resolve.alias = {
22
23
  ...config.resolve.alias,
23
24
  '@': __dirname,
24
25
  };
25
26
 
26
- // Ensure our lib and components directories are included in compilation
27
- // Use Next.js's default TypeScript loader
28
27
  const libPath = path.resolve(__dirname, 'lib');
29
28
  const componentsPath = path.resolve(__dirname, 'components');
30
29
 
31
- // Add a rule for our TypeScript files using Next.js's default loader
30
+ // Create a high-priority rule that ensures TS/TSX in node_modules/nitrostack are transpiled
31
+ const forceTsTranspileRule = {
32
+ test: /\.(ts|tsx)$/,
33
+ // Do not exclude our package even if under node_modules
34
+ exclude: (modulePath) => {
35
+ // Never exclude files from nitrostack package
36
+ if (modulePath.includes(`${path.sep}node_modules${path.sep}nitrostack${path.sep}`)) {
37
+ return false;
38
+ }
39
+ // Otherwise, apply default exclude for node_modules
40
+ return modulePath.includes(`${path.sep}node_modules${path.sep}`);
41
+ },
42
+ use: {
43
+ loader: require.resolve('next/dist/build/webpack/loaders/next-swc-loader'),
44
+ },
45
+ };
46
+
47
+ const oneOfRule = config.module.rules.find((rule) => Array.isArray(rule.oneOf));
48
+ if (oneOfRule && Array.isArray(oneOfRule.oneOf)) {
49
+ oneOfRule.oneOf.unshift(forceTsTranspileRule);
50
+ } else {
51
+ config.module.rules.unshift(forceTsTranspileRule);
52
+ }
53
+
54
+ // Also add a specific include-based rule for our lib/components as a fallback
32
55
  config.module.rules.push({
33
56
  test: /\.(ts|tsx)$/,
34
57
  include: [libPath, componentsPath],
35
- use: defaultLoaders.babel,
58
+ use: require.resolve('next/dist/build/webpack/loaders/next-swc-loader'),
36
59
  });
37
60
 
38
61
  return config;