@eik/common 2.0.3 → 3.0.1

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +13 -11
  3. package/eikjson.d.ts +41 -0
  4. package/lib/classes/custom-error.js +3 -0
  5. package/lib/classes/eik-config.js +108 -47
  6. package/lib/classes/file-mapping.js +40 -0
  7. package/lib/classes/invalid-config-error.js +3 -0
  8. package/lib/classes/local-file-location.js +59 -0
  9. package/lib/classes/missing-config-error.js +3 -0
  10. package/lib/classes/no-files-matched-error.js +3 -0
  11. package/lib/classes/read-file.js +4 -8
  12. package/lib/classes/remote-file-location.js +41 -0
  13. package/lib/classes/resolved-files.js +56 -0
  14. package/lib/classes/single-dest-multiple-source-error.js +3 -0
  15. package/lib/helpers/config-store.js +22 -5
  16. package/lib/helpers/get-defaults.js +4 -2
  17. package/lib/helpers/index.js +21 -2
  18. package/lib/helpers/local-assets.js +44 -48
  19. package/lib/helpers/path-slashes.js +43 -0
  20. package/lib/helpers/resolve-files.js +81 -0
  21. package/lib/helpers/type-slug.js +6 -0
  22. package/lib/helpers/type-title.js +7 -0
  23. package/lib/schemas/assert.js +11 -9
  24. package/lib/schemas/eikjson.schema.json +10 -5
  25. package/lib/schemas/index.js +1 -1
  26. package/lib/schemas/validate.js +1 -2
  27. package/lib/schemas/validation-error.js +6 -2
  28. package/lib/stream.js +9 -2
  29. package/lib/validators/index.js +8 -8
  30. package/package.json +33 -23
  31. package/types/classes/custom-error.d.ts +7 -0
  32. package/types/classes/eik-config.d.ts +58 -0
  33. package/types/classes/file-mapping.d.ts +21 -0
  34. package/types/classes/invalid-config-error.d.ts +4 -0
  35. package/types/classes/local-file-location.d.ts +36 -0
  36. package/types/classes/missing-config-error.d.ts +4 -0
  37. package/types/classes/multiple-config-sources-error.d.ts +5 -0
  38. package/types/classes/no-files-matched-error.d.ts +4 -0
  39. package/types/classes/read-file.d.ts +15 -0
  40. package/types/classes/remote-file-location.d.ts +21 -0
  41. package/types/classes/resolved-files.d.ts +20 -0
  42. package/types/classes/single-dest-multiple-source-error.d.ts +4 -0
  43. package/types/helpers/config-store.d.ts +31 -0
  44. package/types/helpers/get-defaults.d.ts +2 -0
  45. package/types/helpers/index.d.ts +11 -0
  46. package/types/helpers/local-assets.d.ts +8 -0
  47. package/types/helpers/path-slashes.d.ts +32 -0
  48. package/types/helpers/resolve-files.d.ts +13 -0
  49. package/types/helpers/type-slug.d.ts +2 -0
  50. package/types/helpers/type-title.d.ts +2 -0
  51. package/types/index.d.ts +7 -0
  52. package/types/schemas/assert.d.ts +8 -0
  53. package/types/schemas/index.d.ts +71 -0
  54. package/types/schemas/validate.d.ts +26 -0
  55. package/types/schemas/validation-error.d.ts +8 -0
  56. package/types/stream.d.ts +2 -0
  57. package/types/validators/index.d.ts +8 -0
  58. package/lib/helpers/package-url.js +0 -20
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @type {(value: unknown, message?: string) => asserts value}
3
+ */
4
+ const assert = require('assert');
5
+ const LocalFileLocation = require('./local-file-location');
6
+ const {
7
+ removeLeadingSlash,
8
+ removeTrailingSlash,
9
+ } = require('../helpers/path-slashes');
10
+
11
+ const originalFiles = Symbol('files');
12
+
13
+ class ResolvedFiles {
14
+ /**
15
+ * @param {string[]} files
16
+ * @param {{definition: [string, string], basePath: string, pattern: string}} meta
17
+ */
18
+ constructor(files, meta) {
19
+ assert(Array.isArray(files), '"files" must be an array');
20
+ assert(meta, '"meta" must be defined');
21
+ assert(
22
+ typeof meta.basePath,
23
+ '"meta.basePath" must be a non empty string',
24
+ );
25
+ assert(
26
+ typeof meta.pattern,
27
+ '"meta.pattern" must be a non empty string',
28
+ );
29
+ assert(
30
+ Array.isArray(meta.definition),
31
+ '"meta.definition" must be an array',
32
+ );
33
+ assert(
34
+ meta.definition.length === 2,
35
+ '"meta.definition" must be an array of length 2',
36
+ );
37
+
38
+ const [destination, source] = meta.definition;
39
+ this[originalFiles] = files;
40
+ this.destination = destination;
41
+ this.source = source;
42
+ this.basePath = meta.basePath;
43
+ this.pattern = meta.pattern;
44
+ }
45
+
46
+ *[Symbol.iterator]() {
47
+ for (const file of this[originalFiles]) {
48
+ const relative = removeTrailingSlash(
49
+ removeLeadingSlash(file.replace(this.basePath, '')),
50
+ );
51
+ yield new LocalFileLocation(relative, this.basePath);
52
+ }
53
+ }
54
+ }
55
+
56
+ module.exports = ResolvedFiles;
@@ -1,6 +1,9 @@
1
1
  const CustomError = require('./custom-error');
