vitrify 0.6.3 → 0.6.4
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/app-urls.js +3 -1
- package/dist/types/app-urls.d.ts +1 -1
- package/package.json +1 -1
- package/src/node/app-urls.ts +3 -1
package/dist/app-urls.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// import { resolve } from 'import-meta-resolve'
|
|
2
2
|
import { existsSync } from 'fs';
|
|
3
|
-
export const resolve = (packageName, base) => {
|
|
3
|
+
export const resolve = (packageName, base, counter = 0) => {
|
|
4
4
|
const packageUrl = new URL(`./node_modules/${packageName}/`, base);
|
|
5
5
|
if (existsSync(packageUrl.pathname)) {
|
|
6
6
|
return new URL('./', packageUrl);
|
|
7
7
|
}
|
|
8
|
+
if (counter < 10)
|
|
9
|
+
return resolve(packageName, new URL('../', base), counter + 1);
|
|
8
10
|
throw new Error(`Package ${packageName} not found in ${base.pathname}.`);
|
|
9
11
|
};
|
|
10
12
|
export const getPkgJsonDir = (dir) => {
|
package/dist/types/app-urls.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const resolve: (packageName: string, base: URL) => URL;
|
|
1
|
+
export declare const resolve: (packageName: string, base: URL, counter?: number) => URL;
|
|
2
2
|
export declare const getPkgJsonDir: (dir: URL) => URL;
|
|
3
3
|
export declare const getAppDir: () => URL;
|
|
4
4
|
export declare const getCliDir: () => URL;
|
package/package.json
CHANGED
package/src/node/app-urls.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// import { resolve } from 'import-meta-resolve'
|
|
2
2
|
import { existsSync } from 'fs'
|
|
3
3
|
|
|
4
|
-
export const resolve = (packageName: string, base: URL) => {
|
|
4
|
+
export const resolve = (packageName: string, base: URL, counter = 0): URL => {
|
|
5
5
|
const packageUrl = new URL(`./node_modules/${packageName}/`, base)
|
|
6
6
|
if (existsSync(packageUrl.pathname)) {
|
|
7
7
|
return new URL('./', packageUrl)
|
|
8
8
|
}
|
|
9
|
+
if (counter < 10)
|
|
10
|
+
return resolve(packageName, new URL('../', base), counter + 1)
|
|
9
11
|
throw new Error(`Package ${packageName} not found in ${base.pathname}.`)
|
|
10
12
|
}
|
|
11
13
|
|