@squidcloud/cli 1.0.418 → 1.0.419

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.
Files changed (2) hide show
  1. package/dist/index.js +46 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -577,6 +577,13 @@ exports.requirePath = void 0;
577
577
  exports.findModulePath = findModulePath;
578
578
  const enhanced_resolve_1 = __importDefault(__webpack_require__(4506));
579
579
  const path_1 = __importDefault(__webpack_require__(6928));
580
+ /**
581
+ * Finds the resolved path of a given module by searching upward through directory tree.
582
+ *
583
+ * @param moduleName - The name of the module to find (e.g., '@squidcloud/local-backend')
584
+ * @param startDir - The directory to start searching from (defaults to process.cwd())
585
+ * @returns Promise resolving to the absolute path of the module, or null if not found
586
+ */
580
587
  async function findModulePath(moduleName, startDir = process.cwd()) {
581
588
  const directoriesToSearch = new Set([startDir, process.cwd(), __dirname]);
582
589
  // Try each directory in order
@@ -607,6 +614,12 @@ async function findModulePath(moduleName, startDir = process.cwd()) {
607
614
  }
608
615
  return null;
609
616
  }
617
+ /**
618
+ * Requires a module file, handling both Node.js and webpack environments.
619
+ *
620
+ * @param file - The path to the module file to require
621
+ * @returns The exported module content
622
+ */
610
623
  const requirePath = (file) => {
611
624
  return false ? 0 : require(file);
612
625
  };