2
2
 
3
3
  module.exports = class SingleDestMultipleSourcesError extends CustomError {
4
+ /**
5
+ * @param {string} destFilePath
6
+ */
4
7
  constructor(destFilePath) {
5
8
  super(
6
9
  `Cannot specify a single file destination for multiple source files. See '${destFilePath}'`,
@@ -7,10 +7,17 @@ const MissingConfigError = require('../classes/missing-config-error');
7
7
  const MultipleConfigSourcesError = require('../classes/multiple-config-sources-error');
8
8
  const InvalidConfigError = require('../classes/invalid-config-error');
9
9
 
10
+ /**
11
+ * Read a file at a given path and parse it
12
+ *
13
+ * @param {string} path
14
+ *
15
+ * @returns {object}
16
+ */
10
17
  function readJSONFromDisk(path) {
11
18
  let fileData;
12
19
  try {
13
- fileData = readFileSync(path);
20
+ fileData = readFileSync(path, { encoding: 'utf8' });
14
21
  } catch (e) {
15
22
  return null;
16
23
  }
@@ -53,16 +60,26 @@ module.exports = {
53
60
  const config = new EikConfig(assets, eikrc.tokens, configRootDir);
54
61
  try {
55
62
  config.validate();
56
- } catch(err) {
57
- throw new InvalidConfigError(`config.findInDirectory operation failed: ${err.message}`);
63
+ } catch (err) {
64
+ throw new InvalidConfigError(
65
+ `config.findInDirectory operation failed: ${err.message}`,
66
+ );
58
67
  }
59
68
  return config;
60
69
  },
70
+
71
+ /**
72
+ * Persist config changes to disk as <cwd>/eik.json
73
+ *
74
+ * @param {import('../classes/eik-config')} config
75
+ */
61
76
  persistToDisk(config) {
62
77
  try {
63
78
  config.validate();
64
- } catch(err) {
65
- throw new InvalidConfigError(`config.persistToDisk operation failed: ${err.message}`);
79
+ } catch (err) {
80
+ throw new InvalidConfigError(
81
+ `config.persistToDisk operation failed: ${err.message}`,
82
+ );
66
83
  }
67
84
  const dest = join(config.cwd, 'eik.json');
68
85
  writeFileSync(dest, JSON.stringify(config, null, 2));
@@ -1,3 +1,5 @@
1
+ // @ts-check
2
+
1
3
  'use strict';
2
4
 
3
5
  const configStore = require('./config-store');
@@ -8,14 +10,14 @@ const EikConfig = require('../classes/eik-config');
8
10
  *
9
11
  * @param {string} cwd The current working directory
10
12
  *
11
- * @returns {{server:string,token:string,js:string|object,css:string|object,version:string,map:Array,name:string,out:string,cwd:string}}
13
+ * @returns {import("../classes/eik-config")} EikConfig
12
14
  */
13
15
  module.exports = function getDefaults(cwd) {
14
16
  try {
15
17
  return configStore.findInDirectory(cwd);
16
18
  } catch (e) {
17
19
  if (e.constructor.name === 'MissingConfigError') {
18
- return new EikConfig({}, [], cwd);
20
+ return new EikConfig(null, [], cwd);
19
21
  }
20
22
  throw e;
21
23
  }
@@ -1,6 +1,25 @@
1
1
  const localAssets = require('./local-assets');
2
- const packageURL = require('./package-url');
3
2
  const getDefaults = require('./get-defaults');
4
3
  const configStore = require('./config-store');
4
+ const typeSlug = require('./type-slug');
5
+ const typeTitle = require('./type-title');
6
+ const resolveFiles = require('./resolve-files');
7
+ const {
8
+ addTrailingSlash,
9
+ removeTrailingSlash,
10
+ addLeadingSlash,
11
+ removeLeadingSlash,
12
+ } = require('./path-slashes');
5
13
 
6
- module.exports = { localAssets, packageURL, getDefaults, configStore };
14
+ module.exports = {
15
+ localAssets,
16
+ getDefaults,
17
+ configStore,
18
+ typeSlug,
19
+ typeTitle,
20
+ addTrailingSlash,
21
+ removeTrailingSlash,
22
+ addLeadingSlash,
23
+ removeLeadingSlash,
24
+ resolveFiles,
25
+ };
@@ -1,64 +1,60 @@
1
1
  /* eslint-disable no-await-in-loop */
2
2
 
3
+ /**
4
+ * @type {(value: unknown, message?: string) => asserts value}
5
+ */
3
6
  const assert = require('assert');
4
- const { join, extname, basename } = require('path');
5
7
  const fs = require('fs');
6
- const configStore = require("./config-store")
8
+ const configStore = require('./config-store');
7
9
 
8
10
  /**
9
11
  * Sets up asset routes for local development. Mounted paths match those on Eik server and values are read from projects eik.json file.
10
- *
12
+ *
11
13
  * @param {object} app - express js or fastify app instance
12
14
  * @param {string} rootEikDirectory - (optional) path to folder where eik configuration file can be found
13
15
  */
14
- async function localAssets(
15
- app,
16
- rootEikDirectory = process.cwd(),
17
- ) {
18
- assert(app.decorateReply || app.name === 'app', 'App must be an Express or Fastify app instance');
19
- assert(typeof rootEikDirectory === 'string' && rootEikDirectory, 'Path to folder for eik config must be provided and must be of type string');
16
+ async function localAssets(app, rootEikDirectory = process.cwd()) {
17
+ assert(
18
+ app.decorateReply || app.name === 'app' || app.route,
19
+ 'App must be an Express, Fastify or Hapi app instance',
20
+ );
21
+ assert(
22
+ typeof rootEikDirectory === 'string' && rootEikDirectory,
23
+ 'Path to folder for eik config must be provided and must be of type string',
24
+ );
20
25
  // ensure eik.json only loaded 1x
21
26
  const eik = configStore.findInDirectory(rootEikDirectory);
22
27
 
23
- (await eik.pathsAndFiles()).forEach(([pathname, filePath]) => {
24
- const ext = extname(filePath);
25
- const pathnameHasExt = !!extname(pathname);
26
- const value = pathnameHasExt
27
- ? join(`/pkg/${eik.name}/${eik.version}`, pathname)
28
- : join(
29
- `/pkg/${eik.name}/${eik.version}`,
30
- pathname,
31
- basename(filePath),
32
- );
33
- const fileOnDisk = join(eik.cwd, filePath);
34
- let contentType;
35
- switch (ext) {
36
- case '.js':
37
- contentType = 'application/javascript';
38
- break;
39
- case '.map':
40
- case '.json':
41
- contentType = 'application/json';
42
- break;
43
- case '.css':
44
- contentType = 'text/css';
45
- break;
46
- default:
47
- contentType = 'application/octet-stream';
28
+ (await eik.mappings()).forEach((mapping) => {
29
+ const { pathname } = mapping.destination.url;
30
+ const { contentType, absolute: path } = mapping.source;
31
+ if (app.get) {
32
+ app.get(pathname, (req, res) => {
33
+ if (res.set) {
34
+ // express
35
+ res.set('Access-Control-Allow-Origin', '*');
36
+ res.set('content-type', contentType);
37
+ fs.createReadStream(path).pipe(res);
38
+ } else if (res.type) {
39
+ // fastify
40
+ res.header('Access-Control-Allow-Origin', '*');
41
+ res.type(contentType);
42
+ res.send(fs.createReadStream(path));
43
+ }
44
+ });
45
+ } else {
46
+ // hapi
47
+ app.route({
48
+ method: 'GET',
49
+ path: pathname,
50
+ handler(req, h) {
51
+ return h
52
+ .response(fs.createReadStream(path))
53
+ .header('Access-Control-Allow-Origin', '*')
54
+ .type(contentType);
55
+ },
56
+ });
48
57
  }
49
- app.get(value, (req, res) => {
50
- if (res.set) {
51
- // express
52
- res.set('Access-Control-Allow-Origin', '*');
53
- res.set('content-type', contentType);
54
- fs.createReadStream(fileOnDisk).pipe(res);
55
- } else if (res.type) {
56
- // fastify
57
- res.header('Access-Control-Allow-Origin', '*');
58
- res.type(contentType);
59
- res.send(fs.createReadStream(fileOnDisk));
60
- }
61
- });
62
- })
58
+ });
63
59
  }
64
60
  module.exports = localAssets;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Add a trailing slash to a path if necessary
3
+ *
4
+ * @param {string} val
5
+ *
6
+ * @returns {string}
7
+ */
8
+ const addTrailingSlash = (val) => (val.endsWith('/') ? val : `${val}/`);
9
+
10
+ /**
11
+ * Remove a trailing slash from a path if necessary
12
+ *
13
+ * @param {string} val
14
+ *
15
+ * @returns {string}
16
+ */
17
+ const removeTrailingSlash = (val) =>
18
+ val.endsWith('/') ? val.substr(0, val.length - 1) : val;
19
+
20
+ /**
21
+ * Add a leading slash to a path if necessary
22
+ *
23
+ * @param {string} val
24
+ *
25
+ * @returns {string}
26
+ */
27
+ const addLeadingSlash = (val) => (val.startsWith('/') ? val : `/${val}`);
28
+
29
+ /**
30
+ * Remove a leading slash from a path if necessary
31
+ *
32
+ * @param {string} val
33
+ *
34
+ * @returns {string}
35
+ */
36
+ const removeLeadingSlash = (val) => (val.startsWith('/') ? val.substr(1) : val);
37
+
38
+ module.exports = {
39
+ addTrailingSlash,
40
+ removeTrailingSlash,
41
+ addLeadingSlash,
42
+ removeLeadingSlash,
43
+ };
@@ -0,0 +1,81 @@
1
+ /* eslint-disable no-continue */
2
+
3
+ const { promisify } = require('util');
4
+ const { extname, join, isAbsolute, basename, sep, normalize } = require('path');
5
+ const isGlob = require('is-glob');
6
+ const glob = promisify(require('glob'));
7
+ const {
8
+ removeTrailingSlash,
9
+ addLeadingSlash,
10
+ removeLeadingSlash,
11
+ } = require('./path-slashes');
12
+ const ResolvedFiles = require('../classes/resolved-files');
13
+
14
+ /**
15
+ * Create a new path from a path string preceeding a glob or the whole path if no glob is found
16
+ *
17
+ * @param {string} path
18
+ * @returns {string} modified path
19
+ */
20
+ const pathUntilGlob = (path) => {
21
+ const segments = (path || '').split(sep);
22
+ const segmentsToKeep = [];
23
+ for (const segment of segments) {
24
+ if (segment === '.') continue;
25
+ if (segment === '') continue;
26
+ if (isGlob(segment)) break;
27
+ segmentsToKeep.push(segment);
28
+ }
29
+ return addLeadingSlash(normalize(segmentsToKeep.join(sep)));
30
+ };
31
+
32
+ /**
33
+ * Uses an Eik JSON "files" definition to resolve files on disk into a data structure
34
+ *
35
+ * @param {{[k: string]: string;}} files
36
+ * @param {string} cwd
37
+ *
38
+ * @returns {Promise<ResolvedFiles[]>}
39
+ */
40
+ const resolveFiles = async (files, cwd) =>
41
+ Promise.all(
42
+ Object.entries(files).map(async (definition) => {
43
+ const [, source] = definition;
44
+ // normalise to absolute path
45
+ let pattern = isAbsolute(source) ? source : join(cwd, source);
46
+
47
+ // append glob if folder
48
+ if (extname(pattern) === '' && isGlob(pattern) === false) {
49
+ pattern = join(pattern, '/**/*');
50
+ }
51
+
52
+ // trim off any glob
53
+ let basePath = pathUntilGlob(pattern);
54
+
55
+ // fix basePath if file
56
+ if (extname(pattern) !== '') {
57
+ basePath = removeTrailingSlash(
58
+ basePath.replace(basename(pattern), ''),
59
+ );
60
+ }
61
+
62
+ // process glob pattern into a list of existing files
63
+ const resolvedFiles = await glob(pattern, {
64
+ cwd: basePath,
65
+ nodir: true,
66
+ });
67
+
68
+ // trim off the basePath to create a relative pathed pattern
69
+ pattern = removeTrailingSlash(
70
+ removeLeadingSlash(pattern.replace(basePath, '')),
71
+ );
72
+
73
+ return new ResolvedFiles(resolvedFiles, {
74
+ definition,
75
+ basePath,
76
+ pattern,
77
+ });
78
+ }),
79
+ );
80
+
81
+ module.exports = resolveFiles;
@@ -0,0 +1,6 @@
1
+ // @ts-check
2
+
3
+ module.exports = (type) => {
4
+ if (type === 'package') return 'pkg';
5
+ return type;
6
+ };
@@ -0,0 +1,7 @@
1
+ // @ts-check
2
+
3
+ module.exports = (type) => {
4
+ if (type === 'package') return 'PACKAGE';
5
+ if (type === 'npm') return 'NPM';
6
+ return 'MAP';
7
+ };
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ // @ts-check
2
2
 
3
3
  const {
4
4
  eikJSON,
@@ -12,19 +12,21 @@ const {
12
12
  } = require('./validate');
13
13
  const ValidationError = require('./validation-error');
14
14
 
15
- const assert = (validate, message) => value => {
16
- const valid = validate(value);
17
- if (valid.error) {
18
- const errorMessage = valid.error.map(err => {
15
+ const assert = (validate, message) => (value) => {
16
+ const valid = validate(value);
17
+ if (valid.error) {
18
+ const errorMessage = valid.error
19
+ .map((err) => {
19
20
  let msg = err.message;
20
21
  if (err.params && err.params.allowedValues) {
21
22
  msg += ` ("${err.params.allowedValues.join('", ')}")`;
22
23
  }
23
24
  return msg;
24
- }).join(',');
25
- throw new ValidationError(`${message}: ${errorMessage}`);
26
- }
27
- };
25
+ })
26
+ .join(',');
27
+ throw new ValidationError(`${message}: ${errorMessage}`, valid.error);
28
+ }
29
+ };
28
30
 
29
31
  module.exports = {
30
32
  eikJSON: assert(eikJSON, 'Invalid eik.json schema'),
@@ -27,11 +27,16 @@
27
27
  },
28
28
  "files": {
29
29
  "description": "File mapping definition for the package. Keys represent files or paths to be created on the Eik Server. Values represent paths to local files to be published.",
30
- "type": "object",
31
- "minProperties": 1,
32
- "additionalProperties": {
33
- "type": "string"
34
- }
30
+ "oneOf": [
31
+ {
32
+ "type": "object",
33
+ "minProperties": 1,
34
+ "additionalProperties": {
35
+ "type": "string"
36
+ }
37
+ },
38
+ { "type": "string", "minLength": 1 }
39
+ ]
35
40
  },
36
41
  "import-map": {
37
42
  "description": "Import map files given by URL(s) to be used during package bundling. Specified as a URL or array of URLs. URLs are locations of import map files that follow the W3C import map spec.",
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ // @ts-check
2
2
 
3
3
  const schema = require('./eikjson.schema.json');
4
4
  const validate = require('./validate');
@@ -1,5 +1,3 @@
1
- 'use strict';
2
-
3
1
  const formats = require('ajv-formats');
4
2
  const semver = require('semver');
5
3
  const npmPkg = require('validate-npm-package-name');
@@ -9,6 +7,7 @@ const eikJSONSchema = require('./eikjson.schema.json');
9
7
 
10
8
  const createValidator = (schema, ajvOptions) => {
11
9
  const ajv = new Ajv(ajvOptions);
10
+ // @ts-ignore
12
11
  formats(ajv); // Needed to support "uri"
13
12
  const validate = ajv.compile({
14
13
  $schema: 'http://json-schema.org/schema#',
@@ -1,6 +1,10 @@
1
- 'use strict';
1
+ // @ts-check
2
2
 
3
3
  class ValidationError extends Error {
4
+ /**
5
+ * @param {string} message
6
+ * @param {Error} err
7
+ */
4
8
  constructor(message, err) {
5
9
  let m = message;
6
10
  if (err && err.message) m += `: ${err.message}`;
@@ -9,4 +13,4 @@ class ValidationError extends Error {
9
13
  Error.captureStackTrace(this, this.constructor);
10
14
  }
11
15
  }
12
- module.exports = ValidationError;
16
+ module.exports = ValidationError;
package/lib/stream.js CHANGED
@@ -1,7 +1,14 @@
1
1
  'use strict';
2
2
 
3
- const isStream = (stream) => stream !== null && typeof stream === 'object' && typeof stream.pipe === 'function';
3
+ const isStream = (stream) =>
4
+ stream !== null &&
5
+ typeof stream === 'object' &&
6
+ typeof stream.pipe === 'function';
4
7
  module.exports.isStream = isStream;
5
8
 
6
- const isReadableStream = (stream) => isStream(stream) && stream.readable !== false && typeof stream._read === 'function' && typeof stream._readableState === 'object';
9
+ const isReadableStream = (stream) =>
10
+ isStream(stream) &&
11
+ stream.readable !== false &&
12
+ typeof stream._read === 'function' &&
13
+ typeof stream._readableState === 'object';
7
14
  module.exports.isReadableStream = isReadableStream;
@@ -3,7 +3,7 @@
3
3
  const semver = require('semver');
4
4
  const npmPkg = require('validate-npm-package-name');
5
5
 
6
- const origin = value => {
6
+ const origin = (value) => {
7
7
  if (new RegExp('^https?://[a-zA-Z0-9-_./]+(:[0-9]+)?').test(value)) {
8
8
  return value.toLowerCase();
9
9
  }
@@ -11,7 +11,7 @@ const origin = value => {
11
11
  };
12
12
  module.exports.origin = origin;
13
13
 
14
- const org = value => {
14
+ const org = (value) => {
15
15
  if (/^[a-zA-Z0-9_-]+$/.test(value)) {
16
16
  return value.toLowerCase();
17
17
  }
@@ -19,7 +19,7 @@ const org = value => {
19
19
  };
20
20
  module.exports.org = org;
21
21
 
22
- const name = value => {
22
+ const name = (value) => {
23
23
  const result = npmPkg(value);
24
24
  if (result.validForNewPackages || result.validForOldPackages) {
25
25
  return value.toLowerCase();
@@ -28,7 +28,7 @@ const name = value => {
28
28
  };
29
29
  module.exports.name = name;
30
30
 
31
- const version = value => {
31
+ const version = (value) => {
32
32
  const result = semver.valid(value);
33
33
  if (result) {
34
34
  return result;
@@ -37,7 +37,7 @@ const version = value => {
37
37
  };
38
38
  module.exports.version = version;
39
39
 
40
- const alias = value => {
40
+ const alias = (value) => {
41
41
  if (/^[0-9]+$/.test(value)) {
42
42
  return value;
43
43
  }
@@ -45,7 +45,7 @@ const alias = value => {
45
45
  };
46
46
  module.exports.alias = alias;
47
47
 
48
- const type = value => {
48
+ const type = (value) => {
49
49
  if (value === 'pkg' || value === 'map' || value === 'npm') {
50
50
  return value;
51
51
  }
@@ -54,10 +54,10 @@ const type = value => {
54
54
  module.exports.type = type;
55
55
 
56
56
  // TODO; https://github.com/asset-pipe/core/issues/12
57
- const extra = value => value;
57
+ const extra = (value) => value;
58
58
  module.exports.extra = extra;
59
59
 
60
- const semverType = value => {
60
+ const semverType = (value) => {
61
61
  if (value === 'major' || value === 'minor' || value === 'patch') {
62
62
  return value;
63
63
  }