@google/clasp 2.4.0 → 2.4.2
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 +18 -0
- package/README.md +3 -3
- package/build/src/apiutils.js +5 -9
- package/build/src/apiutils.js.map +1 -1
- package/build/src/auth.js +6 -9
- package/build/src/auth.js.map +1 -1
- package/build/src/commands/apis.js +9 -8
- package/build/src/commands/apis.js.map +1 -1
- package/build/src/commands/clone.js +9 -6
- package/build/src/commands/clone.js.map +1 -1
- package/build/src/commands/create.js +14 -10
- package/build/src/commands/create.js.map +1 -1
- package/build/src/commands/default.d.ts +1 -1
- package/build/src/commands/default.js.map +1 -1
- package/build/src/commands/deploy.js +1 -2
- package/build/src/commands/deploy.js.map +1 -1
- package/build/src/commands/deployments.js +1 -2
- package/build/src/commands/deployments.js.map +1 -1
- package/build/src/commands/list.js +2 -3
- package/build/src/commands/list.js.map +1 -1
- package/build/src/commands/login.js +1 -2
- package/build/src/commands/login.js.map +1 -1
- package/build/src/commands/logout.js +9 -26
- package/build/src/commands/logout.js.map +1 -1
- package/build/src/commands/logs.js +10 -10
- package/build/src/commands/logs.js.map +1 -1
- package/build/src/commands/open.js +3 -3
- package/build/src/commands/open.js.map +1 -1
- package/build/src/commands/pull.js +1 -2
- package/build/src/commands/pull.js.map +1 -1
- package/build/src/commands/push.js +8 -9
- package/build/src/commands/push.js.map +1 -1
- package/build/src/commands/run.js +1 -2
- package/build/src/commands/run.js.map +1 -1
- package/build/src/commands/status.d.ts +1 -1
- package/build/src/commands/status.js +3 -4
- package/build/src/commands/status.js.map +1 -1
- package/build/src/commands/undeploy.js +1 -2
- package/build/src/commands/undeploy.js.map +1 -1
- package/build/src/commands/version.js +1 -2
- package/build/src/commands/version.js.map +1 -1
- package/build/src/commands/versions.js +3 -4
- package/build/src/commands/versions.js.map +1 -1
- package/build/src/conf.d.ts +23 -41
- package/build/src/conf.js +65 -56
- package/build/src/conf.js.map +1 -1
- package/build/src/dotfile.js +8 -8
- package/build/src/dotfile.js.map +1 -1
- package/build/src/files.js +38 -34
- package/build/src/files.js.map +1 -1
- package/build/src/index.d.ts +16 -0
- package/build/src/index.js +46 -48
- package/build/src/index.js.map +1 -1
- package/build/src/inquirer.js.map +1 -1
- package/build/src/manifest.d.ts +1 -1
- package/build/src/manifest.js +8 -10
- package/build/src/manifest.js.map +1 -1
- package/build/src/messages.d.ts +6 -6
- package/build/src/messages.js +11 -11
- package/build/src/messages.js.map +1 -1
- package/build/src/utils.d.ts +1 -2
- package/build/src/utils.js +17 -23
- package/build/src/utils.js.map +1 -1
- package/docs/esmodules.md +4 -4
- package/package.json +28 -25
- package/build/src/path-proxy.d.ts +0 -53
- package/build/src/path-proxy.js +0 -112
- package/build/src/path-proxy.js.map +0 -1
package/build/src/utils.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Conf } from './conf.js';
|
|
|
10
10
|
import { DOTFILE } from './dotfile.js';
|
|
11
11
|
import { projectIdPrompt } from './inquirer.js';
|
|
12
12
|
import { ERROR, LOG } from './messages.js';
|
|
13
|
-
const
|
|
13
|
+
const config = Conf.get();
|
|
14
14
|
/**
|
|
15
15
|
* Returns input string with uppercased first character
|
|
16
16
|
*/
|
|
@@ -21,17 +21,10 @@ const capitalize = (value) => value && value[0].toUpperCase() + value.slice(1);
|
|
|
21
21
|
* @return {boolean}
|
|
22
22
|
*/
|
|
23
23
|
export const hasOauthClientSettings = (local = false) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// if no local auth defined, try current directory
|
|
27
|
-
previousPath = auth.path;
|
|
28
|
-
auth.path = '.';
|
|
24
|
+
if (local) {
|
|
25
|
+
return config.authLocal !== undefined && fs.existsSync(config.authLocal);
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
if (previousPath) {
|
|
32
|
-
auth.path = previousPath;
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
27
|
+
return config.auth !== undefined && fs.existsSync(config.auth);
|
|
35
28
|
};
|
|
36
29
|
/**
|
|
37
30
|
* Gets the OAuth client settings from rc file.
|
|
@@ -43,7 +36,7 @@ export const getOAuthSettings = async (local) => {
|
|
|
43
36
|
var _a;
|
|
44
37
|
try {
|
|
45
38
|
const result = DOTFILE.AUTH(local).read();
|
|
46
|
-
return result;
|
|
39
|
+
return await result;
|
|
47
40
|
}
|
|
48
41
|
catch (error) {
|
|
49
42
|
throw new ClaspError((_a = getErrorMessage(error)) !== null && _a !== void 0 ? _a : ERROR.NO_CREDENTIALS(local));
|
|
@@ -63,20 +56,20 @@ export const getErrorMessage = (value) => {
|
|
|
63
56
|
if (value && typeof value.error === 'string') {
|
|
64
57
|
return JSON.parse(value.error).error;
|
|
65
58
|
}
|
|
66
|
-
|
|
59
|
+
if ((value === null || value === void 0 ? void 0 : value.statusCode) === 401 || ((value === null || value === void 0 ? void 0 : value.error) && value.error.error && value.error.error.code === 401)) {
|
|
67
60
|
// TODO check if local creds exist:
|
|
68
61
|
// localOathSettingsExist() ? ERROR.UNAUTHENTICATED : ERROR.UNAUTHENTICATED_LOCAL
|
|
69
62
|
return ERROR.UNAUTHENTICATED;
|
|
70
63
|
}
|
|
71
|
-
|
|
64
|
+
if (value && ((value.error && value.error.code === 403) || value.code === 403)) {
|
|
72
65
|
// TODO check if local creds exist:
|
|
73
66
|
// localOathSettingsExist() ? ERROR.PERMISSION_DENIED : ERROR.PERMISSION_DENIED_LOCAL
|
|
74
67
|
return ERROR.PERMISSION_DENIED;
|
|
75
68
|
}
|
|
76
|
-
|
|
69
|
+
if (value && value.code === 429) {
|
|
77
70
|
return ERROR.RATE_LIMIT;
|
|
78
71
|
}
|
|
79
|
-
|
|
72
|
+
if (value === null || value === void 0 ? void 0 : value.error) {
|
|
80
73
|
return `~~ API ERROR (${value.statusCode || value.error.code})=\n${value.error}`;
|
|
81
74
|
}
|
|
82
75
|
return undefined;
|
|
@@ -89,19 +82,19 @@ export const getErrorMessage = (value) => {
|
|
|
89
82
|
* @return {string} The URL of the web application in the online script editor.
|
|
90
83
|
*/
|
|
91
84
|
export const getWebApplicationURL = (value) => {
|
|
92
|
-
var _a;
|
|
85
|
+
var _a, _b;
|
|
93
86
|
const { entryPoints = [] } = value;
|
|
94
87
|
const entryPoint = entryPoints.find((entryPoint) => entryPoint.entryPointType === 'WEB_APP');
|
|
95
88
|
if (entryPoint) {
|
|
96
|
-
return entryPoint.webApp
|
|
89
|
+
return (_a = entryPoint.webApp) === null || _a === void 0 ? void 0 : _a.url;
|
|
97
90
|
}
|
|
98
|
-
throw new ClaspError(ERROR.NO_WEBAPP((
|
|
91
|
+
throw new ClaspError(ERROR.NO_WEBAPP((_b = value.deploymentId) !== null && _b !== void 0 ? _b : ''));
|
|
99
92
|
};
|
|
100
93
|
/**
|
|
101
94
|
* Gets default project name.
|
|
102
95
|
* @return {string} default project name.
|
|
103
96
|
*/
|
|
104
|
-
export const getDefaultProjectName = () => capitalize(path.basename(
|
|
97
|
+
export const getDefaultProjectName = () => capitalize(path.basename(config.projectRootDirectory));
|
|
105
98
|
/**
|
|
106
99
|
* Gets the project settings from the project dotfile.
|
|
107
100
|
*
|
|
@@ -113,7 +106,7 @@ export const getDefaultProjectName = () => capitalize(path.basename(process.cwd(
|
|
|
113
106
|
export const getProjectSettings = async () => {
|
|
114
107
|
const dotfile = DOTFILE.PROJECT();
|
|
115
108
|
try {
|
|
116
|
-
if (dotfile.exists()) {
|
|
109
|
+
if (await dotfile.exists()) {
|
|
117
110
|
// Found a dotfile, but does it have the settings, or is it corrupted?
|
|
118
111
|
try {
|
|
119
112
|
const settings = await dotfile.read();
|
|
@@ -123,10 +116,10 @@ export const getProjectSettings = async () => {
|
|
|
123
116
|
}
|
|
124
117
|
}
|
|
125
118
|
catch (error) {
|
|
126
|
-
throw new ClaspError(ERROR.SETTINGS_DNE); // Never found a dotfile
|
|
119
|
+
throw new ClaspError(ERROR.SETTINGS_DNE()); // Never found a dotfile
|
|
127
120
|
}
|
|
128
121
|
}
|
|
129
|
-
throw new ClaspError(ERROR.SETTINGS_DNE); // Never found a dotfile
|
|
122
|
+
throw new ClaspError(ERROR.SETTINGS_DNE()); // Never found a dotfile
|
|
130
123
|
}
|
|
131
124
|
catch (error) {
|
|
132
125
|
if (error instanceof ClaspError) {
|
|
@@ -210,6 +203,7 @@ export const getProjectId = async (promptUser = true) => {
|
|
|
210
203
|
if (error instanceof ClaspError) {
|
|
211
204
|
throw error;
|
|
212
205
|
}
|
|
206
|
+
// TODO: better error handling
|
|
213
207
|
throw new ClaspError(error.message);
|
|
214
208
|
}
|
|
215
209
|
};
|
package/build/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,OAAO,CAAC;AAEzB,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AAIzC,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,GAAG,MAA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CAAC,2BAA2B,IAAI,CAAC,CAAC;YAEpD,eAAe,CAAC,SAAS,GAAG,CAAC,MAAM,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC;YAChE,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;SAChD;QAED,OAAO,MAAA,eAAe,CAAC,SAAS,mCAAI,EAAE,CAAC;KACxC;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,UAAU,EAAE;YAC/B,MAAM,KAAK,CAAC;SACb;QAED,8BAA8B;QAC9B,MAAM,IAAI,UAAU,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC;KAC9C;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAEvF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,KAAa,EAAK,EAAE;IACpD,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM,CAAC;KAC/B;IAAC,MAAM;QACN,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;KAC1C;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,EAAE,CACzD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAC,uBAAuB,EAAE,IAAI,EAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"}
|
package/docs/esmodules.md
CHANGED
|
@@ -12,9 +12,9 @@ import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
|
12
12
|
|
|
13
13
|
const extensions = [".ts", ".js"];
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const preventTreeShakingPlugin = () => {
|
|
16
16
|
return {
|
|
17
|
-
name: 'no-
|
|
17
|
+
name: 'no-treeshaking',
|
|
18
18
|
resolveId(id, importer) {
|
|
19
19
|
if (!importer) {
|
|
20
20
|
// let's not theeshake entry points, as we're not exporting anything in Apps Script files
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
format: "esm",
|
|
33
33
|
},
|
|
34
34
|
plugins: [
|
|
35
|
-
|
|
35
|
+
preventTreeShakingPlugin(),
|
|
36
36
|
nodeResolve({
|
|
37
37
|
extensions,
|
|
38
38
|
}),
|
|
@@ -78,4 +78,4 @@ node_modules/**
|
|
|
78
78
|
|
|
79
79
|
Now you can push using your normal `clasp push`-command!
|
|
80
80
|
|
|
81
|
-
This should be enough to start developing a project using ES Modules. A complete example repo can be cloned from [atti187/esmodules](https://github.com/atti187/esmodules).
|
|
81
|
+
This should be enough to start developing a project using ES Modules. A complete example repo can be cloned from [atti187/esmodules](https://github.com/atti187/esmodules).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/clasp",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Develop Apps Script Projects locally",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./build/src/index.js",
|
|
@@ -60,17 +60,19 @@
|
|
|
60
60
|
"author": "Grant Timmerman",
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
63
|
+
"@sindresorhus/is": "^4.0.1",
|
|
64
|
+
"chalk": "^4.1.2",
|
|
65
|
+
"chokidar": "^3.5.2",
|
|
66
|
+
"cli-truncate": "^3.0.0",
|
|
67
|
+
"commander": "^8.1.0",
|
|
67
68
|
"debounce": "^1.2.1",
|
|
68
|
-
"dotf": "^2.0.
|
|
69
|
+
"dotf": "^2.0.2",
|
|
70
|
+
"find-up": "^6.0.0",
|
|
69
71
|
"fs-extra": "^10.0.0",
|
|
70
72
|
"fuzzy": "^0.1.3",
|
|
71
|
-
"google-auth-library": "^7.
|
|
72
|
-
"googleapis": "^
|
|
73
|
-
"inquirer": "^8.1.
|
|
73
|
+
"google-auth-library": "^7.6.2",
|
|
74
|
+
"googleapis": "^84.0.0",
|
|
75
|
+
"inquirer": "^8.1.2",
|
|
74
76
|
"inquirer-autocomplete-prompt-ipt": "^2.0.0",
|
|
75
77
|
"is-reachable": "^5.0.0",
|
|
76
78
|
"log-symbols": "^5.0.0",
|
|
@@ -78,34 +80,35 @@
|
|
|
78
80
|
"make-dir": "^3.1.0",
|
|
79
81
|
"multimatch": "^5.0.0",
|
|
80
82
|
"normalize-newline": "^4.1.0",
|
|
81
|
-
"open": "^8.2.
|
|
82
|
-
"ora": "^
|
|
83
|
-
"p-map": "^5.
|
|
83
|
+
"open": "^8.2.1",
|
|
84
|
+
"ora": "^6.0.0",
|
|
85
|
+
"p-map": "^5.1.0",
|
|
84
86
|
"read-pkg-up": "^8.0.0",
|
|
85
87
|
"recursive-readdir": "^2.2.2",
|
|
88
|
+
"server-destroy": "^1.0.1",
|
|
86
89
|
"split-lines": "^3.0.0",
|
|
87
90
|
"strip-bom": "^5.0.0",
|
|
88
|
-
"ts2gas": "^4.
|
|
89
|
-
"typescript": "^4.
|
|
90
|
-
"wtfnode": "^0.8.4"
|
|
91
|
+
"ts2gas": "^4.2.0",
|
|
92
|
+
"typescript": "^4.4.2"
|
|
91
93
|
},
|
|
92
94
|
"devDependencies": {
|
|
93
|
-
"@types/chai": "^4.2.
|
|
95
|
+
"@types/chai": "^4.2.21",
|
|
94
96
|
"@types/debounce": "^1.2.0",
|
|
95
|
-
"@types/fs-extra": "^9.0.
|
|
96
|
-
"@types/inquirer": "^7.3.
|
|
97
|
-
"@types/mocha": "^
|
|
98
|
-
"@types/node": "^12.20.
|
|
97
|
+
"@types/fs-extra": "^9.0.12",
|
|
98
|
+
"@types/inquirer": "^7.3.3",
|
|
99
|
+
"@types/mocha": "^9.0.0",
|
|
100
|
+
"@types/node": "^12.20.21",
|
|
99
101
|
"@types/recursive-readdir": "^2.2.0",
|
|
100
|
-
"@types/
|
|
102
|
+
"@types/server-destroy": "^1.0.1",
|
|
103
|
+
"@types/tmp": "^0.2.1",
|
|
101
104
|
"@types/wtfnode": "^0.7.0",
|
|
102
105
|
"chai": "^4.3.4",
|
|
103
|
-
"coveralls": "^3.1.
|
|
106
|
+
"coveralls": "^3.1.1",
|
|
104
107
|
"gts": "^3.1.0",
|
|
105
|
-
"mocha": "^9.
|
|
108
|
+
"mocha": "^9.1.1",
|
|
106
109
|
"nyc": "^15.1.0",
|
|
107
|
-
"prettier": "^2.3.
|
|
110
|
+
"prettier": "^2.3.2",
|
|
108
111
|
"tmp": "^0.2.1",
|
|
109
|
-
"type-fest": "^1.
|
|
112
|
+
"type-fest": "^2.1.0"
|
|
110
113
|
}
|
|
111
114
|
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import path from 'path';
|
|
3
|
-
/** A path broken down into a `dir`ectory and a `base` filename */
|
|
4
|
-
declare type BrokenPath = Pick<path.ParsedPath, 'dir' | 'base'>;
|
|
5
|
-
export declare class PathProxy {
|
|
6
|
-
protected _default: BrokenPath;
|
|
7
|
-
protected _userDefined: string | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Handles a path to a file.
|
|
10
|
-
*
|
|
11
|
-
* - Constructor requires a default path (directory and filename)
|
|
12
|
-
* - Path can be overridden with the `path` accessor.
|
|
13
|
-
* - The `resolve()` method implements specific rules to define the effective path to the proxied file.
|
|
14
|
-
*
|
|
15
|
-
* @param {BrokenPath} defaultPath default path
|
|
16
|
-
*/
|
|
17
|
-
constructor(defaultPath: BrokenPath);
|
|
18
|
-
/**
|
|
19
|
-
* Returns the current (raw and unresolved) defined path to the proxied file.
|
|
20
|
-
*
|
|
21
|
-
* *Note: for most uses, prefer the `resolve()` method in order to retreive a file's path*
|
|
22
|
-
*
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
get path(): string;
|
|
26
|
-
/**
|
|
27
|
-
* Sets the current (raw and unresolved) path to the proxied file.
|
|
28
|
-
*
|
|
29
|
-
* *Note: passing an empty string restores the default path*
|
|
30
|
-
*/
|
|
31
|
-
set path(userDefined: string);
|
|
32
|
-
/**
|
|
33
|
-
* Returns true if current path is the default.
|
|
34
|
-
*
|
|
35
|
-
* @returns {boolean}
|
|
36
|
-
*/
|
|
37
|
-
isDefault(): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Returns the resolved directory to the proxied file.
|
|
40
|
-
*
|
|
41
|
-
* *Note: for most uses, prefer the `.resolve()` method in order to retreive a file's path*
|
|
42
|
-
*
|
|
43
|
-
* @returns {string}
|
|
44
|
-
*/
|
|
45
|
-
get resolvedDir(): string;
|
|
46
|
-
/**
|
|
47
|
-
* Resolves the current active path
|
|
48
|
-
*
|
|
49
|
-
* @returns {string}
|
|
50
|
-
*/
|
|
51
|
-
resolve(): string;
|
|
52
|
-
}
|
|
53
|
-
export {};
|
package/build/src/path-proxy.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { ClaspError } from './clasp-error.js';
|
|
4
|
-
export class PathProxy {
|
|
5
|
-
/**
|
|
6
|
-
* Handles a path to a file.
|
|
7
|
-
*
|
|
8
|
-
* - Constructor requires a default path (directory and filename)
|
|
9
|
-
* - Path can be overridden with the `path` accessor.
|
|
10
|
-
* - The `resolve()` method implements specific rules to define the effective path to the proxied file.
|
|
11
|
-
*
|
|
12
|
-
* @param {BrokenPath} defaultPath default path
|
|
13
|
-
*/
|
|
14
|
-
constructor(defaultPath) {
|
|
15
|
-
this._default = defaultPath;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Returns the current (raw and unresolved) defined path to the proxied file.
|
|
19
|
-
*
|
|
20
|
-
* *Note: for most uses, prefer the `resolve()` method in order to retreive a file's path*
|
|
21
|
-
*
|
|
22
|
-
* @returns {string}
|
|
23
|
-
*/
|
|
24
|
-
get path() {
|
|
25
|
-
var _a;
|
|
26
|
-
return (_a = this._userDefined) !== null && _a !== void 0 ? _a : path.join(this._default.dir, this._default.base);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Sets the current (raw and unresolved) path to the proxied file.
|
|
30
|
-
*
|
|
31
|
-
* *Note: passing an empty string restores the default path*
|
|
32
|
-
*/
|
|
33
|
-
set path(userDefined) {
|
|
34
|
-
this._userDefined = userDefined === path.join(this._default.dir, this._default.base) ? undefined : userDefined;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Returns true if current path is the default.
|
|
38
|
-
*
|
|
39
|
-
* @returns {boolean}
|
|
40
|
-
*/
|
|
41
|
-
isDefault() {
|
|
42
|
-
return !this._userDefined || this._userDefined === path.join(this._default.dir, this._default.base);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns the resolved directory to the proxied file.
|
|
46
|
-
*
|
|
47
|
-
* *Note: for most uses, prefer the `.resolve()` method in order to retreive a file's path*
|
|
48
|
-
*
|
|
49
|
-
* @returns {string}
|
|
50
|
-
*/
|
|
51
|
-
get resolvedDir() {
|
|
52
|
-
return path.dirname(this.resolve());
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Resolves the current active path
|
|
56
|
-
*
|
|
57
|
-
* @returns {string}
|
|
58
|
-
*/
|
|
59
|
-
resolve() {
|
|
60
|
-
return this._userDefined
|
|
61
|
-
? resolvePath(this._userDefined, this._default.base)
|
|
62
|
-
: path.join(this._default.dir, this._default.base);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Attempts to resolve a path with the following rules:
|
|
67
|
-
*
|
|
68
|
-
* - if path exists and points to a file: use it as is
|
|
69
|
-
* - if path exists and points to a directory: append the default base filename to the path
|
|
70
|
-
* - if path partially resolves to an existing directory but base filename does not exists: use it as is
|
|
71
|
-
* - otherwise throw an error
|
|
72
|
-
*
|
|
73
|
-
* @param {string} pathToResolve the path to resolve
|
|
74
|
-
* @param {string} baseFilename the default base filename
|
|
75
|
-
*
|
|
76
|
-
* @returns {string}
|
|
77
|
-
*/
|
|
78
|
-
const resolvePath = (pathToResolve, baseFilename) => {
|
|
79
|
-
if (fs.existsSync(pathToResolve)) {
|
|
80
|
-
return appendBaseIfIsDirectory(pathToResolve, baseFilename);
|
|
81
|
-
}
|
|
82
|
-
const parsedPath = path.parse(pathToResolve);
|
|
83
|
-
if (parsedPath.dir === '' || fs.lstatSync(parsedPath.dir).isDirectory()) {
|
|
84
|
-
return pathToResolve; // Assume fullpath to missing file
|
|
85
|
-
}
|
|
86
|
-
// TODO: improve support for unresolved paths
|
|
87
|
-
throw new ClaspError(`Unrecognized path ${pathToResolve}`);
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Attempts to resolve an **existing** path using the following rules:
|
|
91
|
-
*
|
|
92
|
-
* - if path exists and points to a file: use it as is
|
|
93
|
-
* - if path exists and points to a directory: append the default base filename to the path
|
|
94
|
-
* - otherwise throw an error
|
|
95
|
-
*
|
|
96
|
-
* @param {string} somePath the path to resolve
|
|
97
|
-
* @param {string} baseFilename the default base filename
|
|
98
|
-
*
|
|
99
|
-
* @returns {string}
|
|
100
|
-
*/
|
|
101
|
-
const appendBaseIfIsDirectory = (somePath, baseFilename) => {
|
|
102
|
-
const stats = fs.lstatSync(somePath);
|
|
103
|
-
if (stats.isFile()) {
|
|
104
|
-
return somePath;
|
|
105
|
-
}
|
|
106
|
-
if (stats.isDirectory()) {
|
|
107
|
-
return path.join(somePath, baseFilename);
|
|
108
|
-
}
|
|
109
|
-
// TODO: improve support for other stats types (stats.isSymbolicLink() ? )
|
|
110
|
-
throw new ClaspError(`Unrecognized path ${somePath}`);
|
|
111
|
-
};
|
|
112
|
-
//# sourceMappingURL=path-proxy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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