@e-mc/document 0.13.0 → 0.13.2

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.13.0/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.13.2/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, ViewEngine } from "./squared";
@@ -185,14 +185,14 @@ NOTE: **@e-mc/document** is an abstract base class and cannot be instantiated. *
185
185
 
186
186
  ## References
187
187
 
188
- - https://www.unpkg.com/@e-mc/types@0.13.0/lib/squared.d.ts
189
- - https://www.unpkg.com/@e-mc/types@0.13.0/lib/asset.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.13.0/lib/core.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.13.0/lib/document.d.ts
192
- - https://www.unpkg.com/@e-mc/types@0.13.0/lib/filemanager.d.ts
193
- - https://www.unpkg.com/@e-mc/types@0.13.0/lib/logger.d.ts
194
- - https://www.unpkg.com/@e-mc/types@0.13.0/lib/settings.d.ts
195
- - https://www.unpkg.com/@e-mc/types@0.13.0/lib/watch.d.ts
188
+ - https://www.unpkg.com/@e-mc/types@0.13.2/lib/squared.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.13.2/lib/asset.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.13.2/lib/core.d.ts
191
+ - https://www.unpkg.com/@e-mc/types@0.13.2/lib/document.d.ts
192
+ - https://www.unpkg.com/@e-mc/types@0.13.2/lib/filemanager.d.ts
193
+ - https://www.unpkg.com/@e-mc/types@0.13.2/lib/logger.d.ts
194
+ - https://www.unpkg.com/@e-mc/types@0.13.2/lib/settings.d.ts
195
+ - https://www.unpkg.com/@e-mc/types@0.13.2/lib/watch.d.ts
196
196
 
197
197
  ## LICENSE
198
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "Document constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,9 +19,9 @@
19
19
  "license": "BSD-3-Clause",
20
20
  "homepage": "https://github.com/anpham6/e-mc#readme",
21
21
  "dependencies": {
22
- "@e-mc/core": "0.13.0",
23
- "@e-mc/db": "0.13.0",
24
- "@e-mc/types": "0.13.0",
22
+ "@e-mc/core": "0.13.2",
23
+ "@e-mc/db": "0.13.2",
24
+ "@e-mc/types": "0.13.2",
25
25
  "chalk": "4.1.2",
26
26
  "domhandler": "^5.0.3",
27
27
  "domutils": "^3.2.2",
@@ -14,9 +14,9 @@ function parseMap(data, value) {
14
14
  }
15
15
  function toJSON(data) {
16
16
  try {
17
- const output = JSON.parse(data);
18
- if (SourceMap.isRaw(output)) {
19
- return output;
17
+ const map = JSON.parse(data);
18
+ if (SourceMap.isRaw(map)) {
19
+ return map;
20
20
  }
21
21
  }
22
22
  catch {
@@ -343,15 +343,8 @@ class SourceMap {
343
343
  this.output.clear();
344
344
  }
345
345
  nextMap(name, code, map, sourceMappingURL = '', emptySources) {
346
- if (!SourceMap.isRaw(map)) {
347
- try {
348
- map = JSON.parse(Buffer.isBuffer(map) ? map.toString('utf8') : map.toString());
349
- }
350
- catch {
351
- }
352
- if (!SourceMap.isRaw(map)) {
353
- return false;
354
- }
346
+ if (!SourceMap.isRaw(map = this.parseMap(map))) {
347
+ return false;
355
348
  }
356
349
  if (typeof sourceMappingURL === 'boolean') {
357
350
  emptySources = sourceMappingURL;
@@ -372,6 +365,17 @@ class SourceMap {
372
365
  this.output.set(mapName, { code, map, sourceMappingURL });
373
366
  return true;
374
367
  }
368
+ parseMap(map) {
369
+ if (SourceMap.isRaw(map)) {
370
+ return map;
371
+ }
372
+ try {
373
+ return JSON.parse((0, types_1.isString)(map) || Buffer.isBuffer(map) ? map.toString('utf8') : map.toString());
374
+ }
375
+ catch {
376
+ return null;
377
+ }
378
+ }
375
379
  set map(value) {
376
380
  if (!value) {
377
381
  this.#map = undefined;