@ember-intl/utils 0.3.0 → 0.5.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.
@@ -0,0 +1,2 @@
1
+ import type { UserConfig } from './types.js';
2
+ export declare function defineConfig(config: UserConfig): UserConfig;
@@ -0,0 +1,3 @@
1
+ export function defineConfig(config) {
2
+ return config;
3
+ }
@@ -7,7 +7,7 @@ export function findUserConfig(projectRoot) {
7
7
  return undefined;
8
8
  }
9
9
  if (filePaths.length > 1) {
10
- throw new Error('Found multiple config files');
10
+ throw new Error('found multiple config files');
11
11
  }
12
12
  return filePaths[0];
13
13
  }
@@ -5,21 +5,21 @@ import { findUserConfig } from './find-user-config.js';
5
5
  import { getDefaultConfig } from './get-default-config.js';
6
6
  function validate(userConfig) {
7
7
  if (userConfig === undefined) {
8
- return;
8
+ throw new Error('missing default export');
9
9
  }
10
10
  const defaultConfig = getDefaultConfig();
11
11
  if (userConfig.buildOptions) {
12
12
  const buildOptions = new Set(Object.keys(defaultConfig.buildOptions));
13
13
  Object.keys(userConfig.buildOptions).forEach((buildOption) => {
14
14
  if (!buildOptions.has(buildOption)) {
15
- throw new Error(`Unknown build option: ${buildOption}`);
15
+ throw new Error(`unknown build option: ${buildOption}`);
16
16
  }
17
17
  });
18
18
  }
19
19
  if (userConfig.lintRules) {
20
20
  Object.keys(userConfig.lintRules).forEach((lintRule) => {
21
21
  if (!lintRules.includes(lintRule)) {
22
- throw new Error(`Unknown lint rule: ${lintRule}`);
22
+ throw new Error(`unknown lint rule: ${lintRule}`);
23
23
  }
24
24
  });
25
25
  }
@@ -38,7 +38,7 @@ export async function getUserConfig(projectRoot) {
38
38
  return userConfig;
39
39
  }
40
40
  catch (error) {
41
- throw new Error(`ERROR: Unable to read the config file. (${error.message})`, {
41
+ throw new Error(`Unable to get ember-intl config (${error.message})`, {
42
42
  cause: error,
43
43
  });
44
44
  }
package/dist/config.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { defineConfig } from './config/define-config.js';
1
2
  export { findUserConfig } from './config/find-user-config.js';
2
3
  export { getDefaultConfig } from './config/get-default-config.js';
3
4
  export { getUserConfig } from './config/get-user-config.js';
package/dist/config.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { defineConfig } from './config/define-config.js';
1
2
  export { findUserConfig } from './config/find-user-config.js';
2
3
  export { getDefaultConfig } from './config/get-default-config.js';
3
4
  export { getUserConfig } from './config/get-user-config.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-intl/utils",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Utilities for ember-intl packages",
5
5
  "keywords": [
6
6
  "ember-intl"