html-react-parser 6.1.3 → 6.1.5

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.
@@ -31,7 +31,7 @@
31
31
  var isInstance = false;
32
32
  try {
33
33
  isInstance = this instanceof a;
34
- } catch {}
34
+ } catch (e) {}
35
35
  if (isInstance) {
36
36
  return Reflect.construct(f, arguments, this.constructor);
37
37
  }
@@ -2048,18 +2048,16 @@
2048
2048
 
2049
2049
  var utilities = {};
2050
2050
 
2051
- var cjs$1 = {};
2052
-
2053
- var cjs;
2051
+ var cjs$1;
2054
2052
  var hasRequiredCjs$1;
2055
2053
 
2056
2054
  function requireCjs$1 () {
2057
- if (hasRequiredCjs$1) return cjs;
2055
+ if (hasRequiredCjs$1) return cjs$1;
2058
2056
  hasRequiredCjs$1 = 1;
2059
2057
 
2060
2058
  // http://www.w3.org/TR/CSS21/grammar.html
2061
2059
  // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
2062
- var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
2060
+ var COMMENT_REGEX = /\/\*(?:[^*]|\*(?!\/))*\*\//g;
2063
2061
 
2064
2062
  var NEWLINE_REGEX = /\n/g;
2065
2063
  var WHITESPACE_REGEX = /^\s*/;
@@ -2067,12 +2065,10 @@
2067
2065
  // declaration
2068
2066
  var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
2069
2067
  var COLON_REGEX = /^:\s*/;
2070
- var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
2068
+ var VALUE_REGEX =
2069
+ /^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/;
2071
2070
  var SEMICOLON_REGEX = /^[;\s]*/;
2072
2071
 
2073
- // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
2074
- var TRIM_REGEX = /^\s+|\s+$/g;
2075
-
2076
2072
  // strings
2077
2073
  var NEWLINE = '\n';
2078
2074
  var FORWARD_SLASH = '/';
@@ -2196,16 +2192,13 @@
2196
2192
  /**
2197
2193
  * Parse comments.
2198
2194
  *
2199
- * @param {Object[]} [rules]
2195
+ * @param {Object[]} rules
2200
2196
  * @return {Object[]}
2201
2197
  */
2202
2198
  function comments(rules) {
2203
2199
  var c;
2204
- rules = rules || [];
2205
2200
  while ((c = comment())) {
2206
- if (c !== false) {
2207
- rules.push(c);
2208
- }
2201
+ rules.push(c);
2209
2202
  }
2210
2203
  return rules;
2211
2204
  }
@@ -2267,9 +2260,9 @@
2267
2260
 
2268
2261
  var ret = pos({
2269
2262
  type: TYPE_DECLARATION,
2270
- property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
2263
+ property: prop[0].replace(COMMENT_REGEX, EMPTY_STRING).trim(),
2271
2264
  value: val
2272
- ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
2265
+ ? val[0].replace(COMMENT_REGEX, EMPTY_STRING).trim()
2273
2266
  : EMPTY_STRING
2274
2267
  });
2275
2268
 
@@ -2292,10 +2285,8 @@
2292
2285
  // declarations
2293
2286
  var decl;
2294
2287
  while ((decl = declaration())) {
2295
- if (decl !== false) {
2296
- decls.push(decl);
2297
- comments(decls);
2298
- }
2288
+ decls.push(decl);
2289
+ comments(decls);
2299
2290
  }
2300
2291
 
2301
2292
  return decls;
@@ -2305,70 +2296,77 @@
2305
2296
  return declarations();
2306
2297
  }
2307
2298
 
2308
- /**
2309
- * Trim `str`.
2310
- *
2311
- * @param {String} str
2312
- * @return {String}
2313
- */
2314
- function trim(str) {
2315
- return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
2316
- }
2317
-
2318
- cjs = index;
2299
+ cjs$1 = index;
2319
2300
 
2320
- return cjs;
2301
+ return cjs$1;
2321
2302
  }
2322
2303
 
2304
+ var cjs;
2323
2305
  var hasRequiredCjs;
2324
2306
 
