html-validate 8.7.3 → 8.7.4

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/cjs/core.js CHANGED
@@ -10208,7 +10208,7 @@ class Config {
10208
10208
  * Create a new blank configuration. See also `Config.defaultConfig()`.
10209
10209
  */
10210
10210
  static empty() {
10211
- return new Config([], {
10211
+ return Config.create([], {
10212
10212
  extends: [],
10213
10213
  rules: {},
10214
10214
  plugins: [],
@@ -10220,7 +10220,7 @@ class Config {
10220
10220
  */
10221
10221
  static fromObject(resolvers, options, filename = null) {
10222
10222
  Config.validate(options, filename);
10223
- return new Config(resolvers, options);
10223
+ return Config.create(resolvers, options);
10224
10224
  }
10225
10225
  /**
10226
10226
  * Read configuration from filename.
@@ -10263,13 +10263,35 @@ class Config {
10263
10263
  * Load a default configuration object.
10264
10264
  */
10265
10265
  static defaultConfig() {
10266
- return new Config([], defaultConfig);
10266
+ return Config.create([], defaultConfig);
10267
10267
  }
10268
10268
  /**
10269
10269
  * @internal
10270
10270
  */
10271
- constructor(resolvers, options) {
10271
+ static create(resolvers, options) {
10272
10272
  var _a, _b;
10273
+ const instance = new Config(resolvers, options);
10274
+ /* load plugins */
10275
+ instance.plugins = instance.loadPlugins((_a = instance.config.plugins) !== null && _a !== void 0 ? _a : []);
10276
+ instance.configurations = instance.loadConfigurations(instance.plugins);
10277
+ instance.extendMeta(instance.plugins);
10278
+ /* process extended configs */
10279
+ instance.config = instance.extendConfig((_b = instance.config.extends) !== null && _b !== void 0 ? _b : []);
10280
+ /* reset extends as we already processed them, this prevents the next config
10281
+ * from reapplying config from extended config as well as duplicate entries
10282
+ * when merging arrays */
10283
+ instance.config.extends = [];
10284
+ /* rules explicitly set by passed options should have precedence over any
10285
+ * extended rules, not the other way around. */
10286
+ if (options.rules) {
10287
+ instance.config = mergeInternal(instance.config, { rules: options.rules });
10288
+ }
10289
+ return instance;
10290
+ }
10291
+ /**
10292
+ * @internal
10293
+ */
10294
+ constructor(resolvers, options) {
10273
10295
  this.transformers = [];
10274
10296
  const initial = {
10275
10297
  extends: [],
@@ -10278,24 +10300,11 @@ class Config {
10278
10300
  transform: {},
10279
10301
  };
10280
10302
  this.config = mergeInternal(initial, options);
10281
- this.metaTable = null;
10303
+ this.configurations = new Map();
10282
10304
  this.initialized = false;
10283
10305
  this.resolvers = toArray(resolvers);
10284
- /* load plugins */
10285
- this.plugins = this.loadPlugins((_a = this.config.plugins) !== null && _a !== void 0 ? _a : []);
10286
- this.configurations = this.loadConfigurations(this.plugins);
10287
- this.extendMeta(this.plugins);
10288
- /* process extended configs */
10289
- this.config = this.extendConfig((_b = this.config.extends) !== null && _b !== void 0 ? _b : []);
10290
- /* reset extends as we already processed them, this prevents the next config
10291
- * from reapplying config from extended config as well as duplicate entries
10292
- * when merging arrays */
10293
- this.config.extends = [];
10294
- /* rules explicitly set by passed options should have precedence over any
10295
- * extended rules, not the other way around. */
10296
- if (options.rules) {
10297
- this.config = mergeInternal(this.config, { rules: options.rules });
10298
- }
10306
+ this.metaTable = null;
10307
+ this.plugins = [];
10299
10308
  }
10300
10309
  /**
10301
10310
  * Initialize plugins, transforms etc.
@@ -10328,7 +10337,7 @@ class Config {
10328
10337
  * @param rhs - Configuration to merge with this one.
10329
10338
  */
10330
10339
  merge(resolvers, rhs) {
10331
- return new Config(resolvers, mergeInternal(this.config, rhs.config));
10340
+ return Config.create(resolvers, mergeInternal(this.config, rhs.config));
10332
10341
  }
10333
10342
  extendConfig(entries) {
10334
10343
  if (entries.length === 0) {
@@ -12324,7 +12333,7 @@ class HtmlValidate {
12324
12333
  /** @public */
12325
12334
  const name = "html-validate";
12326
12335
  /** @public */
12327
- const version = "8.7.3";
12336
+ const version = "8.7.4";
12328
12337
  /** @public */
12329
12338
  const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
12330
12339