@backstage/cli-common 0.1.16-next.2 → 0.1.17
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/CHANGELOG.md +14 -0
- package/dist/isChildPath.cjs.js +28 -1
- package/dist/isChildPath.cjs.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @backstage/cli-common
|
|
2
2
|
|
|
3
|
+
## 0.1.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ae4dd5d: Move some of the symlink resolution to `isChildPath`
|
|
8
|
+
|
|
9
|
+
## 0.1.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5cfb2a4: Added new `run`, `runOutput`, and `runCheck` utilities to help run child processes in a safe and portable way.
|
|
14
|
+
- c8c2329: Add proxy configuration from env-vars to create-app tasks
|
|
15
|
+
- 2bae83a: Bumped dev dependencies `@types/node`
|
|
16
|
+
|
|
3
17
|
## 0.1.16-next.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/isChildPath.cjs.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var path = require('path');
|
|
4
|
+
var fs = require('fs');
|
|
4
5
|
|
|
6
|
+
function resolveRealPath(path$1) {
|
|
7
|
+
try {
|
|
8
|
+
return fs.realpathSync(path$1);
|
|
9
|
+
} catch (ex) {
|
|
10
|
+
if (ex.code !== "ENOENT") {
|
|
11
|
+
throw ex;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
if (fs.lstatSync(path$1).isSymbolicLink()) {
|
|
16
|
+
const target = path.resolve(path.dirname(path$1), fs.readlinkSync(path$1));
|
|
17
|
+
return resolveRealPath(target);
|
|
18
|
+
}
|
|
19
|
+
} catch (ex) {
|
|
20
|
+
if (ex.code !== "ENOENT") {
|
|
21
|
+
throw ex;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const parent = path.dirname(path$1);
|
|
25
|
+
if (parent === path$1) {
|
|
26
|
+
return path$1;
|
|
27
|
+
}
|
|
28
|
+
return path.resolve(resolveRealPath(parent), path.basename(path$1));
|
|
29
|
+
}
|
|
5
30
|
function isChildPath(base, path$1) {
|
|
6
|
-
const
|
|
31
|
+
const resolvedBase = resolveRealPath(base);
|
|
32
|
+
const resolvedPath = resolveRealPath(path$1);
|
|
33
|
+
const relativePath = path.relative(resolvedBase, resolvedPath);
|
|
7
34
|
if (relativePath === "") {
|
|
8
35
|
return true;
|
|
9
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isChildPath.cjs.js","sources":["../src/isChildPath.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"isChildPath.cjs.js","sources":["../src/isChildPath.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n relative,\n isAbsolute,\n resolve as resolvePath,\n dirname,\n basename,\n} from 'path';\nimport { realpathSync, lstatSync, readlinkSync } from 'fs';\n\n// Resolves a path to its real location, following symlinks.\n// Handles cases where the final target doesn't exist by recursively\n// resolving parent directories.\nfunction resolveRealPath(path: string): string {\n try {\n return realpathSync(path);\n } catch (ex) {\n if (ex.code !== 'ENOENT') {\n throw ex;\n }\n }\n\n // Check if path itself is a dangling symlink - recursively resolve the target\n // to handle symlink chains (e.g., link1 -> link2 -> /outside)\n try {\n if (lstatSync(path).isSymbolicLink()) {\n const target = resolvePath(dirname(path), readlinkSync(path));\n return resolveRealPath(target);\n }\n } catch (ex) {\n if (ex.code !== 'ENOENT') {\n throw ex;\n }\n }\n\n // Path doesn't exist - walk up the tree until we find an existing path,\n // resolve it, then rebuild the non-existent portion on top\n const parent = dirname(path);\n if (parent === path) {\n return path; // Hit filesystem root\n }\n\n return resolvePath(resolveRealPath(parent), basename(path));\n}\n\n/**\n * Checks if path is the same as or a child path of base.\n *\n * @public\n */\nexport function isChildPath(base: string, path: string): boolean {\n const resolvedBase = resolveRealPath(base);\n const resolvedPath = resolveRealPath(path);\n\n const relativePath = relative(resolvedBase, resolvedPath);\n if (relativePath === '') {\n // The same directory\n return true;\n }\n\n const outsideBase = relativePath.startsWith('..'); // not outside base\n const differentDrive = isAbsolute(relativePath); // on Windows, this means dir is on a different drive from base.\n\n return !outsideBase && !differentDrive;\n}\n"],"names":["path","realpathSync","lstatSync","resolvePath","dirname","readlinkSync","basename","relative","isAbsolute"],"mappings":";;;;;AA4BA,SAAS,gBAAgBA,MAAA,EAAsB;AAC7C,EAAA,IAAI;AACF,IAAA,OAAOC,gBAAaD,MAAI,CAAA;AAAA,EAC1B,SAAS,EAAA,EAAI;AACX,IAAA,IAAI,EAAA,CAAG,SAAS,QAAA,EAAU;AACxB,MAAA,MAAM,EAAA;AAAA,IACR;AAAA,EACF;AAIA,EAAA,IAAI;AACF,IAAA,IAAIE,YAAA,CAAUF,MAAI,CAAA,CAAE,cAAA,EAAe,EAAG;AACpC,MAAA,MAAM,SAASG,YAAA,CAAYC,YAAA,CAAQJ,MAAI,CAAA,EAAGK,eAAA,CAAaL,MAAI,CAAC,CAAA;AAC5D,MAAA,OAAO,gBAAgB,MAAM,CAAA;AAAA,IAC/B;AAAA,EACF,SAAS,EAAA,EAAI;AACX,IAAA,IAAI,EAAA,CAAG,SAAS,QAAA,EAAU;AACxB,MAAA,MAAM,EAAA;AAAA,IACR;AAAA,EACF;AAIA,EAAA,MAAM,MAAA,GAASI,aAAQJ,MAAI,CAAA;AAC3B,EAAA,IAAI,WAAWA,MAAA,EAAM;AACnB,IAAA,OAAOA,MAAA;AAAA,EACT;AAEA,EAAA,OAAOG,aAAY,eAAA,CAAgB,MAAM,CAAA,EAAGG,aAAA,CAASN,MAAI,CAAC,CAAA;AAC5D;AAOO,SAAS,WAAA,CAAY,MAAcA,MAAA,EAAuB;AAC/D,EAAA,MAAM,YAAA,GAAe,gBAAgB,IAAI,CAAA;AACzC,EAAA,MAAM,YAAA,GAAe,gBAAgBA,MAAI,CAAA;AAEzC,EAAA,MAAM,YAAA,GAAeO,aAAA,CAAS,YAAA,EAAc,YAAY,CAAA;AACxD,EAAA,IAAI,iBAAiB,EAAA,EAAI;AAEvB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,WAAA,GAAc,YAAA,CAAa,UAAA,CAAW,IAAI,CAAA;AAChD,EAAA,MAAM,cAAA,GAAiBC,gBAAW,YAAY,CAAA;AAE9C,EAAA,OAAO,CAAC,eAAe,CAAC,cAAA;AAC1B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/cli-common",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Common functionality used by cli, backend, and create-app",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"test": "backstage-cli package test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@backstage/errors": "1.2.7",
|
|
38
|
+
"@backstage/errors": "^1.2.7",
|
|
39
39
|
"cross-spawn": "^7.0.3",
|
|
40
40
|
"global-agent": "^3.0.0",
|
|
41
41
|
"undici": "^7.2.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@backstage/cli": "0.35.
|
|
44
|
+
"@backstage/cli": "^0.35.2",
|
|
45
45
|
"@types/cross-spawn": "^6.0.2",
|
|
46
46
|
"@types/node": "^22.13.14"
|
|
47
47
|
},
|