@platformatic/basic 3.26.0 → 3.28.0-alpha.1

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/lib/capability.js CHANGED
@@ -134,8 +134,6 @@ export class BaseCapability extends EventEmitter {
134
134
  return
135
135
  }
136
136
 
137
- // TODO@PI: Handle reusePort
138
-
139
137
  // Wait for explicit dependencies to start
140
138
  await this.waitForDependenciesStart(this.dependencies)
141
139
 
package/lib/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'node:module'
2
- import { pathToFileURL } from 'node:url'
2
+ import { fileURLToPath, pathToFileURL } from 'node:url'
3
3
  import { request } from 'undici'
4
4
 
5
5
  export function getServerUrl (server) {
@@ -60,7 +60,7 @@ export function importFile (path) {
60
60
  }
61
61
 
62
62
  /* c8 ignore next 6 */
63
- export function resolvePackage (root, pkg) {
63
+ export function resolvePackageViaCJS (root, pkg) {
64
64
  const require = createRequire(root)
65
65
  // We need to add the main module paths to the require.resolve call
66
66
  // Note that `require.main` is not defined in `next` if we set sthe instrumentation hook reequired for ESM applications.
@@ -68,6 +68,18 @@ export function resolvePackage (root, pkg) {
68
68
  return require.resolve(pkg, { paths: [root, ...(require.main?.paths || [])] })
69
69
  }
70
70
 
71
+ /* c8 ignore next 14 */
72
+ export async function resolvePackageViaESM (root, pkg) {
73
+ // Use import.meta.resolve if available first, since it also understands ESM only packages
74
+ try {
75
+ const url = await import.meta.resolve(pkg)
76
+ return fileURLToPath(new URL(url))
77
+ } catch {
78
+ // Fallback to CJS resolution
79
+ return resolvePackageViaCJS(root, pkg)
80
+ }
81
+ }
82
+
71
83
  export function cleanBasePath (basePath) {
72
84
  return basePath ? `/${basePath}`.replaceAll(/\/+/g, '/').replace(/\/$/, '') : '/'
73
85
  }
@@ -75,3 +87,6 @@ export function cleanBasePath (basePath) {
75
87
  export function ensureTrailingSlash (basePath) {
76
88
  return basePath ? `${basePath}${basePath.endsWith('/') ? '' : '/'}` : '/'
77
89
  }
90
+
91
+ // TODO: This is for backwards compatibility, remove in future major release
92
+ export const resolvePackage = resolvePackageViaCJS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/basic",
3
- "version": "3.26.0",
3
+ "version": "3.28.0-alpha.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -25,10 +25,10 @@
25
25
  "split2": "^4.2.0",
26
26
  "undici": "^7.0.0",
27
27
  "ws": "^8.18.0",
28
- "@platformatic/foundation": "3.26.0",
29
- "@platformatic/metrics": "3.26.0",
30
- "@platformatic/telemetry": "3.26.0",
31
- "@platformatic/itc": "3.26.0"
28
+ "@platformatic/foundation": "3.28.0-alpha.1",
29
+ "@platformatic/itc": "3.28.0-alpha.1",
30
+ "@platformatic/metrics": "3.28.0-alpha.1",
31
+ "@platformatic/telemetry": "3.28.0-alpha.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "cleaner-spec-reporter": "^0.5.0",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/basic/3.26.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/basic/3.28.0-alpha.1.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Basic Config",
5
5
  "type": "object",