@swizzyweb/swerve 0.5.7 → 0.5.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/LICENSE CHANGED
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright [yyyy] [name of copyright owner]
190
+ Copyright 2025 SwizzyWeb
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
package/dist/swerve.js CHANGED
@@ -147,18 +147,25 @@ export class SwerveManager {
147
147
  try {
148
148
  gLogger.info(`Getting webservice package ${packageName} and will run on port ${port}`);
149
149
  gLogger.debug(`Getting tool with path: ${importPathOrName}`);
150
- const fullPath = await getFullImportPath(importPathOrName);
151
- const tool = await import(fullPath); //require(fullPath); //require(packageName as string);
152
- gLogger.debug(`Got service with require: ${JSON.stringify(tool)}`);
153
- gLogger.debug(`Getting web service from tool...`);
150
+ let tool;
151
+ try {
152
+ gLogger.debug(`Got service with require: ${JSON.stringify(tool)}`);
153
+ gLogger.debug(`Getting web service from tool...`);
154
+ tool = await import(importPathOrName);
155
+ }
156
+ catch (e) {
157
+ gLogger.warn(`Error importing raw import path ${importPathOrName}, attempting again with fullImportPath. Err: ${e?.message}, stack: ${e?.stack}`);
158
+ const fullPath = await getFullImportPath(importPathOrName);
159
+ tool = await import(fullPath); //require(fullPath); //require(packageName as string);
160
+ }
154
161
  const appDataPath = path.join(appDataRoot, "appdata", serviceKey);
155
162
  mkdirSync(appDataPath, { recursive: true });
156
163
  const logger = getLoggerForService(serviceArgs, serviceKey, port, gLogger);
157
164
  gLogger.debug(`serviceArgs for ${packageName}: ${serviceArgs}`);
158
165
  const service = await tool.getWebservice({
159
166
  appDataPath,
160
- ...serviceArgs,
161
167
  port,
168
+ ...serviceArgs,
162
169
  app,
163
170
  packageName,
164
171
  serviceArgs: { ...serviceArgs },
@@ -24,7 +24,6 @@ export function getPackageJson(packageNameOrPath) {
24
24
  : import.meta.resolve(packageNameOrPath);
25
25
  // Step 2: Traverse upward to find the nearest package.json
26
26
  let dir = fileURLToPath(resolvedEntry); //path.dirname(resolvedEntry);
27
- console.log(dir);
28
27
  while (dir !== path.parse(dir).root) {
29
28
  const pkgPath = path.join(dir, "package.json");
30
29
  if (fs.existsSync(pkgPath)) {
@@ -36,10 +35,7 @@ export function getPackageJson(packageNameOrPath) {
36
35
  else if (dir.startsWith(".")) {
37
36
  dir = path.join(process.cwd(), dir);
38
37
  }
39
- console.log(dir);
40
38
  const entrypoint = path.join(dir, packageJson.main);
41
- console.log(entrypoint);
42
- console.error(`Entrypoint is ${entrypoint}`);
43
39
  // throw `Entrypoint is ${entrypoint}`;
44
40
  return { packageJson, servicePath: entrypoint };
45
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swizzyweb/swerve",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "swizzy-swerve is a bootstrapper for swizzy web services. This package will bootstrap and run independent swizzy web services.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -37,9 +37,9 @@
37
37
  "typescript": "^5.9.2"
38
38
  },
39
39
  "dependencies": {
40
- "@swizzyweb/swerve-manager": "^0.1.8",
41
- "@swizzyweb/swizzy-common": "^0.3.2",
42
- "@swizzyweb/swizzy-web-service": "^0.5.4",
40
+ "@swizzyweb/swerve-manager": "^0.1.9",
41
+ "@swizzyweb/swizzy-common": "^0.3.3",
42
+ "@swizzyweb/swizzy-web-service": "^0.5.5",
43
43
  "bun": "^1.2.22",
44
44
  "deno": "^2.5.2"
45
45
  },