@adobe/helix-shared-config 9.1.3 → 10.0.0
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 +19 -0
- package/package.json +8 -7
- package/src/BaseConfig.js +10 -12
- package/src/IgnoreConfig.js +3 -5
- package/src/IndexConfig.js +7 -9
- package/src/ModifiersConfig.js +1 -5
- package/src/MountConfig.js +5 -7
- package/src/MountPointHandler.js +1 -2
- package/src/NamedMapHandler.js +1 -2
- package/src/SchemaDerivedConfig.js +5 -7
- package/src/SitemapConfig.js +7 -9
- package/src/SitemapHandler.js +5 -8
- package/src/ValidationError.js +1 -3
- package/src/config-wrapper.js +9 -11
- package/src/fetchconfig/cache.js +3 -5
- package/src/fetchconfig/fetch.js +7 -9
- package/src/index.js +7 -17
- package/src/parsers/BaseParser.js +1 -3
- package/src/parsers/GlobfileParser.js +3 -5
- package/src/schemas/fstab.schema.cjs +12 -0
- package/src/schemas/index.schema.cjs +12 -0
- package/src/schemas/indexconfig.schema.cjs +12 -0
- package/src/schemas/mountpoint.schema.cjs +12 -0
- package/src/schemas/property.schema.cjs +12 -0
- package/src/schemas/query.schema.cjs +12 -0
- package/src/schemas/sitemap-language.schema.cjs +12 -0
- package/src/schemas/sitemap.schema.cjs +12 -0
- package/src/schemas/sitemapconfig.schema.cjs +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [@adobe/helix-shared-config-v10.0.0](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config-v9.1.4...@adobe/helix-shared-config-v10.0.0) (2023-01-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* use esm ([1ee2a3a](https://github.com/adobe/helix-shared/commit/1ee2a3a952b2ca6453507d73e89efdc06fc57c11))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* requires ESM
|
|
12
|
+
|
|
13
|
+
# [@adobe/helix-shared-config-v9.1.4](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config-v9.1.3...@adobe/helix-shared-config-v9.1.4) (2023-01-09)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **deps:** update external fixes ([#745](https://github.com/adobe/helix-shared/issues/745)) ([67f9cf6](https://github.com/adobe/helix-shared/commit/67f9cf65e0d7a2cd2a325cdc857cd3374c695144))
|
|
19
|
+
|
|
1
20
|
# [@adobe/helix-shared-config-v9.1.3](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config-v9.1.2...@adobe/helix-shared-config-v9.1.3) (2022-11-29)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-shared-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Shared modules of the Helix Project - config",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"test": "c8 mocha",
|
|
9
10
|
"lint": "eslint .",
|
|
@@ -28,19 +29,19 @@
|
|
|
28
29
|
"reporter-options": "configFile=.mocha-multi.json"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@adobe/fetch": "^
|
|
32
|
+
"@adobe/fetch": "^4.0.1",
|
|
32
33
|
"@adobe/helix-shared-git": "^2.0.4",
|
|
33
34
|
"@adobe/helix-shared-prune": "^1.0.5",
|
|
34
35
|
"@adobe/helix-shared-utils": "^2.1.0",
|
|
35
|
-
"ajv": "8.
|
|
36
|
+
"ajv": "8.12.0",
|
|
36
37
|
"ajv-formats": "2.1.1",
|
|
37
38
|
"cookie": "0.5.0",
|
|
38
|
-
"fs-extra": "11.
|
|
39
|
-
"ignore": "5.2.
|
|
39
|
+
"fs-extra": "11.1.0",
|
|
40
|
+
"ignore": "5.2.4",
|
|
40
41
|
"lru-cache": "7.14.1",
|
|
41
42
|
"object-hash": "3.0.0",
|
|
42
43
|
"uri-js": "4.4.1",
|
|
43
|
-
"yaml": "2.1
|
|
44
|
+
"yaml": "2.2.1"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@adobe/helix-shared-wrap": "^1.0.5",
|
|
@@ -48,6 +49,6 @@
|
|
|
48
49
|
"@pollyjs/adapter-node-http": "6.0.5",
|
|
49
50
|
"@pollyjs/core": "6.0.5",
|
|
50
51
|
"@pollyjs/persister-fs": "6.0.5",
|
|
51
|
-
"nock": "13.
|
|
52
|
+
"nock": "13.3.0"
|
|
52
53
|
}
|
|
53
54
|
}
|
package/src/BaseConfig.js
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
import fs from 'fs-extra';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import YAML from 'yaml';
|
|
15
|
+
import { GitUrl } from '@adobe/helix-shared-git';
|
|
16
|
+
import { options as cacheOptions } from './fetchconfig/cache.js';
|
|
17
|
+
import { fetchConfigCached } from './fetchconfig/fetch.js';
|
|
18
18
|
|
|
19
19
|
async function isFile(filePath) {
|
|
20
20
|
try {
|
|
@@ -24,7 +24,7 @@ async function isFile(filePath) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
class BaseConfig {
|
|
27
|
+
export class BaseConfig {
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
30
|
* @param {string} name name of the config file, e.g. `helix-config.yaml`
|
|
@@ -62,9 +62,9 @@ class BaseConfig {
|
|
|
62
62
|
max: options.maxSize,
|
|
63
63
|
};
|
|
64
64
|
delete opts.maxSize;
|
|
65
|
-
|
|
65
|
+
cacheOptions(opts);
|
|
66
66
|
} else {
|
|
67
|
-
|
|
67
|
+
cacheOptions(options);
|
|
68
68
|
}
|
|
69
69
|
return this;
|
|
70
70
|
}
|
|
@@ -170,7 +170,7 @@ class BaseConfig {
|
|
|
170
170
|
if (!this._source) {
|
|
171
171
|
if (this._repo) {
|
|
172
172
|
// fetch the config file from the repo
|
|
173
|
-
this._source = await
|
|
173
|
+
this._source = await fetchConfigCached({
|
|
174
174
|
...this._repo,
|
|
175
175
|
name: this._name,
|
|
176
176
|
log: this._logger,
|
|
@@ -221,5 +221,3 @@ class BaseConfig {
|
|
|
221
221
|
return YAML.stringify(this.toJSON());
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
module.exports = BaseConfig;
|
package/src/IgnoreConfig.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
import { BaseConfig } from './BaseConfig.js';
|
|
14
|
+
import { GlobfileParser } from './parsers/GlobfileParser.js';
|
|
15
15
|
|
|
16
16
|
const IGNORE_CONFIG = '.hlxignore';
|
|
17
17
|
|
|
18
|
-
class IgnoreConfig extends BaseConfig {
|
|
18
|
+
export class IgnoreConfig extends BaseConfig {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(IGNORE_CONFIG);
|
|
21
21
|
this._parser = new GlobfileParser();
|
|
@@ -39,5 +39,3 @@ class IgnoreConfig extends BaseConfig {
|
|
|
39
39
|
return this._parser.includes(path);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
module.exports = IgnoreConfig;
|
package/src/IndexConfig.js
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import { SchemaDerivedConfig } from './SchemaDerivedConfig.js';
|
|
13
|
+
import { NamedMapHandler } from './NamedMapHandler.js';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
import indexConfigSchema from './schemas/indexconfig.schema.cjs';
|
|
16
|
+
import indexSchema from './schemas/index.schema.cjs';
|
|
17
|
+
import propertySchema from './schemas/property.schema.cjs';
|
|
18
|
+
import querySchema from './schemas/query.schema.cjs';
|
|
19
19
|
|
|
20
|
-
class IndexConfig extends SchemaDerivedConfig {
|
|
20
|
+
export class IndexConfig extends SchemaDerivedConfig {
|
|
21
21
|
constructor() {
|
|
22
22
|
super({
|
|
23
23
|
filename: 'helix-query.yaml',
|
|
@@ -178,5 +178,3 @@ class IndexConfig extends SchemaDerivedConfig {
|
|
|
178
178
|
return this;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
|
|
182
|
-
module.exports = IndexConfig;
|
package/src/ModifiersConfig.js
CHANGED
|
@@ -24,7 +24,7 @@ function toMetaName(text) {
|
|
|
24
24
|
/**
|
|
25
25
|
* The modifiers class help manage the metadata and headers modifiers.
|
|
26
26
|
*/
|
|
27
|
-
class ModifiersConfig {
|
|
27
|
+
export class ModifiersConfig {
|
|
28
28
|
/**
|
|
29
29
|
* Converts a globbing expression to regexp. Note that only `*` and `**` are supported yet.
|
|
30
30
|
* @param {string} glob
|
|
@@ -171,7 +171,3 @@ class ModifiersConfig {
|
|
|
171
171
|
return modifiers;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
|
|
175
|
-
module.exports = {
|
|
176
|
-
ModifiersConfig,
|
|
177
|
-
};
|
package/src/MountConfig.js
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import { SchemaDerivedConfig } from './SchemaDerivedConfig.js';
|
|
13
|
+
import { MountPointHandler } from './MountPointHandler.js';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import fstabSchema from './schemas/fstab.schema.cjs';
|
|
16
|
+
import mountpointSchema from './schemas/mountpoint.schema.cjs';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Cleans up the URL by removing parameters that are deemed special. These
|
|
@@ -93,7 +93,7 @@ const githubDecorator = {
|
|
|
93
93
|
},
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
class MountConfig extends SchemaDerivedConfig {
|
|
96
|
+
export class MountConfig extends SchemaDerivedConfig {
|
|
97
97
|
constructor() {
|
|
98
98
|
super({
|
|
99
99
|
filename: 'fstab.yaml',
|
|
@@ -129,5 +129,3 @@ class MountConfig extends SchemaDerivedConfig {
|
|
|
129
129
|
return mp || null;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
module.exports = MountConfig;
|
package/src/MountPointHandler.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
const MountPointHandler = (decorators) => ({
|
|
13
|
+
export const MountPointHandler = (decorators) => ({
|
|
14
14
|
|
|
15
15
|
get: (target, prop) => {
|
|
16
16
|
const index = Number.parseInt(prop, 10);
|
|
@@ -43,4 +43,3 @@ const MountPointHandler = (decorators) => ({
|
|
|
43
43
|
return prop === 'length' ? Object.keys(target).length : target[prop];
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
|
-
exports.MountPointHandler = MountPointHandler;
|
package/src/NamedMapHandler.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
const NamedMapHandler = (keyname = 'name') => ({
|
|
12
|
+
export const NamedMapHandler = (keyname = 'name') => ({
|
|
13
13
|
get: (target, prop) => {
|
|
14
14
|
const index = Number.parseInt(prop, 10);
|
|
15
15
|
if (!Number.isNaN(index) && index >= 0) {
|
|
@@ -21,4 +21,3 @@ const NamedMapHandler = (keyname = 'name') => ({
|
|
|
21
21
|
return prop === 'length' ? Object.keys(target).length : target[prop];
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
|
-
exports.NamedMapHandler = NamedMapHandler;
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import Ajv from 'ajv';
|
|
13
|
+
import ajvFormats from 'ajv-formats';
|
|
14
|
+
import { BaseConfig } from './BaseConfig.js';
|
|
15
|
+
import { ValidationError } from './ValidationError.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* A Helix Config that is based on a (number of) JSON Schema(s).
|
|
19
19
|
*/
|
|
20
|
-
class SchemaDerivedConfig extends BaseConfig {
|
|
20
|
+
export class SchemaDerivedConfig extends BaseConfig {
|
|
21
21
|
/**
|
|
22
22
|
*
|
|
23
23
|
* @param {object} opts
|
|
@@ -152,5 +152,3 @@ class SchemaDerivedConfig extends BaseConfig {
|
|
|
152
152
|
return this._cfg;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
module.exports = SchemaDerivedConfig;
|
package/src/SitemapConfig.js
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import { SchemaDerivedConfig } from './SchemaDerivedConfig.js';
|
|
13
|
+
import { NamedMapHandler } from './NamedMapHandler.js';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
import sitemapConfigSchema from './schemas/sitemapconfig.schema.cjs';
|
|
16
|
+
import sitemapSchema from './schemas/sitemap.schema.cjs';
|
|
17
|
+
import languageSchema from './schemas/sitemap-language.schema.cjs';
|
|
18
|
+
import { SitemapHandler } from './SitemapHandler.js';
|
|
19
19
|
|
|
20
|
-
class SitemapConfig extends SchemaDerivedConfig {
|
|
20
|
+
export class SitemapConfig extends SchemaDerivedConfig {
|
|
21
21
|
constructor() {
|
|
22
22
|
super({
|
|
23
23
|
filename: 'helix-sitemap.yaml',
|
|
@@ -115,5 +115,3 @@ class SitemapConfig extends SchemaDerivedConfig {
|
|
|
115
115
|
return languages[name];
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
module.exports = SitemapConfig;
|
package/src/SitemapHandler.js
CHANGED
|
@@ -9,15 +9,13 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import { context as h2, h1 } from '@adobe/fetch';
|
|
13
|
+
import { NamedMapHandler } from './NamedMapHandler.js';
|
|
14
14
|
|
|
15
15
|
const wrap = (sitemap) => {
|
|
16
16
|
const context = process.env.HELIX_FETCH_FORCE_HTTP1
|
|
17
|
-
?
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
: fetchAPI.context();
|
|
17
|
+
? h1()
|
|
18
|
+
: h2();
|
|
21
19
|
const { fetch } = context;
|
|
22
20
|
|
|
23
21
|
if (typeof sitemap === 'object') {
|
|
@@ -52,7 +50,6 @@ const wrap = (sitemap) => {
|
|
|
52
50
|
return sitemap;
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
const SitemapHandler = (keyname = 'name') => ({
|
|
53
|
+
export const SitemapHandler = (keyname = 'name') => ({
|
|
56
54
|
get: (target, prop) => wrap(NamedMapHandler(keyname).get(target, prop)),
|
|
57
55
|
});
|
|
58
|
-
exports.SitemapHandler = SitemapHandler;
|
package/src/ValidationError.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/* eslint-disable max-classes-per-file */
|
|
13
13
|
|
|
14
|
-
class ValidationError extends Error {
|
|
14
|
+
export class ValidationError extends Error {
|
|
15
15
|
constructor(
|
|
16
16
|
msg,
|
|
17
17
|
errors = [],
|
|
@@ -42,5 +42,3 @@ ${msg}`);
|
|
|
42
42
|
return `${prettyname(dataPath, parentSchema)} ${message}: ${keyword}(${JSON.stringify(data)}, ${JSON.stringify(params)})`;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
module.exports = ValidationError;
|
package/src/config-wrapper.js
CHANGED
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import { Request, Response } from '@adobe/fetch';
|
|
13
|
+
|
|
14
|
+
import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
|
|
15
|
+
|
|
16
|
+
import { MountConfig as fstab } from './MountConfig.js';
|
|
17
|
+
import { IndexConfig as index } from './IndexConfig.js';
|
|
16
18
|
|
|
17
19
|
const loaders = {
|
|
18
20
|
fstab,
|
|
@@ -25,7 +27,7 @@ const loaders = {
|
|
|
25
27
|
* @param {...string} names the parameter names to extract
|
|
26
28
|
* @returns {object} an object with the provided parameter names as keys
|
|
27
29
|
*/
|
|
28
|
-
async function getData(request, ...names) {
|
|
30
|
+
export async function getData(request, ...names) {
|
|
29
31
|
if (/^application\/x-www-form-urlencoded/.test(request.headers.get('content-type'))) {
|
|
30
32
|
const data = new URLSearchParams(await request.text());
|
|
31
33
|
return names.reduce((prev, name) => {
|
|
@@ -155,14 +157,10 @@ function wrap(func, required, ...configs) {
|
|
|
155
157
|
};
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
function requiredConfig(func, ...configs) {
|
|
160
|
+
export function requiredConfig(func, ...configs) {
|
|
159
161
|
return wrap(func, true, ...configs);
|
|
160
162
|
}
|
|
161
163
|
|
|
162
|
-
function optionalConfig(func, ...configs) {
|
|
164
|
+
export function optionalConfig(func, ...configs) {
|
|
163
165
|
return wrap(func, false, ...configs);
|
|
164
166
|
}
|
|
165
|
-
|
|
166
|
-
module.exports = {
|
|
167
|
-
requiredConfig, optionalConfig, getData,
|
|
168
|
-
};
|
package/src/fetchconfig/cache.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import LRU from 'lru-cache';
|
|
14
14
|
|
|
15
15
|
let lru = new LRU({ max: 1000, ttl: 60 * 1000 });
|
|
16
16
|
|
|
@@ -31,7 +31,7 @@ let lru = new LRU({ max: 1000, ttl: 60 * 1000 });
|
|
|
31
31
|
* function returns `true` will the error be cached. The default is that
|
|
32
32
|
* errors are never cached, so that each new invocation will be uncached.
|
|
33
33
|
*/
|
|
34
|
-
function cache(fn, opts = {}) {
|
|
34
|
+
export function cache(fn, opts = {}) {
|
|
35
35
|
const {
|
|
36
36
|
hash = (...args) => args.join(),
|
|
37
37
|
cacheresult = () => true,
|
|
@@ -73,10 +73,8 @@ function cache(fn, opts = {}) {
|
|
|
73
73
|
* @param {object} opts options
|
|
74
74
|
* @param {number} opts.max maximum size of the cache
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
export const options = (opts) => {
|
|
77
77
|
lru = new LRU(opts);
|
|
78
78
|
|
|
79
79
|
return cache;
|
|
80
80
|
};
|
|
81
|
-
|
|
82
|
-
module.exports = cache;
|
package/src/fetchconfig/fetch.js
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import { context as h2, h1 } from '@adobe/fetch';
|
|
14
|
+
import * as utils from '@adobe/helix-shared-utils';
|
|
15
|
+
import { cache } from './cache.js';
|
|
16
16
|
|
|
17
|
+
/* c8 ignore next 3 */
|
|
17
18
|
const { fetch } = process.env.HELIX_FETCH_FORCE_HTTP1
|
|
18
|
-
?
|
|
19
|
-
|
|
20
|
-
: fetchAPI;
|
|
19
|
+
? h1()
|
|
20
|
+
: h2();
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Fetches an FSTab file from a GitHub repository
|
|
@@ -46,7 +46,7 @@ async function fetchConfigUncached(opts) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// keep it cachy.
|
|
49
|
-
const fetchConfigCached = cache(fetchConfigUncached, {
|
|
49
|
+
export const fetchConfigCached = cache(fetchConfigUncached, {
|
|
50
50
|
hash: (fn, {
|
|
51
51
|
url, options, name,
|
|
52
52
|
}) => ([
|
|
@@ -57,5 +57,3 @@ const fetchConfigCached = cache(fetchConfigUncached, {
|
|
|
57
57
|
? options.headers.Authorization : undefined,
|
|
58
58
|
].join()),
|
|
59
59
|
});
|
|
60
|
-
|
|
61
|
-
module.exports = fetchConfigCached;
|
package/src/index.js
CHANGED
|
@@ -9,21 +9,11 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const ValidationError = require('./ValidationError.js');
|
|
16
|
-
const IgnoreConfig = require('./IgnoreConfig.js');
|
|
17
|
-
const SitemapConfig = require('./SitemapConfig.js');
|
|
18
|
-
const { ModifiersConfig } = require('./ModifiersConfig.js');
|
|
12
|
+
export { IndexConfig } from './IndexConfig.js';
|
|
13
|
+
export { MountConfig } from './MountConfig.js';
|
|
14
|
+
export { optionalConfig, requiredConfig } from './config-wrapper.js';
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
SitemapConfig,
|
|
25
|
-
optionalConfig,
|
|
26
|
-
requiredConfig,
|
|
27
|
-
ValidationError,
|
|
28
|
-
ModifiersConfig,
|
|
29
|
-
};
|
|
16
|
+
export { ValidationError } from './ValidationError.js';
|
|
17
|
+
export { IgnoreConfig } from './IgnoreConfig.js';
|
|
18
|
+
export { SitemapConfig } from './SitemapConfig.js';
|
|
19
|
+
export { ModifiersConfig } from './ModifiersConfig.js';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
class BaseParser {
|
|
13
|
+
export class BaseParser {
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
16
16
|
* @param {string} name name of the parser, e.g. `yaml`
|
|
@@ -80,5 +80,3 @@ class BaseParser {
|
|
|
80
80
|
throw new Error(`${format} output not implemented for ${this._name}.`);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
module.exports = BaseParser;
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
import ignore from 'ignore';
|
|
14
|
+
import { BaseParser } from './BaseParser.js';
|
|
15
15
|
|
|
16
16
|
const NAME = 'globfile';
|
|
17
17
|
|
|
18
|
-
class GlobfileParser extends BaseParser {
|
|
18
|
+
export class GlobfileParser extends BaseParser {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(NAME, {
|
|
21
21
|
outputs: ['string'],
|
|
@@ -78,5 +78,3 @@ class GlobfileParser extends BaseParser {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
module.exports = GlobfileParser;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./fstab.schema.json');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./index.schema.json');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./indexconfig.schema.json');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./mountpoint.schema.json');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./property.schema.json');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./query.schema.json');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./sitemap-language.schema.json');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./sitemap.schema.json');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
module.exports = require('./sitemapconfig.schema.json');
|