neo-cmp-cli 1.8.6-beta.2 → 1.8.6-beta.3

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.
Files changed (154) hide show
  1. package/dist/_virtual/AddNeoRequirePlugin.js +8 -0
  2. package/dist/_virtual/OverloadYield.js +5 -0
  3. package/dist/_virtual/_commonjsHelpers.js +40 -0
  4. package/dist/_virtual/array-set.js +5 -0
  5. package/dist/_virtual/base64-vlq.js +5 -0
  6. package/dist/_virtual/base64.js +5 -0
  7. package/dist/_virtual/binary-search.js +5 -0
  8. package/dist/_virtual/createCmpByZip.js +8 -0
  9. package/dist/_virtual/deleteCmp.js +8 -0
  10. package/dist/_virtual/index.js +9 -0
  11. package/dist/_virtual/mapping-list.js +5 -0
  12. package/dist/_virtual/neoLogin.js +8 -0
  13. package/dist/_virtual/neoService.js +8 -0
  14. package/dist/_virtual/openProject.js +8 -0
  15. package/dist/_virtual/publish2oss.js +8 -0
  16. package/dist/_virtual/pullCmp.js +8 -0
  17. package/dist/_virtual/pushCmp.js +8 -0
  18. package/dist/_virtual/quick-sort.js +5 -0
  19. package/dist/_virtual/regenerator.js +5 -0
  20. package/dist/_virtual/regeneratorAsync.js +5 -0
  21. package/dist/_virtual/regeneratorAsyncGen.js +5 -0
  22. package/dist/_virtual/regeneratorAsyncIterator.js +5 -0
  23. package/dist/_virtual/regeneratorDefine.js +5 -0
  24. package/dist/_virtual/regeneratorKeys.js +5 -0
  25. package/dist/_virtual/regeneratorRuntime.js +5 -0
  26. package/dist/_virtual/regeneratorValues.js +5 -0
  27. package/dist/_virtual/source-map-consumer.js +5 -0
  28. package/dist/_virtual/source-map-generator.js +5 -0
  29. package/dist/_virtual/source-map-support.js +5 -0
  30. package/dist/_virtual/source-map.js +5 -0
  31. package/dist/_virtual/source-node.js +5 -0
  32. package/dist/_virtual/typeof.js +5 -0
  33. package/dist/_virtual/typescript.js +5 -0
  34. package/dist/_virtual/util.js +5 -0
  35. package/dist/config/auth.config.js +50 -0
  36. package/dist/config/default.config.js +225 -0
  37. package/dist/config/index.js +27 -0
  38. package/dist/main.js +9 -0
  39. package/dist/main2.js +261 -0
  40. package/dist/module/inspect.js +64 -0
  41. package/dist/module/neoInit.js +69 -0
  42. package/dist/module/neoInitByCopy.js +81 -0
  43. package/dist/neo/neoLogin.js +663 -0
  44. package/dist/neo/neoRequire.js +118 -0
  45. package/dist/neo/neoService.js +1246 -0
  46. package/dist/node_modules/@babel/runtime/helpers/OverloadYield.js +19 -0
  47. package/dist/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +29 -0
  48. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
  49. package/dist/node_modules/@babel/runtime/helpers/regenerator.js +105 -0
  50. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsync.js +24 -0
  51. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js +23 -0
  52. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js +50 -0
  53. package/dist/node_modules/@babel/runtime/helpers/regeneratorDefine.js +37 -0
  54. package/dist/node_modules/@babel/runtime/helpers/regeneratorKeys.js +25 -0
  55. package/dist/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +98 -0
  56. package/dist/node_modules/@babel/runtime/helpers/regeneratorValues.js +35 -0
  57. package/dist/node_modules/@babel/runtime/helpers/typeof.js +25 -0
  58. package/dist/node_modules/@babel/runtime/regenerator/index.js +29 -0
  59. package/dist/node_modules/buffer-from/index.js +57 -0
  60. package/dist/node_modules/source-map/lib/array-set.js +134 -0
  61. package/dist/node_modules/source-map/lib/base64-vlq.js +144 -0
  62. package/dist/node_modules/source-map/lib/base64.js +81 -0
  63. package/dist/node_modules/source-map/lib/binary-search.js +122 -0
  64. package/dist/node_modules/source-map/lib/mapping-list.js +94 -0
  65. package/dist/node_modules/source-map/lib/quick-sort.js +126 -0
  66. package/dist/node_modules/source-map/lib/source-map-consumer.js +1018 -0
  67. package/dist/node_modules/source-map/lib/source-map-generator.js +385 -0
  68. package/dist/node_modules/source-map/lib/source-node.js +400 -0
  69. package/dist/node_modules/source-map/lib/util.js +449 -0
  70. package/dist/node_modules/source-map/source-map.js +25 -0
  71. package/dist/node_modules/source-map-support/source-map-support.js +610 -0
  72. package/dist/node_modules/typescript/lib/typescript.js +22376 -0
  73. package/dist/oss/publish2oss.js +378 -0
  74. package/dist/plugins/AddNeoRequirePlugin.js +178 -0
  75. package/dist/utils/autoEntryRootDir.js +98 -0
  76. package/dist/utils/cmpUtils/createCmpByTemplate.js +73 -0
  77. package/dist/utils/cmpUtils/createCmpByZip.js +530 -0
  78. package/dist/utils/cmpUtils/createCommonModulesCode.js +84 -0
  79. package/dist/utils/cmpUtils/deleteCmp.js +98 -0
  80. package/dist/utils/cmpUtils/getCmpModelRegisterCode.js +38 -0
  81. package/dist/utils/cmpUtils/getCmpPreviewCode.js +37 -0
  82. package/dist/utils/cmpUtils/getCmpRegisterCode.js +38 -0
  83. package/dist/utils/cmpUtils/getCmpTypeByDir.js +58 -0
  84. package/dist/utils/cmpUtils/hasCmpTypeByDir.js +25 -0
  85. package/dist/utils/cmpUtils/previewCmp.js +74 -0
  86. package/dist/utils/cmpUtils/pullCmp.js +144 -0
  87. package/dist/utils/cmpUtils/pushCmp.js +290 -0
  88. package/dist/utils/common.js +121 -0
  89. package/dist/utils/configureNeoBuild.js +153 -0
  90. package/dist/utils/generateEntries.js +73 -0
  91. package/dist/utils/neoConfigInit.js +25 -0
  92. package/dist/utils/neoParams.js +23 -0
  93. package/dist/utils/pathUtils.js +48 -0
  94. package/dist/utils/projectNameValidator.js +89 -0
  95. package/dist/utils/projectUtils/createCmpProjectByTemplate.js +74 -0
  96. package/dist/utils/projectUtils/createCmpProjectZip.js +135 -0
  97. package/dist/utils/projectUtils/getEntries.js +99 -0
  98. package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +127 -0
  99. package/dist/utils/projectUtils/hasNeoProject.js +31 -0
  100. package/dist/utils/projectUtils/openProject.js +168 -0
  101. package/dist/utils/projectUtils/updatePublishLog.js +45 -0
  102. package/dist/utils/replaceInFilesByMap.js +70 -0
  103. package/dist/utils/replaceInPackage.js +151 -0
  104. package/dist/utils/resetPackageVersion.js +134 -0
  105. package/package.json +2 -2
  106. package/src/config/auth.config.js +0 -27
  107. package/src/config/default.config.js +0 -176
  108. package/src/config/index.js +0 -9
  109. package/src/initData/defaultTemplate.html +0 -13
  110. package/src/initData/neo.config.js +0 -138
  111. package/src/module/inspect.js +0 -41
  112. package/src/module/neoInit.js +0 -55
  113. package/src/module/neoInitByCopy.js +0 -61
  114. package/src/neo/NeoUMDContent.js +0 -30
  115. package/src/neo/neoLogin.js +0 -565
  116. package/src/neo/neoRequire.js +0 -125
  117. package/src/neo/neoService.js +0 -874
  118. package/src/neo/webpack.mf.js +0 -60
  119. package/src/neo/wrapperContent.js +0 -16
  120. package/src/oss/publish2oss.js +0 -348
  121. package/src/plugins/AddNeoRequirePlugin-v1.js +0 -47
  122. package/src/plugins/AddNeoRequirePlugin.js +0 -179
  123. package/src/plugins/README.md +0 -109
  124. package/src/utils/autoEntryRootDir.js +0 -85
  125. package/src/utils/cmpUtils/createCmpByTemplate.js +0 -60
  126. package/src/utils/cmpUtils/createCmpByZip.js +0 -408
  127. package/src/utils/cmpUtils/createCommonModulesCode.js +0 -121
  128. package/src/utils/cmpUtils/deleteCmp.js +0 -63
  129. package/src/utils/cmpUtils/getCmpModelRegisterCode.js +0 -31
  130. package/src/utils/cmpUtils/getCmpPreviewCode.js +0 -43
  131. package/src/utils/cmpUtils/getCmpRegisterCode.js +0 -31
  132. package/src/utils/cmpUtils/getCmpTypeByDir.js +0 -41
  133. package/src/utils/cmpUtils/hasCmpTypeByDir.js +0 -11
  134. package/src/utils/cmpUtils/previewCmp.js +0 -55
  135. package/src/utils/cmpUtils/pullCmp.js +0 -104
  136. package/src/utils/cmpUtils/pushCmp.js +0 -230
  137. package/src/utils/common.js +0 -107
  138. package/src/utils/configureNeoBuild.js +0 -109
  139. package/src/utils/generateEntries.js +0 -63
  140. package/src/utils/neoConfigInit.js +0 -13
  141. package/src/utils/neoParams.js +0 -12
  142. package/src/utils/pathUtils.js +0 -23
  143. package/src/utils/projectNameValidator.js +0 -76
  144. package/src/utils/projectUtils/createCmpProjectByTemplate.js +0 -59
  145. package/src/utils/projectUtils/createCmpProjectZip.js +0 -120
  146. package/src/utils/projectUtils/getEntries.js +0 -80
  147. package/src/utils/projectUtils/getEntriesWithAutoRegister.js +0 -108
  148. package/src/utils/projectUtils/hasNeoProject.js +0 -17
  149. package/src/utils/projectUtils/openProject.js +0 -94
  150. package/src/utils/projectUtils/updatePublishLog.js +0 -30
  151. package/src/utils/replaceInFiles.js +0 -47
  152. package/src/utils/replaceInFilesByMap.js +0 -54
  153. package/src/utils/replaceInPackage.js +0 -134
  154. package/src/utils/resetPackageVersion.js +0 -115
