neo-cmp-cli 1.8.6-beta.6 → 1.8.7

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 (158) hide show
  1. package/bin/index.js +2 -2
  2. package/package.json +3 -3
  3. package/src/config/auth.config.js +27 -0
  4. package/src/config/default.config.js +176 -0
  5. package/src/config/index.js +9 -0
  6. package/src/initData/defaultTemplate.html +13 -0
  7. package/src/initData/neo.config.js +138 -0
  8. package/src/main.js +221 -0
  9. package/src/module/inspect.js +41 -0
  10. package/src/module/neoInit.js +55 -0
  11. package/src/module/neoInitByCopy.js +61 -0
  12. package/src/neo/NeoUMDContent.js +30 -0
  13. package/src/neo/neoLogin.js +565 -0
  14. package/src/neo/neoRequire.js +125 -0
  15. package/src/neo/neoService.js +874 -0
  16. package/src/neo/webpack.mf.js +60 -0
  17. package/src/neo/wrapperContent.js +16 -0
  18. package/src/oss/publish2oss.js +348 -0
  19. package/src/plugins/AddNeoRequirePlugin-v1.js +47 -0
  20. package/src/plugins/AddNeoRequirePlugin.js +179 -0
  21. package/src/plugins/README.md +109 -0
  22. package/src/utils/autoEntryRootDir.js +85 -0
  23. package/src/utils/cmpUtils/createCmpByTemplate.js +60 -0
  24. package/src/utils/cmpUtils/createCmpByZip.js +408 -0
  25. package/src/utils/cmpUtils/createCommonModulesCode.js +121 -0
  26. package/src/utils/cmpUtils/deleteCmp.js +63 -0
  27. package/src/utils/cmpUtils/getCmpModelRegisterCode.js +31 -0
  28. package/src/utils/cmpUtils/getCmpPreviewCode.js +43 -0
  29. package/src/utils/cmpUtils/getCmpRegisterCode.js +31 -0
  30. package/src/utils/cmpUtils/getCmpTypeByDir.js +41 -0
  31. package/src/utils/cmpUtils/hasCmpTypeByDir.js +11 -0
  32. package/src/utils/cmpUtils/previewCmp.js +55 -0
  33. package/src/utils/cmpUtils/pullCmp.js +104 -0
  34. package/src/utils/cmpUtils/pushCmp.js +230 -0
  35. package/src/utils/common.js +107 -0
  36. package/src/utils/configureNeoBuild.js +109 -0
  37. package/src/utils/generateEntries.js +63 -0
  38. package/src/utils/neoConfigInit.js +13 -0
  39. package/src/utils/neoParams.js +12 -0
  40. package/src/utils/pathUtils.js +23 -0
  41. package/src/utils/projectNameValidator.js +76 -0
  42. package/src/utils/projectUtils/createCmpProjectByTemplate.js +59 -0
  43. package/src/utils/projectUtils/createCmpProjectZip.js +120 -0
  44. package/src/utils/projectUtils/getEntries.js +80 -0
  45. package/src/utils/projectUtils/getEntriesWithAutoRegister.js +108 -0
  46. package/src/utils/projectUtils/hasNeoProject.js +17 -0
  47. package/src/utils/projectUtils/openProject.js +96 -0
  48. package/src/utils/projectUtils/updatePublishLog.js +30 -0
  49. package/src/utils/replaceInFiles.js +47 -0
  50. package/src/utils/replaceInFilesByMap.js +54 -0
  51. package/src/utils/replaceInPackage.js +134 -0
  52. package/src/utils/resetPackageVersion.js +115 -0
  53. package/test/deprecate-versions.js +1 -1
  54. package/test/neo.config.js +1 -25
  55. package/dist/_virtual/AddNeoRequirePlugin.js +0 -8
  56. package/dist/_virtual/OverloadYield.js +0 -5
  57. package/dist/_virtual/_commonjsHelpers.js +0 -40
  58. package/dist/_virtual/array-set.js +0 -5
  59. package/dist/_virtual/base64-vlq.js +0 -5
  60. package/dist/_virtual/base64.js +0 -5
  61. package/dist/_virtual/binary-search.js +0 -5
  62. package/dist/_virtual/createCmpByZip.js +0 -8
  63. package/dist/_virtual/deleteCmp.js +0 -8
  64. package/dist/_virtual/index.js +0 -9
  65. package/dist/_virtual/mapping-list.js +0 -5
  66. package/dist/_virtual/neoLogin.js +0 -8
  67. package/dist/_virtual/neoService.js +0 -8
  68. package/dist/_virtual/openProject.js +0 -8
  69. package/dist/_virtual/publish2oss.js +0 -8
  70. package/dist/_virtual/pullCmp.js +0 -8
  71. package/dist/_virtual/pushCmp.js +0 -8
  72. package/dist/_virtual/quick-sort.js +0 -5
  73. package/dist/_virtual/regenerator.js +0 -5
  74. package/dist/_virtual/regeneratorAsync.js +0 -5
  75. package/dist/_virtual/regeneratorAsyncGen.js +0 -5
  76. package/dist/_virtual/regeneratorAsyncIterator.js +0 -5
  77. package/dist/_virtual/regeneratorDefine.js +0 -5
  78. package/dist/_virtual/regeneratorKeys.js +0 -5
  79. package/dist/_virtual/regeneratorRuntime.js +0 -5
  80. package/dist/_virtual/regeneratorValues.js +0 -5
  81. package/dist/_virtual/source-map-consumer.js +0 -5
  82. package/dist/_virtual/source-map-generator.js +0 -5
  83. package/dist/_virtual/source-map-support.js +0 -5
  84. package/dist/_virtual/source-map.js +0 -5
  85. package/dist/_virtual/source-node.js +0 -5
  86. package/dist/_virtual/typeof.js +0 -5
  87. package/dist/_virtual/typescript.js +0 -5
  88. package/dist/_virtual/util.js +0 -5
  89. package/dist/config/auth.config.js +0 -50
  90. package/dist/config/default.config.js +0 -225
  91. package/dist/config/index.js +0 -27
  92. package/dist/main.js +0 -9
  93. package/dist/main2.js +0 -261
  94. package/dist/module/inspect.js +0 -64
  95. package/dist/module/neoInit.js +0 -69
  96. package/dist/module/neoInitByCopy.js +0 -81
  97. package/dist/neo/neoLogin.js +0 -663
  98. package/dist/neo/neoRequire.js +0 -118
  99. package/dist/neo/neoService.js +0 -1246
  100. package/dist/node_modules/@babel/runtime/helpers/OverloadYield.js +0 -19
  101. package/dist/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +0 -29
  102. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +0 -13
  103. package/dist/node_modules/@babel/runtime/helpers/regenerator.js +0 -105
  104. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsync.js +0 -24
  105. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js +0 -23
  106. package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js +0 -50
  107. package/dist/node_modules/@babel/runtime/helpers/regeneratorDefine.js +0 -37
  108. package/dist/node_modules/@babel/runtime/helpers/regeneratorKeys.js +0 -25
  109. package/dist/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +0 -98
  110. package/dist/node_modules/@babel/runtime/helpers/regeneratorValues.js +0 -35
  111. package/dist/node_modules/@babel/runtime/helpers/typeof.js +0 -25
  112. package/dist/node_modules/@babel/runtime/regenerator/index.js +0 -29
  113. package/dist/node_modules/buffer-from/index.js +0 -57
  114. package/dist/node_modules/source-map/lib/array-set.js +0 -134
  115. package/dist/node_modules/source-map/lib/base64-vlq.js +0 -144
  116. package/dist/node_modules/source-map/lib/base64.js +0 -81
  117. package/dist/node_modules/source-map/lib/binary-search.js +0 -122
  118. package/dist/node_modules/source-map/lib/mapping-list.js +0 -94
  119. package/dist/node_modules/source-map/lib/quick-sort.js +0 -126
  120. package/dist/node_modules/source-map/lib/source-map-consumer.js +0 -1018
  121. package/dist/node_modules/source-map/lib/source-map-generator.js +0 -385
  122. package/dist/node_modules/source-map/lib/source-node.js +0 -400
  123. package/dist/node_modules/source-map/lib/util.js +0 -449
  124. package/dist/node_modules/source-map/source-map.js +0 -25
  125. package/dist/node_modules/source-map-support/source-map-support.js +0 -610
  126. package/dist/node_modules/typescript/lib/typescript.js +0 -22376
  127. package/dist/oss/publish2oss.js +0 -378
  128. package/dist/plugins/AddNeoRequirePlugin.js +0 -178
  129. package/dist/utils/autoEntryRootDir.js +0 -98
  130. package/dist/utils/cmpUtils/createCmpByTemplate.js +0 -73
  131. package/dist/utils/cmpUtils/createCmpByZip.js +0 -530
  132. package/dist/utils/cmpUtils/createCommonModulesCode.js +0 -84
  133. package/dist/utils/cmpUtils/deleteCmp.js +0 -98
  134. package/dist/utils/cmpUtils/getCmpModelRegisterCode.js +0 -38
  135. package/dist/utils/cmpUtils/getCmpPreviewCode.js +0 -37
  136. package/dist/utils/cmpUtils/getCmpRegisterCode.js +0 -38
  137. package/dist/utils/cmpUtils/getCmpTypeByDir.js +0 -58
  138. package/dist/utils/cmpUtils/hasCmpTypeByDir.js +0 -25
  139. package/dist/utils/cmpUtils/previewCmp.js +0 -74
  140. package/dist/utils/cmpUtils/pullCmp.js +0 -144
  141. package/dist/utils/cmpUtils/pushCmp.js +0 -290
  142. package/dist/utils/common.js +0 -121
  143. package/dist/utils/configureNeoBuild.js +0 -153
  144. package/dist/utils/generateEntries.js +0 -73
  145. package/dist/utils/neoConfigInit.js +0 -25
  146. package/dist/utils/neoParams.js +0 -23
  147. package/dist/utils/pathUtils.js +0 -48
  148. package/dist/utils/projectNameValidator.js +0 -89
  149. package/dist/utils/projectUtils/createCmpProjectByTemplate.js +0 -74
  150. package/dist/utils/projectUtils/createCmpProjectZip.js +0 -135
  151. package/dist/utils/projectUtils/getEntries.js +0 -99
  152. package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +0 -127
  153. package/dist/utils/projectUtils/hasNeoProject.js +0 -31
  154. package/dist/utils/projectUtils/openProject.js +0 -169
  155. package/dist/utils/projectUtils/updatePublishLog.js +0 -45
  156. package/dist/utils/replaceInFilesByMap.js +0 -70
  157. package/dist/utils/replaceInPackage.js +0 -151
  158. package/dist/utils/resetPackageVersion.js +0 -134
