@agnostack/env 2.0.0-canary.10 → 2.0.0-canary.11
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/esm/project.js +23 -14
- package/dist/project.d.ts +6 -3
- package/dist/project.js +23 -14
- package/package.json +1 -1
package/dist/esm/project.js
CHANGED
|
@@ -17,15 +17,17 @@ export const parseProjectName = (_name) => {
|
|
|
17
17
|
* manifests, and the parser is deliberately tolerant of a missing or partial object.
|
|
18
18
|
*
|
|
19
19
|
* @typedef {object} PackageInfo
|
|
20
|
-
* @property {string} [
|
|
20
|
+
* @property {string} [deployVersion]
|
|
21
|
+
* @property {string} [apiVersion]
|
|
21
22
|
* @property {string} [version]
|
|
22
|
-
* @property {string
|
|
23
|
+
* @property {string} [name]
|
|
23
24
|
* @property {string} [owner]
|
|
24
25
|
* @property {string} [appName]
|
|
25
26
|
* @property {string} [siteName]
|
|
26
27
|
* @property {string} [shortName]
|
|
27
28
|
* @property {string} [siteHandle]
|
|
28
29
|
* @property {string} [siteAuthor]
|
|
30
|
+
* @property {string[]} [keywords]
|
|
29
31
|
* @property {Record<string, string>} [dependencies]
|
|
30
32
|
* @property {Record<string, string>} [devDependencies]
|
|
31
33
|
* @property {Record<string, string>} [peerDependencies]
|
|
@@ -34,19 +36,32 @@ export const parseProjectName = (_name) => {
|
|
|
34
36
|
* @property {string[]} [bundledDependencies]
|
|
35
37
|
* @property {string[]} [browserDependencies]
|
|
36
38
|
*/
|
|
37
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Split a package.json into its resolved details, its organization and its full name.
|
|
41
|
+
*
|
|
42
|
+
* ⚠️ The return is declared as a TUPLE. An array literal infers as
|
|
43
|
+
* `(string | typeof packageDetails)[]`, so destructuring the first element would hand callers a
|
|
44
|
+
* union instead of the object.
|
|
45
|
+
*
|
|
46
|
+
* @param {PackageInfo} [packageInfo]
|
|
47
|
+
* @returns {[typeof packageDetails, string | undefined, string]}
|
|
48
|
+
*/
|
|
38
49
|
export const parsePackageInfo = (packageInfo) => {
|
|
39
|
-
const { version, keywords, shortName,
|
|
50
|
+
const { apiVersion, version, keywords, shortName, siteAuthor, siteHandle, devDependencies, peerDependencies, bundleDependencies, bundledDependencies = bundleDependencies, dependencies: runtimeDependencies, optionalDependencies, browserDependencies, name: _name, owner: _appOwner, appName: _appName, siteName: _siteName, deployVersion: _deployVersion, } = packageInfo !== null && packageInfo !== void 0 ? packageInfo : {};
|
|
40
51
|
const { name, organization, projectName } = parseProjectName(_name);
|
|
52
|
+
// The deploy-time pin, when a manifest carries one. `version` stays the manifest's OWN value, so
|
|
53
|
+
// a caller can tell a real pin from the inert placeholder every workspace package declares.
|
|
54
|
+
const deployVersion = _deployVersion !== null && _deployVersion !== void 0 ? _deployVersion : apiVersion;
|
|
41
55
|
const appName = _appName !== null && _appName !== void 0 ? _appName : projectName === null || projectName === void 0 ? void 0 : projectName.slice((projectName === null || projectName === void 0 ? void 0 : projectName.indexOf('-')) + 1);
|
|
42
56
|
const siteName = _siteName !== null && _siteName !== void 0 ? _siteName : projectName === null || projectName === void 0 ? void 0 : projectName.slice((projectName === null || projectName === void 0 ? void 0 : projectName.indexOf('-')) + 1);
|
|
43
57
|
const companyName = organization === null || organization === void 0 ? void 0 : organization.replace('@', '');
|
|
44
58
|
const appOwner = _appOwner !== null && _appOwner !== void 0 ? _appOwner : companyName;
|
|
45
|
-
const packageDetails = {
|
|
59
|
+
const packageDetails = Object.assign(Object.assign({}, deployVersion && {
|
|
60
|
+
deployVersion,
|
|
61
|
+
}), { version,
|
|
46
62
|
keywords,
|
|
47
63
|
appOwner,
|
|
48
64
|
appName,
|
|
49
|
-
version,
|
|
50
65
|
siteName,
|
|
51
66
|
shortName,
|
|
52
67
|
siteHandle,
|
|
@@ -58,12 +73,6 @@ export const parsePackageInfo = (packageInfo) => {
|
|
|
58
73
|
bundledDependencies,
|
|
59
74
|
runtimeDependencies,
|
|
60
75
|
browserDependencies,
|
|
61
|
-
optionalDependencies
|
|
62
|
-
|
|
63
|
-
// NOTE: declared as a tuple — an array literal infers as
|
|
64
|
-
// (string | typeof packageDetails)[], so destructuring the first element
|
|
65
|
-
// would hand callers a union instead of the object.
|
|
66
|
-
/** @type {[typeof packageDetails, string | undefined, string]} */
|
|
67
|
-
const packageParts = [packageDetails, organization, name];
|
|
68
|
-
return packageParts;
|
|
76
|
+
optionalDependencies });
|
|
77
|
+
return [packageDetails, organization, name];
|
|
69
78
|
};
|
package/dist/project.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ export function parseProjectName(_name: unknown): {
|
|
|
5
5
|
projectName: string;
|
|
6
6
|
};
|
|
7
7
|
export function parsePackageInfo(packageInfo?: PackageInfo): [{
|
|
8
|
+
version: string | undefined;
|
|
8
9
|
keywords: string[] | undefined;
|
|
9
10
|
appOwner: string;
|
|
10
11
|
appName: string;
|
|
11
|
-
version: string | undefined;
|
|
12
12
|
siteName: string;
|
|
13
13
|
shortName: string | undefined;
|
|
14
14
|
siteHandle: string | undefined;
|
|
@@ -21,21 +21,24 @@ export function parsePackageInfo(packageInfo?: PackageInfo): [{
|
|
|
21
21
|
runtimeDependencies: Record<string, string> | undefined;
|
|
22
22
|
browserDependencies: string[] | undefined;
|
|
23
23
|
optionalDependencies: Record<string, string> | undefined;
|
|
24
|
+
deployVersion?: string | undefined;
|
|
24
25
|
}, string | undefined, string];
|
|
25
26
|
/**
|
|
26
27
|
* The subset of a package.json this reads. Everything is optional — callers pass raw
|
|
27
28
|
* manifests, and the parser is deliberately tolerant of a missing or partial object.
|
|
28
29
|
*/
|
|
29
30
|
export type PackageInfo = {
|
|
30
|
-
|
|
31
|
+
deployVersion?: string | undefined;
|
|
32
|
+
apiVersion?: string | undefined;
|
|
31
33
|
version?: string | undefined;
|
|
32
|
-
|
|
34
|
+
name?: string | undefined;
|
|
33
35
|
owner?: string | undefined;
|
|
34
36
|
appName?: string | undefined;
|
|
35
37
|
siteName?: string | undefined;
|
|
36
38
|
shortName?: string | undefined;
|
|
37
39
|
siteHandle?: string | undefined;
|
|
38
40
|
siteAuthor?: string | undefined;
|
|
41
|
+
keywords?: string[] | undefined;
|
|
39
42
|
dependencies?: Record<string, string> | undefined;
|
|
40
43
|
devDependencies?: Record<string, string> | undefined;
|
|
41
44
|
peerDependencies?: Record<string, string> | undefined;
|
package/dist/project.js
CHANGED
|
@@ -21,15 +21,17 @@ exports.parseProjectName = parseProjectName;
|
|
|
21
21
|
* manifests, and the parser is deliberately tolerant of a missing or partial object.
|
|
22
22
|
*
|
|
23
23
|
* @typedef {object} PackageInfo
|
|
24
|
-
* @property {string} [
|
|
24
|
+
* @property {string} [deployVersion]
|
|
25
|
+
* @property {string} [apiVersion]
|
|
25
26
|
* @property {string} [version]
|
|
26
|
-
* @property {string
|
|
27
|
+
* @property {string} [name]
|
|
27
28
|
* @property {string} [owner]
|
|
28
29
|
* @property {string} [appName]
|
|
29
30
|
* @property {string} [siteName]
|
|
30
31
|
* @property {string} [shortName]
|
|
31
32
|
* @property {string} [siteHandle]
|
|
32
33
|
* @property {string} [siteAuthor]
|
|
34
|
+
* @property {string[]} [keywords]
|
|
33
35
|
* @property {Record<string, string>} [dependencies]
|
|
34
36
|
* @property {Record<string, string>} [devDependencies]
|
|
35
37
|
* @property {Record<string, string>} [peerDependencies]
|
|
@@ -38,19 +40,32 @@ exports.parseProjectName = parseProjectName;
|
|
|
38
40
|
* @property {string[]} [bundledDependencies]
|
|
39
41
|
* @property {string[]} [browserDependencies]
|
|
40
42
|
*/
|
|
41
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Split a package.json into its resolved details, its organization and its full name.
|
|
45
|
+
*
|
|
46
|
+
* ⚠️ The return is declared as a TUPLE. An array literal infers as
|
|
47
|
+
* `(string | typeof packageDetails)[]`, so destructuring the first element would hand callers a
|
|
48
|
+
* union instead of the object.
|
|
49
|
+
*
|
|
50
|
+
* @param {PackageInfo} [packageInfo]
|
|
51
|
+
* @returns {[typeof packageDetails, string | undefined, string]}
|
|
52
|
+
*/
|
|
42
53
|
const parsePackageInfo = (packageInfo) => {
|
|
43
|
-
const { version, keywords, shortName,
|
|
54
|
+
const { apiVersion, version, keywords, shortName, siteAuthor, siteHandle, devDependencies, peerDependencies, bundleDependencies, bundledDependencies = bundleDependencies, dependencies: runtimeDependencies, optionalDependencies, browserDependencies, name: _name, owner: _appOwner, appName: _appName, siteName: _siteName, deployVersion: _deployVersion, } = packageInfo !== null && packageInfo !== void 0 ? packageInfo : {};
|
|
44
55
|
const { name, organization, projectName } = (0, exports.parseProjectName)(_name);
|
|
56
|
+
// The deploy-time pin, when a manifest carries one. `version` stays the manifest's OWN value, so
|
|
57
|
+
// a caller can tell a real pin from the inert placeholder every workspace package declares.
|
|
58
|
+
const deployVersion = _deployVersion !== null && _deployVersion !== void 0 ? _deployVersion : apiVersion;
|
|
45
59
|
const appName = _appName !== null && _appName !== void 0 ? _appName : projectName === null || projectName === void 0 ? void 0 : projectName.slice((projectName === null || projectName === void 0 ? void 0 : projectName.indexOf('-')) + 1);
|
|
46
60
|
const siteName = _siteName !== null && _siteName !== void 0 ? _siteName : projectName === null || projectName === void 0 ? void 0 : projectName.slice((projectName === null || projectName === void 0 ? void 0 : projectName.indexOf('-')) + 1);
|
|
47
61
|
const companyName = organization === null || organization === void 0 ? void 0 : organization.replace('@', '');
|
|
48
62
|
const appOwner = _appOwner !== null && _appOwner !== void 0 ? _appOwner : companyName;
|
|
49
|
-
const packageDetails = {
|
|
63
|
+
const packageDetails = Object.assign(Object.assign({}, deployVersion && {
|
|
64
|
+
deployVersion,
|
|
65
|
+
}), { version,
|
|
50
66
|
keywords,
|
|
51
67
|
appOwner,
|
|
52
68
|
appName,
|
|
53
|
-
version,
|
|
54
69
|
siteName,
|
|
55
70
|
shortName,
|
|
56
71
|
siteHandle,
|
|
@@ -62,13 +77,7 @@ const parsePackageInfo = (packageInfo) => {
|
|
|
62
77
|
bundledDependencies,
|
|
63
78
|
runtimeDependencies,
|
|
64
79
|
browserDependencies,
|
|
65
|
-
optionalDependencies
|
|
66
|
-
|
|
67
|
-
// NOTE: declared as a tuple — an array literal infers as
|
|
68
|
-
// (string | typeof packageDetails)[], so destructuring the first element
|
|
69
|
-
// would hand callers a union instead of the object.
|
|
70
|
-
/** @type {[typeof packageDetails, string | undefined, string]} */
|
|
71
|
-
const packageParts = [packageDetails, organization, name];
|
|
72
|
-
return packageParts;
|
|
80
|
+
optionalDependencies });
|
|
81
|
+
return [packageDetails, organization, name];
|
|
73
82
|
};
|
|
74
83
|
exports.parsePackageInfo = parsePackageInfo;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agnostack/env",
|
|
3
|
-
"version": "2.0.0-canary.
|
|
3
|
+
"version": "2.0.0-canary.11",
|
|
4
4
|
"author": "agnoStack Dev <developers@agnostack.com> (https://agnostack.com)",
|
|
5
5
|
"owner": "agnoStack",
|
|
6
6
|
"description": "Please contact agnoStack via info@agnostack.com for any questions",
|