@@ -0,0 +1,385 @@
1
+ 'use strict';
2
+
3
+ var sourceMapGenerator = require('../../../_virtual/source-map-generator.js');
4
+ var base64Vlq = require('./base64-vlq.js');
5
+ var util = require('./util.js');
6
+ var arraySet = require('./array-set.js');
7
+ var mappingList = require('./mapping-list.js');
8
+
9
+ /* -*- Mode: js; js-indent-level: 2; -*- */
10
+
11
+ var hasRequiredSourceMapGenerator;
12
+
13
+ function requireSourceMapGenerator () {
14
+ if (hasRequiredSourceMapGenerator) return sourceMapGenerator.__exports;
15
+ hasRequiredSourceMapGenerator = 1;
16
+ /*
17
+ * Copyright 2011 Mozilla Foundation and contributors
18
+ * Licensed under the New BSD license. See LICENSE or:
19
+ * http://opensource.org/licenses/BSD-3-Clause
20
+ */
21
+
22
+ var base64VLQ = base64Vlq.__require();
23
+ var util$1 = util.__require();
24
+ var ArraySet = arraySet.__require().ArraySet;
25
+ var MappingList = mappingList.__require().MappingList;
26
+
27
+ /**
28
+ * An instance of the SourceMapGenerator represents a source map which is
29
+ * being built incrementally. You may pass an object with the following
30
+ * properties:
31
+ *
32
+ * - file: The filename of the generated source.
33
+ * - sourceRoot: A root for all relative URLs in this source map.
34
+ */
35
+ function SourceMapGenerator(aArgs) {
36
+ if (!aArgs) {
37
+ aArgs = {};
38
+ }
39
+ this._file = util$1.getArg(aArgs, 'file', null);
40
+ this._sourceRoot = util$1.getArg(aArgs, 'sourceRoot', null);
41
+ this._skipValidation = util$1.getArg(aArgs, 'skipValidation', false);
42
+ this._sources = new ArraySet();
43
+ this._names = new ArraySet();
44
+ this._mappings = new MappingList();
45
+ this._sourcesContents = null;
46
+ }
47
+ SourceMapGenerator.prototype._version = 3;
48
+
49
+ /**
50
+ * Creates a new SourceMapGenerator based on a SourceMapConsumer
51
+ *
52
+ * @param aSourceMapConsumer The SourceMap.
53
+ */
54
+ SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
55
+ var sourceRoot = aSourceMapConsumer.sourceRoot;
56
+ var generator = new SourceMapGenerator({
57
+ file: aSourceMapConsumer.file,
58
+ sourceRoot: sourceRoot
59
+ });
60
+ aSourceMapConsumer.eachMapping(function (mapping) {
61
+ var newMapping = {
62
+ generated: {
63
+ line: mapping.generatedLine,
64
+ column: mapping.generatedColumn
65
+ }
66
+ };
67
+ if (mapping.source != null) {
68
+ newMapping.source = mapping.source;
69
+ if (sourceRoot != null) {
70
+ newMapping.source = util$1.relative(sourceRoot, newMapping.source);
71
+ }
72
+ newMapping.original = {
73
+ line: mapping.originalLine,
74
+ column: mapping.originalColumn
75
+ };
76
+ if (mapping.name != null) {
77
+ newMapping.name = mapping.name;
78
+ }
79
+ }
80
+ generator.addMapping(newMapping);
81
+ });
82
+ aSourceMapConsumer.sources.forEach(function (sourceFile) {
83
+ var sourceRelative = sourceFile;
84
+ if (sourceRoot !== null) {
85
+ sourceRelative = util$1.relative(sourceRoot, sourceFile);
86
+ }
87
+ if (!generator._sources.has(sourceRelative)) {
88
+ generator._sources.add(sourceRelative);
89
+ }
90
+ var content = aSourceMapConsumer.sourceContentFor(sourceFile);
91
+ if (content != null) {
92
+ generator.setSourceContent(sourceFile, content);
93
+ }
94
+ });
95
+ return generator;
96
+ };
97
+
98
+ /**
99
+ * Add a single mapping from original source line and column to the generated
100
+ * source's line and column for this source map being created. The mapping
101
+ * object should have the following properties:
102
+ *
103
+ * - generated: An object with the generated line and column positions.
104
+ * - original: An object with the original line and column positions.
105
+ * - source: The original source file (relative to the sourceRoot).
106
+ * - name: An optional original token name for this mapping.
107
+ */
108
+ SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
109
+ var generated = util$1.getArg(aArgs, 'generated');
110
+ var original = util$1.getArg(aArgs, 'original', null);
111
+ var source = util$1.getArg(aArgs, 'source', null);
112
+ var name = util$1.getArg(aArgs, 'name', null);
113
+ if (!this._skipValidation) {
114
+ this._validateMapping(generated, original, source, name);
115
+ }
116
+ if (source != null) {
117
+ source = String(source);
118
+ if (!this._sources.has(source)) {
119
+ this._sources.add(source);
120
+ }
121
+ }
122
+ if (name != null) {
123
+ name = String(name);
124
+ if (!this._names.has(name)) {
125
+ this._names.add(name);
126
+ }
127
+ }
128
+ this._mappings.add({
129
+ generatedLine: generated.line,
130
+ generatedColumn: generated.column,
131
+ originalLine: original != null && original.line,
132
+ originalColumn: original != null && original.column,
133
+ source: source,
134
+ name: name
135
+ });
136
+ };
137
+
138
+ /**
139
+ * Set the source content for a source file.
140
+ */
141
+ SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
142
+ var source = aSourceFile;
143
+ if (this._sourceRoot != null) {
144
+ source = util$1.relative(this._sourceRoot, source);
145
+ }
146
+ if (aSourceContent != null) {
147
+ // Add the source content to the _sourcesContents map.
148
+ // Create a new _sourcesContents map if the property is null.
149
+ if (!this._sourcesContents) {
150
+ this._sourcesContents = Object.create(null);
151
+ }
152
+ this._sourcesContents[util$1.toSetString(source)] = aSourceContent;
153
+ } else if (this._sourcesContents) {
154
+ // Remove the source file from the _sourcesContents map.
155
+ // If the _sourcesContents map is empty, set the property to null.
156
+ delete this._sourcesContents[util$1.toSetString(source)];
157
+ if (Object.keys(this._sourcesContents).length === 0) {
158
+ this._sourcesContents = null;
159
+ }
160
+ }
161
+ };
162
+
163
+ /**
164
+ * Applies the mappings of a sub-source-map for a specific source file to the
165
+ * source map being generated. Each mapping to the supplied source file is
166
+ * rewritten using the supplied source map. Note: The resolution for the
167
+ * resulting mappings is the minimium of this map and the supplied map.
168
+ *
169
+ * @param aSourceMapConsumer The source map to be applied.
170
+ * @param aSourceFile Optional. The filename of the source file.
171
+ * If omitted, SourceMapConsumer's file property will be used.
172
+ * @param aSourceMapPath Optional. The dirname of the path to the source map
173
+ * to be applied. If relative, it is relative to the SourceMapConsumer.
174
+ * This parameter is needed when the two source maps aren't in the same
175
+ * directory, and the source map to be applied contains relative source
176
+ * paths. If so, those relative source paths need to be rewritten
177
+ * relative to the SourceMapGenerator.
178
+ */
179
+ SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
180
+ var sourceFile = aSourceFile;
181
+ // If aSourceFile is omitted, we will use the file property of the SourceMap
182
+ if (aSourceFile == null) {
183
+ if (aSourceMapConsumer.file == null) {
184
+ throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.');
185
+ }
186
+ sourceFile = aSourceMapConsumer.file;
187
+ }
188
+ var sourceRoot = this._sourceRoot;
189
+ // Make "sourceFile" relative if an absolute Url is passed.
190
+ if (sourceRoot != null) {
191
+ sourceFile = util$1.relative(sourceRoot, sourceFile);
192
+ }
193
+ // Applying the SourceMap can add and remove items from the sources and
194
+ // the names array.
195
+ var newSources = new ArraySet();
196
+ var newNames = new ArraySet();
197
+
198
+ // Find mappings for the "sourceFile"
199
+ this._mappings.unsortedForEach(function (mapping) {
200
+ if (mapping.source === sourceFile && mapping.originalLine != null) {
201
+ // Check if it can be mapped by the source map, then update the mapping.
202
+ var original = aSourceMapConsumer.originalPositionFor({
203
+ line: mapping.originalLine,
204
+ column: mapping.originalColumn
205
+ });
206
+ if (original.source != null) {
207
+ // Copy mapping
208
+ mapping.source = original.source;
209
+ if (aSourceMapPath != null) {
210
+ mapping.source = util$1.join(aSourceMapPath, mapping.source);
211
+ }
212
+ if (sourceRoot != null) {
213
+ mapping.source = util$1.relative(sourceRoot, mapping.source);
214
+ }
215
+ mapping.originalLine = original.line;
216
+ mapping.originalColumn = original.column;
217
+ if (original.name != null) {
218
+ mapping.name = original.name;
219
+ }
220
+ }
221
+ }
222
+ var source = mapping.source;
223
+ if (source != null && !newSources.has(source)) {
224
+ newSources.add(source);
225
+ }
226
+ var name = mapping.name;
227
+ if (name != null && !newNames.has(name)) {
228
+ newNames.add(name);
229
+ }
230
+ }, this);
231
+ this._sources = newSources;
232
+ this._names = newNames;
233
+
234
+ // Copy sourcesContents of applied map.
235
+ aSourceMapConsumer.sources.forEach(function (sourceFile) {
236
+ var content = aSourceMapConsumer.sourceContentFor(sourceFile);
237
+ if (content != null) {
238
+ if (aSourceMapPath != null) {
239
+ sourceFile = util$1.join(aSourceMapPath, sourceFile);
240
+ }
241
+ if (sourceRoot != null) {
242
+ sourceFile = util$1.relative(sourceRoot, sourceFile);
243
+ }
244
+ this.setSourceContent(sourceFile, content);
245
+ }
246
+ }, this);
247
+ };
248
+
249
+ /**
250
+ * A mapping can have one of the three levels of data:
251
+ *
252
+ * 1. Just the generated position.
253
+ * 2. The Generated position, original position, and original source.
254
+ * 3. Generated and original position, original source, as well as a name
255
+ * token.
256
+ *
257
+ * To maintain consistency, we validate that any new mapping being added falls
258
+ * in to one of these categories.
259
+ */
260
+ SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
261
+ // When aOriginal is truthy but has empty values for .line and .column,
262
+ // it is most likely a programmer error. In this case we throw a very
263
+ // specific error message to try to guide them the right way.
264
+ // For example: https://github.com/Polymer/polymer-bundler/pull/519
265
+ if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
266
+ throw new Error('original.line and original.column are not numbers -- you probably meant to omit ' + 'the original mapping entirely and only map the generated position. If so, pass ' + 'null for the original mapping instead of an object with empty or null values.');
267
+ }
268
+ if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
269
+ // Case 1.
270
+ return;
271
+ } else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
272
+ // Cases 2 and 3.
273
+ return;
274
+ } else {
275
+ throw new Error('Invalid mapping: ' + JSON.stringify({
276
+ generated: aGenerated,
277
+ source: aSource,
278
+ original: aOriginal,
279
+ name: aName
280
+ }));
281
+ }
282
+ };
283
+
284
+ /**
285
+ * Serialize the accumulated mappings in to the stream of base 64 VLQs
286
+ * specified by the source map format.
287
+ */
288
+ SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
289
+ var previousGeneratedColumn = 0;
290
+ var previousGeneratedLine = 1;
291
+ var previousOriginalColumn = 0;
292
+ var previousOriginalLine = 0;
293
+ var previousName = 0;
294
+ var previousSource = 0;
295
+ var result = '';
296
+ var next;
297
+ var mapping;
298
+ var nameIdx;
299
+ var sourceIdx;
300
+ var mappings = this._mappings.toArray();
301
+ for (var i = 0, len = mappings.length; i < len; i++) {
302
+ mapping = mappings[i];
303
+ next = '';
304
+ if (mapping.generatedLine !== previousGeneratedLine) {
305
+ previousGeneratedColumn = 0;
306
+ while (mapping.generatedLine !== previousGeneratedLine) {
307
+ next += ';';
308
+ previousGeneratedLine++;
309
+ }
310
+ } else {
311
+ if (i > 0) {
312
+ if (!util$1.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
313
+ continue;
314
+ }
315
+ next += ',';
316
+ }
317
+ }
318
+ next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
319
+ previousGeneratedColumn = mapping.generatedColumn;
320
+ if (mapping.source != null) {
321
+ sourceIdx = this._sources.indexOf(mapping.source);
322
+ next += base64VLQ.encode(sourceIdx - previousSource);
323
+ previousSource = sourceIdx;
324
+
325
+ // lines are stored 0-based in SourceMap spec version 3
326
+ next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
327
+ previousOriginalLine = mapping.originalLine - 1;
328
+ next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
329
+ previousOriginalColumn = mapping.originalColumn;
330
+ if (mapping.name != null) {
331
+ nameIdx = this._names.indexOf(mapping.name);
332
+ next += base64VLQ.encode(nameIdx - previousName);
333
+ previousName = nameIdx;
334
+ }
335
+ }
336
+ result += next;
337
+ }
338
+ return result;
339
+ };
340
+ SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
341
+ return aSources.map(function (source) {
342
+ if (!this._sourcesContents) {
343
+ return null;
344
+ }
345
+ if (aSourceRoot != null) {
346
+ source = util$1.relative(aSourceRoot, source);
347
+ }
348
+ var key = util$1.toSetString(source);
349
+ return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
350
+ }, this);
351
+ };
352
+
353
+ /**
354
+ * Externalize the source map.
355
+ */
356
+ SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
357
+ var map = {
358
+ version: this._version,
359
+ sources: this._sources.toArray(),
360
+ names: this._names.toArray(),
361
+ mappings: this._serializeMappings()
362
+ };
363
+ if (this._file != null) {
364
+ map.file = this._file;
365
+ }
366
+ if (this._sourceRoot != null) {
367
+ map.sourceRoot = this._sourceRoot;
368
+ }
369
+ if (this._sourcesContents) {
370
+ map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
371
+ }
372
+ return map;
373
+ };
374
+
375
+ /**
376
+ * Render the source map being generated to a string.
377
+ */
378
+ SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
379
+ return JSON.stringify(this.toJSON());
380
+ };
381
+ sourceMapGenerator.__exports.SourceMapGenerator = SourceMapGenerator;
382
+ return sourceMapGenerator.__exports;
383
+ }
384
+
385
+ exports.__require = requireSourceMapGenerator;