@@ -1,400 +0,0 @@
1
- 'use strict';
2
-
3
- var sourceNode = require('../../../_virtual/source-node.js');
4
- var sourceMapGenerator = require('./source-map-generator.js');
5
- var util = require('./util.js');
6
-
7
- /* -*- Mode: js; js-indent-level: 2; -*- */
8
-
9
- var hasRequiredSourceNode;
10
-
11
- function requireSourceNode () {
12
- if (hasRequiredSourceNode) return sourceNode.__exports;
13
- hasRequiredSourceNode = 1;
14
- /*
15
- * Copyright 2011 Mozilla Foundation and contributors
16
- * Licensed under the New BSD license. See LICENSE or:
17
- * http://opensource.org/licenses/BSD-3-Clause
18
- */
19
-
20
- var SourceMapGenerator = sourceMapGenerator.__require().SourceMapGenerator;
21
- var util$1 = util.__require();
22
-
23
- // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
24
- // operating systems these days (capturing the result).
25
- var REGEX_NEWLINE = /(\r?\n)/;
26
-
27
- // Newline character code for charCodeAt() comparisons
28
- var NEWLINE_CODE = 10;
29
-
30
- // Private symbol for identifying `SourceNode`s when multiple versions of
31
- // the source-map library are loaded. This MUST NOT CHANGE across
32
- // versions!
33
- var isSourceNode = "$$$isSourceNode$$$";
34
-
35
- /**
36
- * SourceNodes provide a way to abstract over interpolating/concatenating
37
- * snippets of generated JavaScript source code while maintaining the line and
38
- * column information associated with the original source code.
39
- *
40
- * @param aLine The original line number.
41
- * @param aColumn The original column number.
42
- * @param aSource The original source's filename.
43
- * @param aChunks Optional. An array of strings which are snippets of
44
- * generated JS, or other SourceNodes.
45
- * @param aName The original identifier.
46
- */
47
- function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
48
- this.children = [];
49
- this.sourceContents = {};
50
- this.line = aLine == null ? null : aLine;
51
- this.column = aColumn == null ? null : aColumn;
52
- this.source = aSource == null ? null : aSource;
53
- this.name = aName == null ? null : aName;
54
- this[isSourceNode] = true;
55
- if (aChunks != null) this.add(aChunks);
56
- }
57
-
58
- /**
59
- * Creates a SourceNode from generated code and a SourceMapConsumer.
60
- *
61
- * @param aGeneratedCode The generated code
62
- * @param aSourceMapConsumer The SourceMap for the generated code
63
- * @param aRelativePath Optional. The path that relative sources in the
64
- * SourceMapConsumer should be relative to.
65
- */
66
- SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
67
- // The SourceNode we want to fill with the generated code
68
- // and the SourceMap
69
- var node = new SourceNode();
70
-
71
- // All even indices of this array are one line of the generated code,
72
- // while all odd indices are the newlines between two adjacent lines
73
- // (since `REGEX_NEWLINE` captures its match).
74
- // Processed fragments are accessed by calling `shiftNextLine`.
75
- var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
76
- var remainingLinesIndex = 0;
77
- var shiftNextLine = function shiftNextLine() {
78
- var lineContents = getNextLine();
79
- // The last line of a file might not have a newline.
80
- var newLine = getNextLine() || "";
81
- return lineContents + newLine;
82
- function getNextLine() {
83
- return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : undefined;
84
- }
85
- };
86
-
87
- // We need to remember the position of "remainingLines"
88
- var lastGeneratedLine = 1,
89
- lastGeneratedColumn = 0;
90
-
91
- // The generate SourceNodes we need a code range.
92
- // To extract it current and last mapping is used.
93
- // Here we store the last mapping.
94
- var lastMapping = null;
95
- aSourceMapConsumer.eachMapping(function (mapping) {
96
- if (lastMapping !== null) {
97
- // We add the code from "lastMapping" to "mapping":
98
- // First check if there is a new line in between.
99
- if (lastGeneratedLine < mapping.generatedLine) {
100
- // Associate first line with "lastMapping"
101
- addMappingWithCode(lastMapping, shiftNextLine());
102
- lastGeneratedLine++;
103
- lastGeneratedColumn = 0;
104
- // The remaining code is added without mapping
105
- } else {
106
- // There is no new line in between.
107
- // Associate the code between "lastGeneratedColumn" and
108
- // "mapping.generatedColumn" with "lastMapping"
109
- var nextLine = remainingLines[remainingLinesIndex] || '';
110
- var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
111
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
112
- lastGeneratedColumn = mapping.generatedColumn;
113
- addMappingWithCode(lastMapping, code);
114
- // No more remaining code, continue
115
- lastMapping = mapping;
116
- return;
117
- }
118
- }
119
- // We add the generated code until the first mapping
120
- // to the SourceNode without any mapping.
121
- // Each line is added as separate string.
122
- while (lastGeneratedLine < mapping.generatedLine) {
123
- node.add(shiftNextLine());
124
- lastGeneratedLine++;
125
- }
126
- if (lastGeneratedColumn < mapping.generatedColumn) {
127
- var nextLine = remainingLines[remainingLinesIndex] || '';
128
- node.add(nextLine.substr(0, mapping.generatedColumn));
129
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
130
- lastGeneratedColumn = mapping.generatedColumn;
131
- }
132
- lastMapping = mapping;
133
- }, this);
134
- // We have processed all mappings.
135
- if (remainingLinesIndex < remainingLines.length) {
136
- if (lastMapping) {
137
- // Associate the remaining code in the current line with "lastMapping"
138
- addMappingWithCode(lastMapping, shiftNextLine());
139
- }
140
- // and add the remaining lines without any mapping
141
- node.add(remainingLines.splice(remainingLinesIndex).join(""));
142
- }
143
-
144
- // Copy sourcesContent into SourceNode
145
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
146
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
147
- if (content != null) {
148
- if (aRelativePath != null) {
149
- sourceFile = util$1.join(aRelativePath, sourceFile);
150
- }
151
- node.setSourceContent(sourceFile, content);
152
- }
153
- });
154
- return node;
155
- function addMappingWithCode(mapping, code) {
156
- if (mapping === null || mapping.source === undefined) {
157
- node.add(code);
158
- } else {
159
- var source = aRelativePath ? util$1.join(aRelativePath, mapping.source) : mapping.source;
160
- node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
161
- }
162
- }
163
- };
164
-
165
- /**
166
- * Add a chunk of generated JS to this source node.
167
- *
168
- * @param aChunk A string snippet of generated JS code, another instance of
169
- * SourceNode, or an array where each member is one of those things.
170
- */
171
- SourceNode.prototype.add = function SourceNode_add(aChunk) {
172
- if (Array.isArray(aChunk)) {
173
- aChunk.forEach(function (chunk) {
174
- this.add(chunk);
175
- }, this);
176
- } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
177
- if (aChunk) {
178
- this.children.push(aChunk);
179
- }
180
- } else {
181
- throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
182
- }
183
- return this;
184
- };
185
-
186
- /**
187
- * Add a chunk of generated JS to the beginning of this source node.
188
- *
189
- * @param aChunk A string snippet of generated JS code, another instance of
190
- * SourceNode, or an array where each member is one of those things.
191
- */
192
- SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
193
- if (Array.isArray(aChunk)) {
194
- for (var i = aChunk.length - 1; i >= 0; i--) {
195
- this.prepend(aChunk[i]);
196
- }
197
- } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
198
- this.children.unshift(aChunk);
199
- } else {
200
- throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
201
- }
202
- return this;
203
- };
204
-
205
- /**
206
- * Walk over the tree of JS snippets in this node and its children. The
207
- * walking function is called once for each snippet of JS and is passed that
208
- * snippet and the its original associated source's line/column location.
209
- *
210
- * @param aFn The traversal function.
211
- */
212
- SourceNode.prototype.walk = function SourceNode_walk(aFn) {
213
- var chunk;
214
- for (var i = 0, len = this.children.length; i < len; i++) {
215
- chunk = this.children[i];
216
- if (chunk[isSourceNode]) {
217
- chunk.walk(aFn);
218
- } else {
219
- if (chunk !== '') {
220
- aFn(chunk, {
221
- source: this.source,
222
- line: this.line,
223
- column: this.column,
224
- name: this.name
225
- });
226
- }
227
- }
228
- }
229
- };
230
-
231
- /**
232
- * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
233
- * each of `this.children`.
234
- *
235
- * @param aSep The separator.
236
- */
237
- SourceNode.prototype.join = function SourceNode_join(aSep) {
238
- var newChildren;
239
- var i;
240
- var len = this.children.length;
241
- if (len > 0) {
242
- newChildren = [];
243
- for (i = 0; i < len - 1; i++) {
244
- newChildren.push(this.children[i]);
245
- newChildren.push(aSep);
246
- }
247
- newChildren.push(this.children[i]);
248
- this.children = newChildren;
249
- }
250
- return this;
251
- };
252
-
253
- /**
254
- * Call String.prototype.replace on the very right-most source snippet. Useful
255
- * for trimming whitespace from the end of a source node, etc.
256
- *
257
- * @param aPattern The pattern to replace.
258
- * @param aReplacement The thing to replace the pattern with.
259
- */
260
- SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
261
- var lastChild = this.children[this.children.length - 1];
262
- if (lastChild[isSourceNode]) {
263
- lastChild.replaceRight(aPattern, aReplacement);
264
- } else if (typeof lastChild === 'string') {
265
- this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
266
- } else {
267
- this.children.push(''.replace(aPattern, aReplacement));
268
- }
269
- return this;
270
- };
271
-
272
- /**
273
- * Set the source content for a source file. This will be added to the SourceMapGenerator
274
- * in the sourcesContent field.
275
- *
276
- * @param aSourceFile The filename of the source file
277
- * @param aSourceContent The content of the source file
278
- */
279
- SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
280
- this.sourceContents[util$1.toSetString(aSourceFile)] = aSourceContent;
281
- };
282
-
283
- /**
284
- * Walk over the tree of SourceNodes. The walking function is called for each
285
- * source file content and is passed the filename and source content.
286
- *
287
- * @param aFn The traversal function.
288
- */
289
- SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
290
- for (var i = 0, len = this.children.length; i < len; i++) {
291
- if (this.children[i][isSourceNode]) {
292
- this.children[i].walkSourceContents(aFn);
293
- }
294
- }
295
- var sources = Object.keys(this.sourceContents);
296
- for (var i = 0, len = sources.length; i < len; i++) {
297
- aFn(util$1.fromSetString(sources[i]), this.sourceContents[sources[i]]);
298
- }
299
- };
300
-
301
- /**
302
- * Return the string representation of this source node. Walks over the tree
303
- * and concatenates all the various snippets together to one string.
304
- */
305
- SourceNode.prototype.toString = function SourceNode_toString() {
306
- var str = "";
307
- this.walk(function (chunk) {
308
- str += chunk;
309
- });
310
- return str;
311
- };
312
-
313
- /**
314
- * Returns the string representation of this source node along with a source
315
- * map.
316
- */
317
- SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
318
- var generated = {
319
- code: "",
320
- line: 1,
321
- column: 0
322
- };
323
- var map = new SourceMapGenerator(aArgs);
324
- var sourceMappingActive = false;
325
- var lastOriginalSource = null;
326
- var lastOriginalLine = null;
327
- var lastOriginalColumn = null;
328
- var lastOriginalName = null;
329
- this.walk(function (chunk, original) {
330
- generated.code += chunk;
331
- if (original.source !== null && original.line !== null && original.column !== null) {
332
- if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
333
- map.addMapping({
334
- source: original.source,
335
- original: {
336
- line: original.line,
337
- column: original.column
338
- },
339
- generated: {
340
- line: generated.line,
341
- column: generated.column
342
- },
343
- name: original.name
344
- });
345
- }
346
- lastOriginalSource = original.source;
347
- lastOriginalLine = original.line;
348
- lastOriginalColumn = original.column;
349
- lastOriginalName = original.name;
350
- sourceMappingActive = true;
351
- } else if (sourceMappingActive) {
352
- map.addMapping({
353
- generated: {
354
- line: generated.line,
355
- column: generated.column
356
- }
357
- });
358
- lastOriginalSource = null;
359
- sourceMappingActive = false;
360
- }
361
- for (var idx = 0, length = chunk.length; idx < length; idx++) {
362
- if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
363
- generated.line++;
364
- generated.column = 0;
365
- // Mappings end at eol
366
- if (idx + 1 === length) {
367
- lastOriginalSource = null;
368
- sourceMappingActive = false;
369
- } else if (sourceMappingActive) {
370
- map.addMapping({
371
- source: original.source,
372
- original: {
373
- line: original.line,
374
- column: original.column
375
- },
376
- generated: {
377
- line: generated.line,
378
- column: generated.column
379
- },
380
- name: original.name
381
- });
382
- }
383
- } else {
384
- generated.column++;
385
- }
386
- }
387
- });
388
- this.walkSourceContents(function (sourceFile, sourceContent) {
389
- map.setSourceContent(sourceFile, sourceContent);
390
- });
391
- return {
392
- code: generated.code,
393
- map: map
394
- };
395
- };
396
- sourceNode.__exports.SourceNode = SourceNode;
397
- return sourceNode.__exports;
398
- }
399
-
400
- exports.__require = requireSourceNode;