@@ -2961,6 +2974,9 @@ class TsoaUtils {
2961
2974
  if (!supportsDefault && specName === 'default') {
2962
2975
  continue;
2963
2976
  }
2977
+ if (verbose) {
2978
+ console.log(`Processing config file: ${file}`);
2979
+ }
2964
2980
  // Use native join to create the folder.
2965
2981
  const outputDir = path.join('dist', specName);
2966
2982
  if (!fs.existsSync(outputDir)) {
@@ -2992,6 +3008,33 @@ class TsoaUtils {
2992
3008
  config.routes = config.routes || {};
2993
3009
  config.spec.outputDirectory = outputDir;
2994
3010
  config.routes.routesDir = outputDir;
3011
+ // Fix middlewareTemplate path when using fallback from local-backend
3012
+ if (config.routes.middlewareTemplate && !path.isAbsolute(file)) {
3013
+ const localBackendModule = await (0, resolve_1.findModulePath)('@squidcloud/local-backend');
3014
+ if (verbose) {
3015
+ console.log(`File being processed: ${file}`);
3016
+ console.log(`Local backend module: ${localBackendModule}`);
3017
+ console.log(`Original middlewareTemplate: ${config.routes.middlewareTemplate}`);
3018
+ }
3019
+ if (localBackendModule) {
3020
+ // Check if the file is from the local-backend package (it would contain node_modules/@squidcloud/local-backend)
3021
+ if (file.includes('@squidcloud/local-backend') && file.includes('tsoa.json')) {
3022
+ // Find package root (the module path points to index.js)
3023
+ // Example module path: .../node_modules/@squidcloud/local-backend/dist/local-backend/src/index.js
3024
+ // Next, we need to go up 4 levels (dist/local-backend/src/index.js) to reach: 'local-backend' root dir.
3025
+ const packageRoot = path.resolve(localBackendModule, '..', '..', '..', '..');
3026
+ // Rewrite the middlewareTemplate path to be relative to the current working directory.
3027
+ const templatePath = path.resolve(packageRoot, 'dist/local-backend/openapi-template.hbs');
3028
+ // Calculate relative path from current working directory (which might be backend/ or test-tsoa/backend/)
3029
+ config.routes.middlewareTemplate = path.relative(process.cwd(), templatePath);
3030
+ if (verbose) {
3031
+ console.log(`Rewritten middlewareTemplate path to: ${config.routes.middlewareTemplate}`);
3032
+ console.log(`Template absolute path: ${templatePath}`);
3033
+ console.log(`Package root: ${packageRoot}`);
3034
+ }
3035
+ }
3036
+ }
3037
+ }
2995
3038
  // Use a relative path for the temporary config file.
2996
3039
  const tempConfigPath = `temp-tsoa-config-${specName}.json`;
2997
3040
  try {
@@ -23433,7 +23476,7 @@ exports.INTEGRATION_TYPES = [
23433
23476
  'a2a',
23434
23477
  'legend',
23435
23478
  'teams',
23436
- 'ollama',
23479
+ 'openai_compatible',
23437
23480
  ];
23438
23481
  /**
23439
23482
  * @category Database
@@ -30559,7 +30602,7 @@ function exitWithError(...messages) {
30559
30602
  /***/ ((module) => {
30560
30603
 
30561
30604
  "use strict";
30562
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.418","description":"The Squid CLI","main":"dist/index.js","scripts":{"start":"node dist/index.js","start-ts":"ts-node -r tsconfig-paths/register src/index.ts","prebuild":"rimraf dist","build":"webpack --mode=production","build:dev":"webpack --mode=development","lint":"eslint","link":"npm run build && chmod 755 dist/index.js && npm link","watch":"webpack --watch","deploy":"npm run build && npm pack --silent | xargs -I {} mv {} package.tgz && npm install -g package.tgz && rm -rf package.tgz","publish:public":"npm run build && npm publish --access public"},"files":["dist/**/*"],"bin":{"squid":"dist/index.js"},"keywords":[],"author":"","license":"ISC","engines":{"node":">=18.0.0"},"dependencies":{"@squidcloud/local-backend":"^1.0.418","adm-zip":"^0.5.16","copy-webpack-plugin":"^12.0.2","decompress":"^4.2.1","nodemon":"^3.1.9","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.1.0","webpack":"^5.101.3","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/adm-zip":"^0.5.7","@types/decompress":"^4.2.7","@types/node":"^20.19.9","terminal-link":"^3.0.0"}}');
30605
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.419","description":"The Squid CLI","main":"dist/index.js","scripts":{"start":"node dist/index.js","start-ts":"ts-node -r tsconfig-paths/register src/index.ts","prebuild":"rimraf dist","build":"webpack --mode=production","build:dev":"webpack --mode=development","lint":"eslint","link":"npm run build && chmod 755 dist/index.js && npm link","watch":"webpack --watch","deploy":"npm run build && npm pack --silent | xargs -I {} mv {} package.tgz && npm install -g package.tgz && rm -rf package.tgz","publish:public":"npm run build && npm publish --access public"},"files":["dist/**/*"],"bin":{"squid":"dist/index.js"},"keywords":[],"author":"","license":"ISC","engines":{"node":">=18.0.0"},"dependencies":{"@squidcloud/local-backend":"^1.0.419","adm-zip":"^0.5.16","copy-webpack-plugin":"^12.0.2","decompress":"^4.2.1","nodemon":"^3.1.9","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.1.0","webpack":"^5.101.3","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/adm-zip":"^0.5.7","@types/decompress":"^4.2.7","@types/node":"^20.19.9","terminal-link":"^3.0.0"}}');
30563
30606
 
30564
30607
  /***/ }),
30565
30608
 
@@ -31041,7 +31084,7 @@ async function build({ verbose, dev, skipVersionCheck }) {
31041
31084
  }
31042
31085
  await fs_1.promises.mkdir(distPath);
31043
31086
  const isSquidConnector = (0, process_env_utils_1.isEnvVarTruthy)('SQUID_CONNECTOR');
31044
- const openApiSpecAndControllers = await tsoa_utils_1.TsoaUtils.generateAllSpecs(false, !isSquidConnector);
31087
+ const openApiSpecAndControllers = await tsoa_utils_1.TsoaUtils.generateAllSpecs(verbose, !isSquidConnector);
31045
31088
  await fs_1.promises.writeFile(path_1.default.join(distPath, '', 'openapi-spec-and-controllers.json'), JSON.stringify(openApiSpecAndControllers));
31046
31089
  const isUserConfigMode = fsSync.existsSync(resolve_2.USER_WEBPACK_CONFIG_PATH);
31047
31090
  const webpackConfigPath = isUserConfigMode ? resolve_2.USER_WEBPACK_CONFIG_PATH : resolve_2.BUILT_IN_WEBPACK_CONFIG_PATH;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/cli",
3
- "version": "1.0.418",
3
+ "version": "1.0.419",
4
4
  "description": "The Squid CLI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -28,7 +28,7 @@
28
28
  "node": ">=18.0.0"
29
29
  },
30
30
  "dependencies": {
31
- "@squidcloud/local-backend": "^1.0.418",
31
+ "@squidcloud/local-backend": "^1.0.419",
32
32
  "adm-zip": "^0.5.16",
33
33
  "copy-webpack-plugin": "^12.0.2",
34
34
  "decompress": "^4.2.1",