2325
2307
  function requireCjs () {
2326
- if (hasRequiredCjs) return cjs$1;
2308
+ if (hasRequiredCjs) return cjs;
2327
2309
  hasRequiredCjs = 1;
2328
- var __importDefault = (cjs$1 && cjs$1.__importDefault) || function (mod) {
2329
- return (mod && mod.__esModule) ? mod : { "default": mod };
2310
+ //#region \0rolldown/runtime.js
2311
+ var __create = Object.create;
2312
+ var __defProp = Object.defineProperty;
2313
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2314
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2315
+ var __getProtoOf = Object.getPrototypeOf;
2316
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
2317
+ var __copyProps = (to, from, except, desc) => {
2318
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
2319
+ key = keys[i];
2320
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
2321
+ get: ((k) => from[k]).bind(null, key),
2322
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
2323
+ });
2324
+ }
2325
+ return to;
2330
2326
  };
2331
- Object.defineProperty(cjs$1, "__esModule", { value: true });
2332
- cjs$1.default = StyleToObject;
2333
- const inline_style_parser_1 = __importDefault(requireCjs$1());
2327
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(!mod || !mod.__esModule ? __defProp(target, "default", {
2328
+ value: mod,
2329
+ enumerable: true
2330
+ }) : target, mod));
2331
+ //#endregion
2332
+ let inline_style_parser = requireCjs$1();
2333
+ inline_style_parser = __toESM(inline_style_parser);
2334
+ //#region src/index.ts
2334
2335
  /**
2335
- * Parses inline style to object.
2336
- *
2337
- * @param style - Inline style.
2338
- * @param iterator - Iterator.
2339
- * @returns - Style object or null.
2340
- *
2341
- * @example Parsing inline style to object:
2342
- *
2343
- * ```js
2344
- * import parse from 'style-to-object';
2345
- * parse('line-height: 42;'); // { 'line-height': '42' }
2346
- * ```
2347
- */
2336
+ * Parses inline style to object.
2337
+ *
2338
+ * @param style - Inline style.
2339
+ * @param iterator - Iterator.
2340
+ * @returns - Style object or null.
2341
+ *
2342
+ * @example Parsing inline style to object:
2343
+ *
2344
+ * ```js
2345
+ * import parse from 'style-to-object';
2346
+ * parse('line-height: 42;'); // { 'line-height': '42' }
2347
+ * ```
2348
+ */
2348
2349
  function StyleToObject(style, iterator) {
2349
- let styleObject = null;
2350
- if (!style || typeof style !== 'string') {
2351
- return styleObject;
2352
- }
2353
- const declarations = (0, inline_style_parser_1.default)(style);
2354
- const hasIterator = typeof iterator === 'function';
2355
- declarations.forEach((declaration) => {
2356
- if (declaration.type !== 'declaration') {
2357
- return;
2358
- }
2359
- const { property, value } = declaration;
2360
- if (hasIterator) {
2361
- iterator(property, value, declaration);
2362
- }
2363
- else if (value) {
2364
- styleObject = styleObject || {};
2365
- styleObject[property] = value;
2366
- }
2367
- });
2368
- return styleObject;
2350
+ let styleObject = null;
2351
+ if (!style || typeof style !== "string") return styleObject;
2352
+ const declarations = (0, inline_style_parser.default)(style);
2353
+ const hasIterator = typeof iterator === "function";
2354
+ declarations.forEach((declaration) => {
2355
+ if (declaration.type !== "declaration") return;
2356
+ const { property, value } = declaration;
2357
+ if (hasIterator) iterator(property, value, declaration);
2358
+ else if (value) {
2359
+ styleObject = styleObject ?? {};
2360
+ styleObject[property] = value;
2361
+ }
2362
+ });
2363
+ return styleObject;
2369
2364
  }
2365
+ //#endregion
2366
+ cjs = StyleToObject;
2367
+
2370
2368
 
2371
- return cjs$1;
2369
+ return cjs;
2372
2370
  }
2373
2371
 
2374
2372
  var dist;
@@ -2444,6 +2442,8 @@
2444
2442
  }
2445
2443
  //#endregion
2446
2444
  dist = StyleToJS;
2445
+
2446
+
2447
2447
  return dist;
2448
2448
  }
2449
2449