@intlify/bundle-utils 7.0.0 → 7.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.
- package/lib/index.cjs +8 -8
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +1 -1
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const jsoncEslintParser = require('jsonc-eslint-parser');
|
|
4
4
|
const shared = require('@intlify/shared');
|
|
5
5
|
const module$1 = require('node:module');
|
|
6
|
-
const
|
|
6
|
+
const sourceMapJs = require('source-map-js');
|
|
7
7
|
const MagicString = require('magic-string');
|
|
8
8
|
const yamlEslintParser = require('yaml-eslint-parser');
|
|
9
9
|
const acorn = require('acorn');
|
|
@@ -22,7 +22,7 @@ function createCodeGenerator(options = {
|
|
|
22
22
|
env: "development",
|
|
23
23
|
forceStringify: false
|
|
24
24
|
}) {
|
|
25
|
-
const { sourceMap
|
|
25
|
+
const { sourceMap, source, filename } = options;
|
|
26
26
|
const _context = Object.assign(
|
|
27
27
|
{
|
|
28
28
|
code: "",
|
|
@@ -76,8 +76,8 @@ function createCodeGenerator(options = {
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
if (sourceMap
|
|
80
|
-
_context.map = new
|
|
79
|
+
if (sourceMap && source) {
|
|
80
|
+
_context.map = new sourceMapJs.SourceMapGenerator();
|
|
81
81
|
_context.map.setSourceContent(filename, source);
|
|
82
82
|
}
|
|
83
83
|
return {
|
|
@@ -153,9 +153,9 @@ function mapLinesColumns(resMap, codeMaps, inSourceMap) {
|
|
|
153
153
|
if (!resMap) {
|
|
154
154
|
return null;
|
|
155
155
|
}
|
|
156
|
-
const resMapConsumer = new
|
|
157
|
-
const inMapConsumer = inSourceMap ? new
|
|
158
|
-
const mergedMapGenerator = new
|
|
156
|
+
const resMapConsumer = new sourceMapJs.SourceMapConsumer(resMap);
|
|
157
|
+
const inMapConsumer = inSourceMap ? new sourceMapJs.SourceMapConsumer(inSourceMap) : null;
|
|
158
|
+
const mergedMapGenerator = new sourceMapJs.SourceMapGenerator();
|
|
159
159
|
let inMapFirstItem = null;
|
|
160
160
|
if (inMapConsumer) {
|
|
161
161
|
inMapConsumer.eachMapping((m) => {
|
|
@@ -184,7 +184,7 @@ function mapLinesColumns(resMap, codeMaps, inSourceMap) {
|
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
const mapConsumer = new
|
|
187
|
+
const mapConsumer = new sourceMapJs.SourceMapConsumer(map);
|
|
188
188
|
mapConsumer.eachMapping((m) => {
|
|
189
189
|
mergedMapGenerator.addMapping({
|
|
190
190
|
original: {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONProgram } from 'jsonc-eslint-parser/lib/parser/ast';
|
|
2
|
-
import { RawSourceMap } from 'source-map';
|
|
2
|
+
import { RawSourceMap } from 'source-map-js';
|
|
3
3
|
import { CompileError } from '@intlify/message-compiler';
|
|
4
4
|
import { YAMLProgram } from 'yaml-eslint-parser/lib/ast';
|
|
5
5
|
import { Node } from 'estree';
|
package/lib/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseJSON, traverseNodes, getStaticJSONValue } from 'jsonc-eslint-parser';
|
|
2
2
|
import { isBoolean, format, escapeHtml, friendlyJSONstringify, isString, isNumber } from '@intlify/shared';
|
|
3
3
|
import module from 'node:module';
|
|
4
|
-
import { SourceMapGenerator, SourceMapConsumer } from 'source-map';
|
|
4
|
+
import { SourceMapGenerator, SourceMapConsumer } from 'source-map-js';
|
|
5
5
|
import MagicString from 'magic-string';
|
|
6
6
|
import { parseYAML, traverseNodes as traverseNodes$1, getStaticYAMLValue } from 'yaml-eslint-parser';
|
|
7
7
|
import { parse } from 'acorn';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/bundle-utils",
|
|
3
3
|
"description": "Bundle utilities for Intlify project",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"jsonc-eslint-parser": "^1.0.1",
|
|
27
27
|
"magic-string": "^0.30.0",
|
|
28
28
|
"mlly": "^1.2.0",
|
|
29
|
-
"source-map": "0.
|
|
29
|
+
"source-map-js": "^1.0.1",
|
|
30
30
|
"yaml-eslint-parser": "^0.3.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|