webpack-dev-server 4.7.2 → 4.8.0
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 +43 -6
- package/bin/cli-flags.js +34 -22
- package/client/index.js +1 -1
- package/client/modules/sockjs-client/index.js +76 -1120
- package/client/socket.js +5 -2
- package/client/utils/createSocketURL.js +1 -1
- package/client/utils/parseURL.js +1 -1
- package/client/utils/stripAnsi.js +20 -0
- package/lib/Server.js +138 -141
- package/lib/options.json +89 -21
- package/package.json +34 -33
- package/types/bin/cli-flags.d.ts +63 -33
- package/types/lib/Server.d.ts +484 -476
- package/types/lib/servers/WebsocketServer.d.ts +1 -1
- package/client/modules/strip-ansi/index.js +0 -119
|
@@ -49,1062 +49,6 @@ if (typeof Object.create === 'function') {
|
|
|
49
49
|
|
|
50
50
|
/***/ }),
|
|
51
51
|
|
|
52
|
-
/***/ "./node_modules/json3/lib/json3.js":
|
|
53
|
-
/*!*****************************************!*\
|
|
54
|
-
!*** ./node_modules/json3/lib/json3.js ***!
|
|
55
|
-
\*****************************************/
|
|
56
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
57
|
-
|
|
58
|
-
/* module decorator */ module = __webpack_require__.nmd(module);
|
|
59
|
-
var __WEBPACK_AMD_DEFINE_RESULT__;/*! JSON v3.3.2 | https://bestiejs.github.io/json3 | Copyright 2012-2015, Kit Cambridge, Benjamin Tan | http://kit.mit-license.org */
|
|
60
|
-
;
|
|
61
|
-
(function () {
|
|
62
|
-
// Detect the `define` function exposed by asynchronous module loaders. The
|
|
63
|
-
// strict `define` check is necessary for compatibility with `r.js`.
|
|
64
|
-
var isLoader = true && __webpack_require__.amdO; // A set of types used to distinguish objects from primitives.
|
|
65
|
-
|
|
66
|
-
var objectTypes = {
|
|
67
|
-
"function": true,
|
|
68
|
-
"object": true
|
|
69
|
-
}; // Detect the `exports` object exposed by CommonJS implementations.
|
|
70
|
-
|
|
71
|
-
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via
|
|
72
|
-
// `insert-module-globals`), Narwhal, and Ringo as the default context,
|
|
73
|
-
// and the `window` object in browsers. Rhino exports a `global` function
|
|
74
|
-
// instead.
|
|
75
|
-
|
|
76
|
-
var root = objectTypes[typeof window] && window || this,
|
|
77
|
-
freeGlobal = freeExports && objectTypes["object"] && module && !module.nodeType && typeof __webpack_require__.g == "object" && __webpack_require__.g;
|
|
78
|
-
|
|
79
|
-
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
|
|
80
|
-
root = freeGlobal;
|
|
81
|
-
} // Public: Initializes JSON 3 using the given `context` object, attaching the
|
|
82
|
-
// `stringify` and `parse` functions to the specified `exports` object.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
function runInContext(context, exports) {
|
|
86
|
-
context || (context = root.Object());
|
|
87
|
-
exports || (exports = root.Object()); // Native constructor aliases.
|
|
88
|
-
|
|
89
|
-
var Number = context.Number || root.Number,
|
|
90
|
-
String = context.String || root.String,
|
|
91
|
-
Object = context.Object || root.Object,
|
|
92
|
-
Date = context.Date || root.Date,
|
|
93
|
-
SyntaxError = context.SyntaxError || root.SyntaxError,
|
|
94
|
-
TypeError = context.TypeError || root.TypeError,
|
|
95
|
-
Math = context.Math || root.Math,
|
|
96
|
-
nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations.
|
|
97
|
-
|
|
98
|
-
if (typeof nativeJSON == "object" && nativeJSON) {
|
|
99
|
-
exports.stringify = nativeJSON.stringify;
|
|
100
|
-
exports.parse = nativeJSON.parse;
|
|
101
|
-
} // Convenience aliases.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var objectProto = Object.prototype,
|
|
105
|
-
getClass = objectProto.toString,
|
|
106
|
-
isProperty = objectProto.hasOwnProperty,
|
|
107
|
-
undefined; // Internal: Contains `try...catch` logic used by other functions.
|
|
108
|
-
// This prevents other functions from being deoptimized.
|
|
109
|
-
|
|
110
|
-
function attempt(func, errorFunc) {
|
|
111
|
-
try {
|
|
112
|
-
func();
|
|
113
|
-
} catch (exception) {
|
|
114
|
-
if (errorFunc) {
|
|
115
|
-
errorFunc();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
} // Test the `Date#getUTC*` methods. Based on work by @Yaffle.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var isExtended = new Date(-3509827334573292);
|
|
122
|
-
attempt(function () {
|
|
123
|
-
// The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical
|
|
124
|
-
// results for certain dates in Opera >= 10.53.
|
|
125
|
-
isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;
|
|
126
|
-
}); // Internal: Determines whether the native `JSON.stringify` and `parse`
|
|
127
|
-
// implementations are spec-compliant. Based on work by Ken Snyder.
|
|
128
|
-
|
|
129
|
-
function has(name) {
|
|
130
|
-
if (has[name] != null) {
|
|
131
|
-
// Return cached feature test result.
|
|
132
|
-
return has[name];
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
var isSupported;
|
|
136
|
-
|
|
137
|
-
if (name == "bug-string-char-index") {
|
|
138
|
-
// IE <= 7 doesn't support accessing string characters using square
|
|
139
|
-
// bracket notation. IE 8 only supports this for primitives.
|
|
140
|
-
isSupported = "a"[0] != "a";
|
|
141
|
-
} else if (name == "json") {
|
|
142
|
-
// Indicates whether both `JSON.stringify` and `JSON.parse` are
|
|
143
|
-
// supported.
|
|
144
|
-
isSupported = has("json-stringify") && has("date-serialization") && has("json-parse");
|
|
145
|
-
} else if (name == "date-serialization") {
|
|
146
|
-
// Indicates whether `Date`s can be serialized accurately by `JSON.stringify`.
|
|
147
|
-
isSupported = has("json-stringify") && isExtended;
|
|
148
|
-
|
|
149
|
-
if (isSupported) {
|
|
150
|
-
var stringify = exports.stringify;
|
|
151
|
-
attempt(function () {
|
|
152
|
-
isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly
|
|
153
|
-
// serialize extended years.
|
|
154
|
-
stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1.
|
|
155
|
-
stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative
|
|
156
|
-
// four-digit years instead of six-digit years. Credits: @Yaffle.
|
|
157
|
-
stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond
|
|
158
|
-
// values less than 1000. Credits: @Yaffle.
|
|
159
|
-
stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
} else {
|
|
163
|
-
var value,
|
|
164
|
-
serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`.
|
|
165
|
-
|
|
166
|
-
if (name == "json-stringify") {
|
|
167
|
-
var stringify = exports.stringify,
|
|
168
|
-
stringifySupported = typeof stringify == "function";
|
|
169
|
-
|
|
170
|
-
if (stringifySupported) {
|
|
171
|
-
// A test function object with a custom `toJSON` method.
|
|
172
|
-
(value = function value() {
|
|
173
|
-
return 1;
|
|
174
|
-
}).toJSON = value;
|
|
175
|
-
attempt(function () {
|
|
176
|
-
stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean
|
|
177
|
-
// primitives as object literals.
|
|
178
|
-
stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object
|
|
179
|
-
// literals.
|
|
180
|
-
stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or
|
|
181
|
-
// does not define a canonical JSON representation (this applies to
|
|
182
|
-
// objects with `toJSON` properties as well, *unless* they are nested
|
|
183
|
-
// within an object or array).
|
|
184
|
-
stringify(getClass) === undefined && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and
|
|
185
|
-
// FF 3.1b3 pass this test.
|
|
186
|
-
stringify(undefined) === undefined && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,
|
|
187
|
-
// respectively, if the value is omitted entirely.
|
|
188
|
-
stringify() === undefined && // FF 3.1b1, 2 throw an error if the given value is not a number,
|
|
189
|
-
// string, array, object, Boolean, or `null` literal. This applies to
|
|
190
|
-
// objects with custom `toJSON` methods as well, unless they are nested
|
|
191
|
-
// inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`
|
|
192
|
-
// methods entirely.
|
|
193
|
-
stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of
|
|
194
|
-
// `"[null]"`.
|
|
195
|
-
stringify([undefined]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals.
|
|
196
|
-
stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function:
|
|
197
|
-
// `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3
|
|
198
|
-
// elides non-JSON values from objects and arrays, unless they
|
|
199
|
-
// define custom `toJSON` methods.
|
|
200
|
-
stringify([undefined, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences
|
|
201
|
-
// where character escape codes are expected (e.g., `\b` => `\u0008`).
|
|
202
|
-
stringify({
|
|
203
|
-
"a": [value, true, false, null, "\x00\b\n\f\r\t"]
|
|
204
|
-
}) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.
|
|
205
|
-
stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]";
|
|
206
|
-
}, function () {
|
|
207
|
-
stringifySupported = false;
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
isSupported = stringifySupported;
|
|
212
|
-
} // Test `JSON.parse`.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (name == "json-parse") {
|
|
216
|
-
var parse = exports.parse,
|
|
217
|
-
parseSupported;
|
|
218
|
-
|
|
219
|
-
if (typeof parse == "function") {
|
|
220
|
-
attempt(function () {
|
|
221
|
-
// FF 3.1b1, b2 will throw an exception if a bare literal is provided.
|
|
222
|
-
// Conforming implementations should also coerce the initial argument to
|
|
223
|
-
// a string prior to parsing.
|
|
224
|
-
if (parse("0") === 0 && !parse(false)) {
|
|
225
|
-
// Simple parsing test.
|
|
226
|
-
value = parse(serialized);
|
|
227
|
-
parseSupported = value["a"].length == 5 && value["a"][0] === 1;
|
|
228
|
-
|
|
229
|
-
if (parseSupported) {
|
|
230
|
-
attempt(function () {
|
|
231
|
-
// Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.
|
|
232
|
-
parseSupported = !parse('"\t"');
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
if (parseSupported) {
|
|
236
|
-
attempt(function () {
|
|
237
|
-
// FF 4.0 and 4.0.1 allow leading `+` signs and leading
|
|
238
|
-
// decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow
|
|
239
|
-
// certain octal literals.
|
|
240
|
-
parseSupported = parse("01") !== 1;
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (parseSupported) {
|
|
245
|
-
attempt(function () {
|
|
246
|
-
// FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal
|
|
247
|
-
// points. These environments, along with FF 3.1b1 and 2,
|
|
248
|
-
// also allow trailing commas in JSON objects and arrays.
|
|
249
|
-
parseSupported = parse("1.") !== 1;
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}, function () {
|
|
255
|
-
parseSupported = false;
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
isSupported = parseSupported;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return has[name] = !!isSupported;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null;
|
|
267
|
-
|
|
268
|
-
if (!has("json")) {
|
|
269
|
-
// Common `[[Class]]` name aliases.
|
|
270
|
-
var functionClass = "[object Function]",
|
|
271
|
-
dateClass = "[object Date]",
|
|
272
|
-
numberClass = "[object Number]",
|
|
273
|
-
stringClass = "[object String]",
|
|
274
|
-
arrayClass = "[object Array]",
|
|
275
|
-
booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index.
|
|
276
|
-
|
|
277
|
-
var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across
|
|
278
|
-
// environments. Each enumerated key is yielded to a `callback` function.
|
|
279
|
-
|
|
280
|
-
var _forOwn = function forOwn(object, callback) {
|
|
281
|
-
var size = 0,
|
|
282
|
-
Properties,
|
|
283
|
-
dontEnums,
|
|
284
|
-
property; // Tests for bugs in the current environment's `for...in` algorithm. The
|
|
285
|
-
// `valueOf` property inherits the non-enumerable flag from
|
|
286
|
-
// `Object.prototype` in older versions of IE, Netscape, and Mozilla.
|
|
287
|
-
|
|
288
|
-
(Properties = function Properties() {
|
|
289
|
-
this.valueOf = 0;
|
|
290
|
-
}).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class.
|
|
291
|
-
|
|
292
|
-
dontEnums = new Properties();
|
|
293
|
-
|
|
294
|
-
for (property in dontEnums) {
|
|
295
|
-
// Ignore all properties inherited from `Object.prototype`.
|
|
296
|
-
if (isProperty.call(dontEnums, property)) {
|
|
297
|
-
size++;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
Properties = dontEnums = null; // Normalize the iteration algorithm.
|
|
302
|
-
|
|
303
|
-
if (!size) {
|
|
304
|
-
// A list of non-enumerable properties inherited from `Object.prototype`.
|
|
305
|
-
dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable
|
|
306
|
-
// properties.
|
|
307
|
-
|
|
308
|
-
_forOwn = function forOwn(object, callback) {
|
|
309
|
-
var isFunction = getClass.call(object) == functionClass,
|
|
310
|
-
property,
|
|
311
|
-
length;
|
|
312
|
-
var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty;
|
|
313
|
-
|
|
314
|
-
for (property in object) {
|
|
315
|
-
// Gecko <= 1.0 enumerates the `prototype` property of functions under
|
|
316
|
-
// certain conditions; IE does not.
|
|
317
|
-
if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {
|
|
318
|
-
callback(property);
|
|
319
|
-
}
|
|
320
|
-
} // Manually invoke the callback for each non-enumerable property.
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
for (length = dontEnums.length; property = dontEnums[--length];) {
|
|
324
|
-
if (hasProperty.call(object, property)) {
|
|
325
|
-
callback(property);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
} else {
|
|
330
|
-
// No bugs detected; use the standard `for...in` algorithm.
|
|
331
|
-
_forOwn = function forOwn(object, callback) {
|
|
332
|
-
var isFunction = getClass.call(object) == functionClass,
|
|
333
|
-
property,
|
|
334
|
-
isConstructor;
|
|
335
|
-
|
|
336
|
-
for (property in object) {
|
|
337
|
-
if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) {
|
|
338
|
-
callback(property);
|
|
339
|
-
}
|
|
340
|
-
} // Manually invoke the callback for the `constructor` property due to
|
|
341
|
-
// cross-environment inconsistencies.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
if (isConstructor || isProperty.call(object, property = "constructor")) {
|
|
345
|
-
callback(property);
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
return _forOwn(object, callback);
|
|
351
|
-
}; // Public: Serializes a JavaScript `value` as a JSON string. The optional
|
|
352
|
-
// `filter` argument may specify either a function that alters how object and
|
|
353
|
-
// array members are serialized, or an array of strings and numbers that
|
|
354
|
-
// indicates which properties should be serialized. The optional `width`
|
|
355
|
-
// argument may be either a string or number that specifies the indentation
|
|
356
|
-
// level of the output.
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
if (!has("json-stringify") && !has("date-serialization")) {
|
|
360
|
-
// Internal: A map of control characters and their escaped equivalents.
|
|
361
|
-
var Escapes = {
|
|
362
|
-
92: "\\\\",
|
|
363
|
-
34: '\\"',
|
|
364
|
-
8: "\\b",
|
|
365
|
-
12: "\\f",
|
|
366
|
-
10: "\\n",
|
|
367
|
-
13: "\\r",
|
|
368
|
-
9: "\\t"
|
|
369
|
-
}; // Internal: Converts `value` into a zero-padded string such that its
|
|
370
|
-
// length is at least equal to `width`. The `width` must be <= 6.
|
|
371
|
-
|
|
372
|
-
var leadingZeroes = "000000";
|
|
373
|
-
|
|
374
|
-
var toPaddedString = function toPaddedString(width, value) {
|
|
375
|
-
// The `|| 0` expression is necessary to work around a bug in
|
|
376
|
-
// Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.
|
|
377
|
-
return (leadingZeroes + (value || 0)).slice(-width);
|
|
378
|
-
}; // Internal: Serializes a date object.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
var _serializeDate = function serializeDate(value) {
|
|
382
|
-
var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy.
|
|
383
|
-
|
|
384
|
-
if (!isExtended) {
|
|
385
|
-
var floor = Math.floor; // A mapping between the months of the year and the number of days between
|
|
386
|
-
// January 1st and the first of the respective month.
|
|
387
|
-
|
|
388
|
-
var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the
|
|
389
|
-
// first day of the given month.
|
|
390
|
-
|
|
391
|
-
var getDay = function getDay(year, month) {
|
|
392
|
-
return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
getData = function getData(value) {
|
|
396
|
-
// Manually compute the year, month, date, hours, minutes,
|
|
397
|
-
// seconds, and milliseconds if the `getUTC*` methods are
|
|
398
|
-
// buggy. Adapted from @Yaffle's `date-shim` project.
|
|
399
|
-
date = floor(value / 864e5);
|
|
400
|
-
|
|
401
|
-
for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) {
|
|
402
|
-
;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) {
|
|
406
|
-
;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES
|
|
410
|
-
// 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used
|
|
411
|
-
// to compute `A modulo B`, as the `%` operator does not
|
|
412
|
-
// correspond to the `modulo` operation for negative numbers.
|
|
413
|
-
|
|
414
|
-
time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by
|
|
415
|
-
// decomposing the time within the day. See section 15.9.1.10.
|
|
416
|
-
|
|
417
|
-
hours = floor(time / 36e5) % 24;
|
|
418
|
-
minutes = floor(time / 6e4) % 60;
|
|
419
|
-
seconds = floor(time / 1e3) % 60;
|
|
420
|
-
milliseconds = time % 1e3;
|
|
421
|
-
};
|
|
422
|
-
} else {
|
|
423
|
-
getData = function getData(value) {
|
|
424
|
-
year = value.getUTCFullYear();
|
|
425
|
-
month = value.getUTCMonth();
|
|
426
|
-
date = value.getUTCDate();
|
|
427
|
-
hours = value.getUTCHours();
|
|
428
|
-
minutes = value.getUTCMinutes();
|
|
429
|
-
seconds = value.getUTCSeconds();
|
|
430
|
-
milliseconds = value.getUTCMilliseconds();
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
_serializeDate = function serializeDate(value) {
|
|
435
|
-
if (value > -1 / 0 && value < 1 / 0) {
|
|
436
|
-
// Dates are serialized according to the `Date#toJSON` method
|
|
437
|
-
// specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15
|
|
438
|
-
// for the ISO 8601 date time string format.
|
|
439
|
-
getData(value); // Serialize extended years correctly.
|
|
440
|
-
|
|
441
|
-
value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two
|
|
442
|
-
// digits; milliseconds should have three.
|
|
443
|
-
"T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1.
|
|
444
|
-
"." + toPaddedString(3, milliseconds) + "Z";
|
|
445
|
-
year = month = date = hours = minutes = seconds = milliseconds = null;
|
|
446
|
-
} else {
|
|
447
|
-
value = null;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
return value;
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
return _serializeDate(value);
|
|
454
|
-
}; // For environments with `JSON.stringify` but buggy date serialization,
|
|
455
|
-
// we override the native `Date#toJSON` implementation with a
|
|
456
|
-
// spec-compliant one.
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
if (has("json-stringify") && !has("date-serialization")) {
|
|
460
|
-
// Internal: the `Date#toJSON` implementation used to override the native one.
|
|
461
|
-
var dateToJSON = function dateToJSON(key) {
|
|
462
|
-
return _serializeDate(this);
|
|
463
|
-
}; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
var nativeStringify = exports.stringify;
|
|
467
|
-
|
|
468
|
-
exports.stringify = function (source, filter, width) {
|
|
469
|
-
var nativeToJSON = Date.prototype.toJSON;
|
|
470
|
-
Date.prototype.toJSON = dateToJSON;
|
|
471
|
-
var result = nativeStringify(source, filter, width);
|
|
472
|
-
Date.prototype.toJSON = nativeToJSON;
|
|
473
|
-
return result;
|
|
474
|
-
};
|
|
475
|
-
} else {
|
|
476
|
-
// Internal: Double-quotes a string `value`, replacing all ASCII control
|
|
477
|
-
// characters (characters with code unit values between 0 and 31) with
|
|
478
|
-
// their escaped equivalents. This is an implementation of the
|
|
479
|
-
// `Quote(value)` operation defined in ES 5.1 section 15.12.3.
|
|
480
|
-
var unicodePrefix = "\\u00";
|
|
481
|
-
|
|
482
|
-
var escapeChar = function escapeChar(character) {
|
|
483
|
-
var charCode = character.charCodeAt(0),
|
|
484
|
-
escaped = Escapes[charCode];
|
|
485
|
-
|
|
486
|
-
if (escaped) {
|
|
487
|
-
return escaped;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
return unicodePrefix + toPaddedString(2, charCode.toString(16));
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
var reEscape = /[\x00-\x1f\x22\x5c]/g;
|
|
494
|
-
|
|
495
|
-
var quote = function quote(value) {
|
|
496
|
-
reEscape.lastIndex = 0;
|
|
497
|
-
return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"';
|
|
498
|
-
}; // Internal: Recursively serializes an object. Implements the
|
|
499
|
-
// `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) {
|
|
503
|
-
var value, type, className, results, element, index, length, prefix, result;
|
|
504
|
-
attempt(function () {
|
|
505
|
-
// Necessary for host object support.
|
|
506
|
-
value = object[property];
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
if (typeof value == "object" && value) {
|
|
510
|
-
if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) {
|
|
511
|
-
value = _serializeDate(value);
|
|
512
|
-
} else if (typeof value.toJSON == "function") {
|
|
513
|
-
value = value.toJSON(property);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
if (callback) {
|
|
518
|
-
// If a replacement function was provided, call it to obtain the value
|
|
519
|
-
// for serialization.
|
|
520
|
-
value = callback.call(object, property, value);
|
|
521
|
-
} // Exit early if value is `undefined` or `null`.
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
if (value == undefined) {
|
|
525
|
-
return value === undefined ? value : "null";
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
type = typeof value; // Only call `getClass` if the value is an object.
|
|
529
|
-
|
|
530
|
-
if (type == "object") {
|
|
531
|
-
className = getClass.call(value);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
switch (className || type) {
|
|
535
|
-
case "boolean":
|
|
536
|
-
case booleanClass:
|
|
537
|
-
// Booleans are represented literally.
|
|
538
|
-
return "" + value;
|
|
539
|
-
|
|
540
|
-
case "number":
|
|
541
|
-
case numberClass:
|
|
542
|
-
// JSON numbers must be finite. `Infinity` and `NaN` are serialized as
|
|
543
|
-
// `"null"`.
|
|
544
|
-
return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";
|
|
545
|
-
|
|
546
|
-
case "string":
|
|
547
|
-
case stringClass:
|
|
548
|
-
// Strings are double-quoted and escaped.
|
|
549
|
-
return quote("" + value);
|
|
550
|
-
} // Recursively serialize objects and arrays.
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
if (typeof value == "object") {
|
|
554
|
-
// Check for cyclic structures. This is a linear search; performance
|
|
555
|
-
// is inversely proportional to the number of unique nested objects.
|
|
556
|
-
for (length = stack.length; length--;) {
|
|
557
|
-
if (stack[length] === value) {
|
|
558
|
-
// Cyclic structures cannot be serialized by `JSON.stringify`.
|
|
559
|
-
throw TypeError();
|
|
560
|
-
}
|
|
561
|
-
} // Add the object to the stack of traversed objects.
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
stack.push(value);
|
|
565
|
-
results = []; // Save the current indentation level and indent one additional level.
|
|
566
|
-
|
|
567
|
-
prefix = indentation;
|
|
568
|
-
indentation += whitespace;
|
|
569
|
-
|
|
570
|
-
if (className == arrayClass) {
|
|
571
|
-
// Recursively serialize array elements.
|
|
572
|
-
for (index = 0, length = value.length; index < length; index++) {
|
|
573
|
-
element = serialize(index, value, callback, properties, whitespace, indentation, stack);
|
|
574
|
-
results.push(element === undefined ? "null" : element);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]";
|
|
578
|
-
} else {
|
|
579
|
-
// Recursively serialize object members. Members are selected from
|
|
580
|
-
// either a user-specified list of property names, or the object
|
|
581
|
-
// itself.
|
|
582
|
-
_forOwn(properties || value, function (property) {
|
|
583
|
-
var element = serialize(property, value, callback, properties, whitespace, indentation, stack);
|
|
584
|
-
|
|
585
|
-
if (element !== undefined) {
|
|
586
|
-
// According to ES 5.1 section 15.12.3: "If `gap` {whitespace}
|
|
587
|
-
// is not the empty string, let `member` {quote(property) + ":"}
|
|
588
|
-
// be the concatenation of `member` and the `space` character."
|
|
589
|
-
// The "`space` character" refers to the literal space
|
|
590
|
-
// character, not the `space` {width} argument provided to
|
|
591
|
-
// `JSON.stringify`.
|
|
592
|
-
results.push(quote(property) + ":" + (whitespace ? " " : "") + element);
|
|
593
|
-
}
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}";
|
|
597
|
-
} // Remove the object from the traversed object stack.
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
stack.pop();
|
|
601
|
-
return result;
|
|
602
|
-
}
|
|
603
|
-
}; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
exports.stringify = function (source, filter, width) {
|
|
607
|
-
var whitespace, callback, properties, className;
|
|
608
|
-
|
|
609
|
-
if (objectTypes[typeof filter] && filter) {
|
|
610
|
-
className = getClass.call(filter);
|
|
611
|
-
|
|
612
|
-
if (className == functionClass) {
|
|
613
|
-
callback = filter;
|
|
614
|
-
} else if (className == arrayClass) {
|
|
615
|
-
// Convert the property names array into a makeshift set.
|
|
616
|
-
properties = {};
|
|
617
|
-
|
|
618
|
-
for (var index = 0, length = filter.length, value; index < length;) {
|
|
619
|
-
value = filter[index++];
|
|
620
|
-
className = getClass.call(value);
|
|
621
|
-
|
|
622
|
-
if (className == "[object String]" || className == "[object Number]") {
|
|
623
|
-
properties[value] = 1;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
if (width) {
|
|
630
|
-
className = getClass.call(width);
|
|
631
|
-
|
|
632
|
-
if (className == numberClass) {
|
|
633
|
-
// Convert the `width` to an integer and create a string containing
|
|
634
|
-
// `width` number of space characters.
|
|
635
|
-
if ((width -= width % 1) > 0) {
|
|
636
|
-
if (width > 10) {
|
|
637
|
-
width = 10;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
for (whitespace = ""; whitespace.length < width;) {
|
|
641
|
-
whitespace += " ";
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
} else if (className == stringClass) {
|
|
645
|
-
whitespace = width.length <= 10 ? width : width.slice(0, 10);
|
|
646
|
-
}
|
|
647
|
-
} // Opera <= 7.54u2 discards the values associated with empty string keys
|
|
648
|
-
// (`""`) only if they are used directly within an object member list
|
|
649
|
-
// (e.g., `!("" in { "": 1})`).
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []);
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
} // Public: Parses a JSON source string.
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
if (!has("json-parse")) {
|
|
659
|
-
var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped
|
|
660
|
-
// equivalents.
|
|
661
|
-
|
|
662
|
-
var Unescapes = {
|
|
663
|
-
92: "\\",
|
|
664
|
-
34: '"',
|
|
665
|
-
47: "/",
|
|
666
|
-
98: "\b",
|
|
667
|
-
116: "\t",
|
|
668
|
-
110: "\n",
|
|
669
|
-
102: "\f",
|
|
670
|
-
114: "\r"
|
|
671
|
-
}; // Internal: Stores the parser state.
|
|
672
|
-
|
|
673
|
-
var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`.
|
|
674
|
-
|
|
675
|
-
var abort = function abort() {
|
|
676
|
-
Index = Source = null;
|
|
677
|
-
throw SyntaxError();
|
|
678
|
-
}; // Internal: Returns the next token, or `"$"` if the parser has reached
|
|
679
|
-
// the end of the source string. A token may be a string, number, `null`
|
|
680
|
-
// literal, or Boolean literal.
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
var lex = function lex() {
|
|
684
|
-
var source = Source,
|
|
685
|
-
length = source.length,
|
|
686
|
-
value,
|
|
687
|
-
begin,
|
|
688
|
-
position,
|
|
689
|
-
isSigned,
|
|
690
|
-
charCode;
|
|
691
|
-
|
|
692
|
-
while (Index < length) {
|
|
693
|
-
charCode = source.charCodeAt(Index);
|
|
694
|
-
|
|
695
|
-
switch (charCode) {
|
|
696
|
-
case 9:
|
|
697
|
-
case 10:
|
|
698
|
-
case 13:
|
|
699
|
-
case 32:
|
|
700
|
-
// Skip whitespace tokens, including tabs, carriage returns, line
|
|
701
|
-
// feeds, and space characters.
|
|
702
|
-
Index++;
|
|
703
|
-
break;
|
|
704
|
-
|
|
705
|
-
case 123:
|
|
706
|
-
case 125:
|
|
707
|
-
case 91:
|
|
708
|
-
case 93:
|
|
709
|
-
case 58:
|
|
710
|
-
case 44:
|
|
711
|
-
// Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
|
|
712
|
-
// the current position.
|
|
713
|
-
value = charIndexBuggy ? source.charAt(Index) : source[Index];
|
|
714
|
-
Index++;
|
|
715
|
-
return value;
|
|
716
|
-
|
|
717
|
-
case 34:
|
|
718
|
-
// `"` delimits a JSON string; advance to the next character and
|
|
719
|
-
// begin parsing the string. String tokens are prefixed with the
|
|
720
|
-
// sentinel `@` character to distinguish them from punctuators and
|
|
721
|
-
// end-of-string tokens.
|
|
722
|
-
for (value = "@", Index++; Index < length;) {
|
|
723
|
-
charCode = source.charCodeAt(Index);
|
|
724
|
-
|
|
725
|
-
if (charCode < 32) {
|
|
726
|
-
// Unescaped ASCII control characters (those with a code unit
|
|
727
|
-
// less than the space character) are not permitted.
|
|
728
|
-
abort();
|
|
729
|
-
} else if (charCode == 92) {
|
|
730
|
-
// A reverse solidus (`\`) marks the beginning of an escaped
|
|
731
|
-
// control character (including `"`, `\`, and `/`) or Unicode
|
|
732
|
-
// escape sequence.
|
|
733
|
-
charCode = source.charCodeAt(++Index);
|
|
734
|
-
|
|
735
|
-
switch (charCode) {
|
|
736
|
-
case 92:
|
|
737
|
-
case 34:
|
|
738
|
-
case 47:
|
|
739
|
-
case 98:
|
|
740
|
-
case 116:
|
|
741
|
-
case 110:
|
|
742
|
-
case 102:
|
|
743
|
-
case 114:
|
|
744
|
-
// Revive escaped control characters.
|
|
745
|
-
value += Unescapes[charCode];
|
|
746
|
-
Index++;
|
|
747
|
-
break;
|
|
748
|
-
|
|
749
|
-
case 117:
|
|
750
|
-
// `\u` marks the beginning of a Unicode escape sequence.
|
|
751
|
-
// Advance to the first character and validate the
|
|
752
|
-
// four-digit code point.
|
|
753
|
-
begin = ++Index;
|
|
754
|
-
|
|
755
|
-
for (position = Index + 4; Index < position; Index++) {
|
|
756
|
-
charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case-
|
|
757
|
-
// insensitive) that form a single hexadecimal value.
|
|
758
|
-
|
|
759
|
-
if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {
|
|
760
|
-
// Invalid Unicode escape sequence.
|
|
761
|
-
abort();
|
|
762
|
-
}
|
|
763
|
-
} // Revive the escaped character.
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
value += fromCharCode("0x" + source.slice(begin, Index));
|
|
767
|
-
break;
|
|
768
|
-
|
|
769
|
-
default:
|
|
770
|
-
// Invalid escape sequence.
|
|
771
|
-
abort();
|
|
772
|
-
}
|
|
773
|
-
} else {
|
|
774
|
-
if (charCode == 34) {
|
|
775
|
-
// An unescaped double-quote character marks the end of the
|
|
776
|
-
// string.
|
|
777
|
-
break;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
charCode = source.charCodeAt(Index);
|
|
781
|
-
begin = Index; // Optimize for the common case where a string is valid.
|
|
782
|
-
|
|
783
|
-
while (charCode >= 32 && charCode != 92 && charCode != 34) {
|
|
784
|
-
charCode = source.charCodeAt(++Index);
|
|
785
|
-
} // Append the string as-is.
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
value += source.slice(begin, Index);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
if (source.charCodeAt(Index) == 34) {
|
|
793
|
-
// Advance to the next character and return the revived string.
|
|
794
|
-
Index++;
|
|
795
|
-
return value;
|
|
796
|
-
} // Unterminated string.
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
abort();
|
|
800
|
-
|
|
801
|
-
default:
|
|
802
|
-
// Parse numbers and literals.
|
|
803
|
-
begin = Index; // Advance past the negative sign, if one is specified.
|
|
804
|
-
|
|
805
|
-
if (charCode == 45) {
|
|
806
|
-
isSigned = true;
|
|
807
|
-
charCode = source.charCodeAt(++Index);
|
|
808
|
-
} // Parse an integer or floating-point value.
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
if (charCode >= 48 && charCode <= 57) {
|
|
812
|
-
// Leading zeroes are interpreted as octal literals.
|
|
813
|
-
if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) {
|
|
814
|
-
// Illegal octal literal.
|
|
815
|
-
abort();
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
isSigned = false; // Parse the integer component.
|
|
819
|
-
|
|
820
|
-
for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) {
|
|
821
|
-
;
|
|
822
|
-
} // Floats cannot contain a leading decimal point; however, this
|
|
823
|
-
// case is already accounted for by the parser.
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (source.charCodeAt(Index) == 46) {
|
|
827
|
-
position = ++Index; // Parse the decimal component.
|
|
828
|
-
|
|
829
|
-
for (; position < length; position++) {
|
|
830
|
-
charCode = source.charCodeAt(position);
|
|
831
|
-
|
|
832
|
-
if (charCode < 48 || charCode > 57) {
|
|
833
|
-
break;
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
if (position == Index) {
|
|
838
|
-
// Illegal trailing decimal.
|
|
839
|
-
abort();
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
Index = position;
|
|
843
|
-
} // Parse exponents. The `e` denoting the exponent is
|
|
844
|
-
// case-insensitive.
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
charCode = source.charCodeAt(Index);
|
|
848
|
-
|
|
849
|
-
if (charCode == 101 || charCode == 69) {
|
|
850
|
-
charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is
|
|
851
|
-
// specified.
|
|
852
|
-
|
|
853
|
-
if (charCode == 43 || charCode == 45) {
|
|
854
|
-
Index++;
|
|
855
|
-
} // Parse the exponential component.
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
for (position = Index; position < length; position++) {
|
|
859
|
-
charCode = source.charCodeAt(position);
|
|
860
|
-
|
|
861
|
-
if (charCode < 48 || charCode > 57) {
|
|
862
|
-
break;
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
if (position == Index) {
|
|
867
|
-
// Illegal empty exponent.
|
|
868
|
-
abort();
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
Index = position;
|
|
872
|
-
} // Coerce the parsed value to a JavaScript number.
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
return +source.slice(begin, Index);
|
|
876
|
-
} // A negative sign may only precede numbers.
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
if (isSigned) {
|
|
880
|
-
abort();
|
|
881
|
-
} // `true`, `false`, and `null` literals.
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
var temp = source.slice(Index, Index + 4);
|
|
885
|
-
|
|
886
|
-
if (temp == "true") {
|
|
887
|
-
Index += 4;
|
|
888
|
-
return true;
|
|
889
|
-
} else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) {
|
|
890
|
-
Index += 5;
|
|
891
|
-
return false;
|
|
892
|
-
} else if (temp == "null") {
|
|
893
|
-
Index += 4;
|
|
894
|
-
return null;
|
|
895
|
-
} // Unrecognized token.
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
abort();
|
|
899
|
-
}
|
|
900
|
-
} // Return the sentinel `$` character if the parser has reached the end
|
|
901
|
-
// of the source string.
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
return "$";
|
|
905
|
-
}; // Internal: Parses a JSON `value` token.
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
var get = function get(value) {
|
|
909
|
-
var results, hasMembers;
|
|
910
|
-
|
|
911
|
-
if (value == "$") {
|
|
912
|
-
// Unexpected end of input.
|
|
913
|
-
abort();
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
if (typeof value == "string") {
|
|
917
|
-
if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") {
|
|
918
|
-
// Remove the sentinel `@` character.
|
|
919
|
-
return value.slice(1);
|
|
920
|
-
} // Parse object and array literals.
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
if (value == "[") {
|
|
924
|
-
// Parses a JSON array, returning a new JavaScript array.
|
|
925
|
-
results = [];
|
|
926
|
-
|
|
927
|
-
for (;;) {
|
|
928
|
-
value = lex(); // A closing square bracket marks the end of the array literal.
|
|
929
|
-
|
|
930
|
-
if (value == "]") {
|
|
931
|
-
break;
|
|
932
|
-
} // If the array literal contains elements, the current token
|
|
933
|
-
// should be a comma separating the previous element from the
|
|
934
|
-
// next.
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
if (hasMembers) {
|
|
938
|
-
if (value == ",") {
|
|
939
|
-
value = lex();
|
|
940
|
-
|
|
941
|
-
if (value == "]") {
|
|
942
|
-
// Unexpected trailing `,` in array literal.
|
|
943
|
-
abort();
|
|
944
|
-
}
|
|
945
|
-
} else {
|
|
946
|
-
// A `,` must separate each array element.
|
|
947
|
-
abort();
|
|
948
|
-
}
|
|
949
|
-
} else {
|
|
950
|
-
hasMembers = true;
|
|
951
|
-
} // Elisions and leading commas are not permitted.
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
if (value == ",") {
|
|
955
|
-
abort();
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
results.push(get(value));
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
return results;
|
|
962
|
-
} else if (value == "{") {
|
|
963
|
-
// Parses a JSON object, returning a new JavaScript object.
|
|
964
|
-
results = {};
|
|
965
|
-
|
|
966
|
-
for (;;) {
|
|
967
|
-
value = lex(); // A closing curly brace marks the end of the object literal.
|
|
968
|
-
|
|
969
|
-
if (value == "}") {
|
|
970
|
-
break;
|
|
971
|
-
} // If the object literal contains members, the current token
|
|
972
|
-
// should be a comma separator.
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
if (hasMembers) {
|
|
976
|
-
if (value == ",") {
|
|
977
|
-
value = lex();
|
|
978
|
-
|
|
979
|
-
if (value == "}") {
|
|
980
|
-
// Unexpected trailing `,` in object literal.
|
|
981
|
-
abort();
|
|
982
|
-
}
|
|
983
|
-
} else {
|
|
984
|
-
// A `,` must separate each object member.
|
|
985
|
-
abort();
|
|
986
|
-
}
|
|
987
|
-
} else {
|
|
988
|
-
hasMembers = true;
|
|
989
|
-
} // Leading commas are not permitted, object property names must be
|
|
990
|
-
// double-quoted strings, and a `:` must separate each property
|
|
991
|
-
// name and value.
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") {
|
|
995
|
-
abort();
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
results[value.slice(1)] = get(lex());
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
return results;
|
|
1002
|
-
} // Unexpected token encountered.
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
abort();
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
|
-
return value;
|
|
1009
|
-
}; // Internal: Updates a traversed object member.
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
var update = function update(source, property, callback) {
|
|
1013
|
-
var element = walk(source, property, callback);
|
|
1014
|
-
|
|
1015
|
-
if (element === undefined) {
|
|
1016
|
-
delete source[property];
|
|
1017
|
-
} else {
|
|
1018
|
-
source[property] = element;
|
|
1019
|
-
}
|
|
1020
|
-
}; // Internal: Recursively traverses a parsed JSON object, invoking the
|
|
1021
|
-
// `callback` function for each value. This is an implementation of the
|
|
1022
|
-
// `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
var walk = function walk(source, property, callback) {
|
|
1026
|
-
var value = source[property],
|
|
1027
|
-
length;
|
|
1028
|
-
|
|
1029
|
-
if (typeof value == "object" && value) {
|
|
1030
|
-
// `forOwn` can't be used to traverse an array in Opera <= 8.54
|
|
1031
|
-
// because its `Object#hasOwnProperty` implementation returns `false`
|
|
1032
|
-
// for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
|
|
1033
|
-
if (getClass.call(value) == arrayClass) {
|
|
1034
|
-
for (length = value.length; length--;) {
|
|
1035
|
-
update(getClass, _forOwn, value, length, callback);
|
|
1036
|
-
}
|
|
1037
|
-
} else {
|
|
1038
|
-
_forOwn(value, function (property) {
|
|
1039
|
-
update(value, property, callback);
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
return callback.call(source, property, value);
|
|
1045
|
-
}; // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
exports.parse = function (source, callback) {
|
|
1049
|
-
var result, value;
|
|
1050
|
-
Index = 0;
|
|
1051
|
-
Source = "" + source;
|
|
1052
|
-
result = get(lex()); // If a JSON string contains multiple tokens, it is invalid.
|
|
1053
|
-
|
|
1054
|
-
if (lex() != "$") {
|
|
1055
|
-
abort();
|
|
1056
|
-
} // Reset the parser state.
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
Index = Source = null;
|
|
1060
|
-
return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result;
|
|
1061
|
-
};
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
exports.runInContext = runInContext;
|
|
1066
|
-
return exports;
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
if (freeExports && !isLoader) {
|
|
1070
|
-
// Export for CommonJS environments.
|
|
1071
|
-
runInContext(root, freeExports);
|
|
1072
|
-
} else {
|
|
1073
|
-
// Export for web browsers and JavaScript engines.
|
|
1074
|
-
var nativeJSON = root.JSON,
|
|
1075
|
-
previousJSON = root.JSON3,
|
|
1076
|
-
isRestored = false;
|
|
1077
|
-
var JSON3 = runInContext(root, root.JSON3 = {
|
|
1078
|
-
// Public: Restores the original value of the global `JSON` object and
|
|
1079
|
-
// returns a reference to the `JSON3` object.
|
|
1080
|
-
"noConflict": function noConflict() {
|
|
1081
|
-
if (!isRestored) {
|
|
1082
|
-
isRestored = true;
|
|
1083
|
-
root.JSON = nativeJSON;
|
|
1084
|
-
root.JSON3 = previousJSON;
|
|
1085
|
-
nativeJSON = previousJSON = null;
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
return JSON3;
|
|
1089
|
-
}
|
|
1090
|
-
});
|
|
1091
|
-
root.JSON = {
|
|
1092
|
-
"parse": JSON3.parse,
|
|
1093
|
-
"stringify": JSON3.stringify
|
|
1094
|
-
};
|
|
1095
|
-
} // Export for asynchronous module loaders.
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
if (isLoader) {
|
|
1099
|
-
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
|
|
1100
|
-
return JSON3;
|
|
1101
|
-
}).call(exports, __webpack_require__, exports, module),
|
|
1102
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
1103
|
-
}
|
|
1104
|
-
}).call(this);
|
|
1105
|
-
|
|
1106
|
-
/***/ }),
|
|
1107
|
-
|
|
1108
52
|
/***/ "./node_modules/ms/index.js":
|
|
1109
53
|
/*!**********************************!*\
|
|
1110
54
|
!*** ./node_modules/ms/index.js ***!
|
|
@@ -1722,8 +666,7 @@ module.exports = TransportMessageEvent;
|
|
|
1722
666
|
"use strict";
|
|
1723
667
|
|
|
1724
668
|
|
|
1725
|
-
var
|
|
1726
|
-
iframeUtils = __webpack_require__(/*! ./utils/iframe */ "./node_modules/sockjs-client/lib/utils/iframe.js");
|
|
669
|
+
var iframeUtils = __webpack_require__(/*! ./utils/iframe */ "./node_modules/sockjs-client/lib/utils/iframe.js");
|
|
1727
670
|
|
|
1728
671
|
function FacadeJS(transport) {
|
|
1729
672
|
this._transport = transport;
|
|
@@ -1732,7 +675,7 @@ function FacadeJS(transport) {
|
|
|
1732
675
|
}
|
|
1733
676
|
|
|
1734
677
|
FacadeJS.prototype._transportClose = function (code, reason) {
|
|
1735
|
-
iframeUtils.postMessage('c',
|
|
678
|
+
iframeUtils.postMessage('c', JSON.stringify([code, reason]));
|
|
1736
679
|
};
|
|
1737
680
|
|
|
1738
681
|
FacadeJS.prototype._transportMessage = function (frame) {
|
|
@@ -1764,7 +707,6 @@ module.exports = FacadeJS;
|
|
|
1764
707
|
|
|
1765
708
|
var urlUtils = __webpack_require__(/*! ./utils/url */ "./node_modules/sockjs-client/lib/utils/url.js"),
|
|
1766
709
|
eventUtils = __webpack_require__(/*! ./utils/event */ "./node_modules/sockjs-client/lib/utils/event.js"),
|
|
1767
|
-
JSON3 = __webpack_require__(/*! json3 */ "./node_modules/json3/lib/json3.js"),
|
|
1768
710
|
FacadeJS = __webpack_require__(/*! ./facade */ "./node_modules/sockjs-client/lib/facade.js"),
|
|
1769
711
|
InfoIframeReceiver = __webpack_require__(/*! ./info-iframe-receiver */ "./node_modules/sockjs-client/lib/info-iframe-receiver.js"),
|
|
1770
712
|
iframeUtils = __webpack_require__(/*! ./utils/iframe */ "./node_modules/sockjs-client/lib/utils/iframe.js"),
|
|
@@ -1810,7 +752,7 @@ module.exports = function (SockJS, availableTransports) {
|
|
|
1810
752
|
var iframeMessage;
|
|
1811
753
|
|
|
1812
754
|
try {
|
|
1813
|
-
iframeMessage =
|
|
755
|
+
iframeMessage = JSON.parse(e.data);
|
|
1814
756
|
} catch (ignored) {
|
|
1815
757
|
debug('bad json', e.data);
|
|
1816
758
|
return;
|
|
@@ -1825,7 +767,7 @@ module.exports = function (SockJS, availableTransports) {
|
|
|
1825
767
|
var p;
|
|
1826
768
|
|
|
1827
769
|
try {
|
|
1828
|
-
p =
|
|
770
|
+
p = JSON.parse(iframeMessage.data);
|
|
1829
771
|
} catch (ignored) {
|
|
1830
772
|
debug('bad json', iframeMessage.data);
|
|
1831
773
|
break;
|
|
@@ -1882,7 +824,6 @@ module.exports = function (SockJS, availableTransports) {
|
|
|
1882
824
|
|
|
1883
825
|
var EventEmitter = (__webpack_require__(/*! events */ "./node_modules/sockjs-client/lib/event/emitter.js").EventEmitter),
|
|
1884
826
|
inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"),
|
|
1885
|
-
JSON3 = __webpack_require__(/*! json3 */ "./node_modules/json3/lib/json3.js"),
|
|
1886
827
|
objectUtils = __webpack_require__(/*! ./utils/object */ "./node_modules/sockjs-client/lib/utils/object.js");
|
|
1887
828
|
|
|
1888
829
|
var debug = function debug() {};
|
|
@@ -1904,7 +845,7 @@ function InfoAjax(url, AjaxObject) {
|
|
|
1904
845
|
|
|
1905
846
|
if (text) {
|
|
1906
847
|
try {
|
|
1907
|
-
info =
|
|
848
|
+
info = JSON.parse(text);
|
|
1908
849
|
} catch (e) {
|
|
1909
850
|
debug('bad json', text);
|
|
1910
851
|
}
|
|
@@ -1942,7 +883,6 @@ module.exports = InfoAjax;
|
|
|
1942
883
|
|
|
1943
884
|
var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"),
|
|
1944
885
|
EventEmitter = (__webpack_require__(/*! events */ "./node_modules/sockjs-client/lib/event/emitter.js").EventEmitter),
|
|
1945
|
-
JSON3 = __webpack_require__(/*! json3 */ "./node_modules/json3/lib/json3.js"),
|
|
1946
886
|
XHRLocalObject = __webpack_require__(/*! ./transport/sender/xhr-local */ "./node_modules/sockjs-client/lib/transport/sender/xhr-local.js"),
|
|
1947
887
|
InfoAjax = __webpack_require__(/*! ./info-ajax */ "./node_modules/sockjs-client/lib/info-ajax.js");
|
|
1948
888
|
|
|
@@ -1952,7 +892,7 @@ function InfoReceiverIframe(transUrl) {
|
|
|
1952
892
|
this.ir = new InfoAjax(transUrl, XHRLocalObject);
|
|
1953
893
|
this.ir.once('finish', function (info, rtt) {
|
|
1954
894
|
self.ir = null;
|
|
1955
|
-
self.emit('message',
|
|
895
|
+
self.emit('message', JSON.stringify([info, rtt]));
|
|
1956
896
|
});
|
|
1957
897
|
}
|
|
1958
898
|
|
|
@@ -1983,7 +923,6 @@ module.exports = InfoReceiverIframe;
|
|
|
1983
923
|
|
|
1984
924
|
var EventEmitter = (__webpack_require__(/*! events */ "./node_modules/sockjs-client/lib/event/emitter.js").EventEmitter),
|
|
1985
925
|
inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"),
|
|
1986
|
-
JSON3 = __webpack_require__(/*! json3 */ "./node_modules/json3/lib/json3.js"),
|
|
1987
926
|
utils = __webpack_require__(/*! ./utils/event */ "./node_modules/sockjs-client/lib/utils/event.js"),
|
|
1988
927
|
IframeTransport = __webpack_require__(/*! ./transport/iframe */ "./node_modules/sockjs-client/lib/transport/iframe.js"),
|
|
1989
928
|
InfoReceiverIframe = __webpack_require__(/*! ./info-iframe-receiver */ "./node_modules/sockjs-client/lib/info-iframe-receiver.js");
|
|
@@ -2005,7 +944,7 @@ function InfoIframe(baseUrl, url) {
|
|
|
2005
944
|
var d;
|
|
2006
945
|
|
|
2007
946
|
try {
|
|
2008
|
-
d =
|
|
947
|
+
d = JSON.parse(msg);
|
|
2009
948
|
} catch (e) {
|
|
2010
949
|
debug('bad json', msg);
|
|
2011
950
|
self.emit('finish');
|
|
@@ -2188,7 +1127,6 @@ __webpack_require__(/*! ./shims */ "./node_modules/sockjs-client/lib/shims.js");
|
|
|
2188
1127
|
|
|
2189
1128
|
var URL = __webpack_require__(/*! url-parse */ "./node_modules/url-parse/index.js"),
|
|
2190
1129
|
inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"),
|
|
2191
|
-
JSON3 = __webpack_require__(/*! json3 */ "./node_modules/json3/lib/json3.js"),
|
|
2192
1130
|
random = __webpack_require__(/*! ./utils/random */ "./node_modules/sockjs-client/lib/utils/random.js"),
|
|
2193
1131
|
escape = __webpack_require__(/*! ./utils/escape */ "./node_modules/sockjs-client/lib/utils/escape.js"),
|
|
2194
1132
|
urlUtils = __webpack_require__(/*! ./utils/url */ "./node_modules/sockjs-client/lib/utils/url.js"),
|
|
@@ -2451,7 +1389,7 @@ SockJS.prototype._transportMessage = function (msg) {
|
|
|
2451
1389
|
|
|
2452
1390
|
if (content) {
|
|
2453
1391
|
try {
|
|
2454
|
-
payload =
|
|
1392
|
+
payload = JSON.parse(content);
|
|
2455
1393
|
} catch (e) {
|
|
2456
1394
|
debug('bad json', content);
|
|
2457
1395
|
}
|
|
@@ -3415,7 +2353,6 @@ module.exports = HtmlFileTransport;
|
|
|
3415
2353
|
// http://stevesouders.com/misc/test-postmessage.php
|
|
3416
2354
|
|
|
3417
2355
|
var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"),
|
|
3418
|
-
JSON3 = __webpack_require__(/*! json3 */ "./node_modules/json3/lib/json3.js"),
|
|
3419
2356
|
EventEmitter = (__webpack_require__(/*! events */ "./node_modules/sockjs-client/lib/event/emitter.js").EventEmitter),
|
|
3420
2357
|
version = __webpack_require__(/*! ../version */ "./node_modules/sockjs-client/lib/version.js"),
|
|
3421
2358
|
urlUtils = __webpack_require__(/*! ../utils/url */ "./node_modules/sockjs-client/lib/utils/url.js"),
|
|
@@ -3485,7 +2422,7 @@ IframeTransport.prototype._message = function (e) {
|
|
|
3485
2422
|
var iframeMessage;
|
|
3486
2423
|
|
|
3487
2424
|
try {
|
|
3488
|
-
iframeMessage =
|
|
2425
|
+
iframeMessage = JSON.parse(e.data);
|
|
3489
2426
|
} catch (ignored) {
|
|
3490
2427
|
debug('bad json', e.data);
|
|
3491
2428
|
return;
|
|
@@ -3500,7 +2437,7 @@ IframeTransport.prototype._message = function (e) {
|
|
|
3500
2437
|
case 's':
|
|
3501
2438
|
this.iframeObj.loaded(); // window global dependency
|
|
3502
2439
|
|
|
3503
|
-
this.postMessage('s',
|
|
2440
|
+
this.postMessage('s', JSON.stringify([version, this.transport, this.transUrl, this.baseUrl]));
|
|
3504
2441
|
break;
|
|
3505
2442
|
|
|
3506
2443
|
case 't':
|
|
@@ -3511,7 +2448,7 @@ IframeTransport.prototype._message = function (e) {
|
|
|
3511
2448
|
var cdata;
|
|
3512
2449
|
|
|
3513
2450
|
try {
|
|
3514
|
-
cdata =
|
|
2451
|
+
cdata = JSON.parse(iframeMessage.data);
|
|
3515
2452
|
} catch (ignored) {
|
|
3516
2453
|
debug('bad json', iframeMessage.data);
|
|
3517
2454
|
return;
|
|
@@ -3525,7 +2462,7 @@ IframeTransport.prototype._message = function (e) {
|
|
|
3525
2462
|
|
|
3526
2463
|
IframeTransport.prototype.postMessage = function (type, data) {
|
|
3527
2464
|
debug('postMessage', type, data);
|
|
3528
|
-
this.iframeObj.post(
|
|
2465
|
+
this.iframeObj.post(JSON.stringify({
|
|
3529
2466
|
windowId: this.windowId,
|
|
3530
2467
|
type: type,
|
|
3531
2468
|
data: data || ''
|
|
@@ -5063,16 +4000,13 @@ module.exports = {
|
|
|
5063
4000
|
/*!********************************************************!*\
|
|
5064
4001
|
!*** ./node_modules/sockjs-client/lib/utils/escape.js ***!
|
|
5065
4002
|
\********************************************************/
|
|
5066
|
-
/***/ (function(module
|
|
4003
|
+
/***/ (function(module) {
|
|
5067
4004
|
|
|
5068
4005
|
"use strict";
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
var JSON3 = __webpack_require__(/*! json3 */ "./node_modules/json3/lib/json3.js"); // Some extra characters that Chrome gets wrong, and substitutes with
|
|
4006
|
+
// Some extra characters that Chrome gets wrong, and substitutes with
|
|
5072
4007
|
// something else on the wire.
|
|
5073
4008
|
// eslint-disable-next-line no-control-regex, no-misleading-character-class
|
|
5074
4009
|
|
|
5075
|
-
|
|
5076
4010
|
var extraEscapable = /[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,
|
|
5077
4011
|
extraLookup; // This may be quite slow, so let's delay until user actually uses bad
|
|
5078
4012
|
// characters.
|
|
@@ -5100,7 +4034,7 @@ var unrollLookup = function unrollLookup(escapable) {
|
|
|
5100
4034
|
|
|
5101
4035
|
module.exports = {
|
|
5102
4036
|
quote: function quote(string) {
|
|
5103
|
-
var quoted =
|
|
4037
|
+
var quoted = JSON.stringify(string); // In most cases this should be very fast and good enough.
|
|
5104
4038
|
|
|
5105
4039
|
extraEscapable.lastIndex = 0;
|
|
5106
4040
|
|
|
@@ -5210,7 +4144,6 @@ if (!isChromePackagedApp) {
|
|
|
5210
4144
|
|
|
5211
4145
|
|
|
5212
4146
|
var eventUtils = __webpack_require__(/*! ./event */ "./node_modules/sockjs-client/lib/utils/event.js"),
|
|
5213
|
-
JSON3 = __webpack_require__(/*! json3 */ "./node_modules/json3/lib/json3.js"),
|
|
5214
4147
|
browser = __webpack_require__(/*! ./browser */ "./node_modules/sockjs-client/lib/utils/browser.js");
|
|
5215
4148
|
|
|
5216
4149
|
var debug = function debug() {};
|
|
@@ -5229,7 +4162,7 @@ module.exports = {
|
|
|
5229
4162
|
},
|
|
5230
4163
|
postMessage: function postMessage(type, data) {
|
|
5231
4164
|
if (__webpack_require__.g.parent !== __webpack_require__.g) {
|
|
5232
|
-
__webpack_require__.g.parent.postMessage(
|
|
4165
|
+
__webpack_require__.g.parent.postMessage(JSON.stringify({
|
|
5233
4166
|
windowId: module.exports.currentWindowId,
|
|
5234
4167
|
type: type,
|
|
5235
4168
|
data: data || ''
|
|
@@ -5633,7 +4566,7 @@ module.exports = {
|
|
|
5633
4566
|
\***************************************************/
|
|
5634
4567
|
/***/ (function(module) {
|
|
5635
4568
|
|
|
5636
|
-
module.exports = '1.
|
|
4569
|
+
module.exports = '1.6.0';
|
|
5637
4570
|
|
|
5638
4571
|
/***/ }),
|
|
5639
4572
|
|
|
@@ -6108,21 +5041,24 @@ module.exports = setup;
|
|
|
6108
5041
|
|
|
6109
5042
|
var required = __webpack_require__(/*! requires-port */ "./node_modules/requires-port/index.js"),
|
|
6110
5043
|
qs = __webpack_require__(/*! querystringify */ "./node_modules/querystringify/index.js"),
|
|
5044
|
+
controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,
|
|
5045
|
+
CRHTLF = /[\n\r\t]/g,
|
|
6111
5046
|
slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//,
|
|
5047
|
+
port = /:\d+$/,
|
|
6112
5048
|
protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,
|
|
6113
|
-
windowsDriveLetter = /^[a-zA-Z]
|
|
6114
|
-
whitespace = "[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]",
|
|
6115
|
-
left = new RegExp('^' + whitespace + '+');
|
|
5049
|
+
windowsDriveLetter = /^[a-zA-Z]:/;
|
|
6116
5050
|
/**
|
|
6117
|
-
*
|
|
5051
|
+
* Remove control characters and whitespace from the beginning of a string.
|
|
6118
5052
|
*
|
|
6119
|
-
* @param {String} str String to trim.
|
|
5053
|
+
* @param {Object|String} str String to trim.
|
|
5054
|
+
* @returns {String} A new string representing `str` stripped of control
|
|
5055
|
+
* characters and whitespace from its beginning.
|
|
6120
5056
|
* @public
|
|
6121
5057
|
*/
|
|
6122
5058
|
|
|
6123
5059
|
|
|
6124
5060
|
function trimLeft(str) {
|
|
6125
|
-
return (str ? str : '').toString().replace(
|
|
5061
|
+
return (str ? str : '').toString().replace(controlOrWhitespace, '');
|
|
6126
5062
|
}
|
|
6127
5063
|
/**
|
|
6128
5064
|
* These are the parse rules for the URL parser, it informs the parser
|
|
@@ -6146,7 +5082,7 @@ function sanitize(address, url) {
|
|
|
6146
5082
|
}, ['/', 'pathname'], // Extract from the back.
|
|
6147
5083
|
['@', 'auth', 1], // Extract from the front.
|
|
6148
5084
|
[NaN, 'host', undefined, 1, 1], // Set left over value.
|
|
6149
|
-
[/:(\d
|
|
5085
|
+
[/:(\d*)$/, 'port', undefined, 1], // RegExp the back.
|
|
6150
5086
|
[NaN, 'hostname', undefined, 1, 1] // Set left over.
|
|
6151
5087
|
];
|
|
6152
5088
|
/**
|
|
@@ -6237,6 +5173,7 @@ function isSpecial(scheme) {
|
|
|
6237
5173
|
|
|
6238
5174
|
function extractProtocol(address, location) {
|
|
6239
5175
|
address = trimLeft(address);
|
|
5176
|
+
address = address.replace(CRHTLF, '');
|
|
6240
5177
|
location = location || {};
|
|
6241
5178
|
var match = protocolre.exec(address);
|
|
6242
5179
|
var protocol = match[1] ? match[1].toLowerCase() : '';
|
|
@@ -6336,6 +5273,7 @@ function resolve(relative, base) {
|
|
|
6336
5273
|
|
|
6337
5274
|
function Url(address, location, parser) {
|
|
6338
5275
|
address = trimLeft(address);
|
|
5276
|
+
address = address.replace(CRHTLF, '');
|
|
6339
5277
|
|
|
6340
5278
|
if (!(this instanceof Url)) {
|
|
6341
5279
|
return new Url(address, location, parser);
|
|
@@ -6399,7 +5337,9 @@ function Url(address, location, parser) {
|
|
|
6399
5337
|
if (parse !== parse) {
|
|
6400
5338
|
url[key] = address;
|
|
6401
5339
|
} else if ('string' === typeof parse) {
|
|
6402
|
-
|
|
5340
|
+
index = parse === '@' ? address.lastIndexOf(parse) : address.indexOf(parse);
|
|
5341
|
+
|
|
5342
|
+
if (~index) {
|
|
6403
5343
|
if ('number' === typeof instruction[2]) {
|
|
6404
5344
|
url[key] = address.slice(0, index);
|
|
6405
5345
|
address = address.slice(index + instruction[2]);
|
|
@@ -6458,9 +5398,18 @@ function Url(address, location, parser) {
|
|
|
6458
5398
|
url.username = url.password = '';
|
|
6459
5399
|
|
|
6460
5400
|
if (url.auth) {
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
5401
|
+
index = url.auth.indexOf(':');
|
|
5402
|
+
|
|
5403
|
+
if (~index) {
|
|
5404
|
+
url.username = url.auth.slice(0, index);
|
|
5405
|
+
url.username = encodeURIComponent(decodeURIComponent(url.username));
|
|
5406
|
+
url.password = url.auth.slice(index + 1);
|
|
5407
|
+
url.password = encodeURIComponent(decodeURIComponent(url.password));
|
|
5408
|
+
} else {
|
|
5409
|
+
url.username = encodeURIComponent(decodeURIComponent(url.auth));
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5412
|
+
url.auth = url.password ? url.username + ':' + url.password : url.username;
|
|
6464
5413
|
}
|
|
6465
5414
|
|
|
6466
5415
|
url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host ? url.protocol + '//' + url.host : 'null'; //
|
|
@@ -6517,7 +5466,7 @@ function set(part, value, fn) {
|
|
|
6517
5466
|
case 'host':
|
|
6518
5467
|
url[part] = value;
|
|
6519
5468
|
|
|
6520
|
-
if (
|
|
5469
|
+
if (port.test(value)) {
|
|
6521
5470
|
value = value.split(':');
|
|
6522
5471
|
url.port = value.pop();
|
|
6523
5472
|
url.hostname = value.join(':');
|
|
@@ -6550,9 +5499,17 @@ function set(part, value, fn) {
|
|
|
6550
5499
|
break;
|
|
6551
5500
|
|
|
6552
5501
|
case 'auth':
|
|
6553
|
-
var
|
|
6554
|
-
|
|
6555
|
-
|
|
5502
|
+
var index = value.indexOf(':');
|
|
5503
|
+
|
|
5504
|
+
if (~index) {
|
|
5505
|
+
url.username = value.slice(0, index);
|
|
5506
|
+
url.username = encodeURIComponent(decodeURIComponent(url.username));
|
|
5507
|
+
url.password = value.slice(index + 1);
|
|
5508
|
+
url.password = encodeURIComponent(decodeURIComponent(url.password));
|
|
5509
|
+
} else {
|
|
5510
|
+
url.username = encodeURIComponent(decodeURIComponent(value));
|
|
5511
|
+
}
|
|
5512
|
+
|
|
6556
5513
|
}
|
|
6557
5514
|
|
|
6558
5515
|
for (var i = 0; i < rules.length; i++) {
|
|
@@ -6578,6 +5535,7 @@ function toString(stringify) {
|
|
|
6578
5535
|
if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;
|
|
6579
5536
|
var query,
|
|
6580
5537
|
url = this,
|
|
5538
|
+
host = url.host,
|
|
6581
5539
|
protocol = url.protocol;
|
|
6582
5540
|
if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';
|
|
6583
5541
|
var result = protocol + (url.protocol && url.slashes || isSpecial(url.protocol) ? '//' : '');
|
|
@@ -6589,9 +5547,24 @@ function toString(stringify) {
|
|
|
6589
5547
|
} else if (url.password) {
|
|
6590
5548
|
result += ':' + url.password;
|
|
6591
5549
|
result += '@';
|
|
5550
|
+
} else if (url.protocol !== 'file:' && isSpecial(url.protocol) && !host && url.pathname !== '/') {
|
|
5551
|
+
//
|
|
5552
|
+
// Add back the empty userinfo, otherwise the original invalid URL
|
|
5553
|
+
// might be transformed into a valid one with `url.pathname` as host.
|
|
5554
|
+
//
|
|
5555
|
+
result += '@';
|
|
5556
|
+
} //
|
|
5557
|
+
// Trailing colon is removed from `url.host` when it is parsed. If it still
|
|
5558
|
+
// ends with a colon, then add back the trailing colon that was removed. This
|
|
5559
|
+
// prevents an invalid URL from being transformed into a valid one.
|
|
5560
|
+
//
|
|
5561
|
+
|
|
5562
|
+
|
|
5563
|
+
if (host[host.length - 1] === ':' || port.test(url.hostname) && !url.port) {
|
|
5564
|
+
host += ':';
|
|
6592
5565
|
}
|
|
6593
5566
|
|
|
6594
|
-
result +=
|
|
5567
|
+
result += host + url.pathname;
|
|
6595
5568
|
query = 'object' === typeof url.query ? stringify(url.query) : url.query;
|
|
6596
5569
|
if (query) result += '?' !== query.charAt(0) ? '?' + query : query;
|
|
6597
5570
|
if (url.hash) result += url.hash;
|
|
@@ -6628,27 +5601,19 @@ module.exports = Url;
|
|
|
6628
5601
|
/******/ }
|
|
6629
5602
|
/******/ // Create a new module (and put it into the cache)
|
|
6630
5603
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
6631
|
-
/******/ id
|
|
6632
|
-
/******/ loaded
|
|
5604
|
+
/******/ // no module.id needed
|
|
5605
|
+
/******/ // no module.loaded needed
|
|
6633
5606
|
/******/ exports: {}
|
|
6634
5607
|
/******/ };
|
|
6635
5608
|
/******/
|
|
6636
5609
|
/******/ // Execute the module function
|
|
6637
|
-
/******/ __webpack_modules__[moduleId]
|
|
6638
|
-
/******/
|
|
6639
|
-
/******/ // Flag the module as loaded
|
|
6640
|
-
/******/ module.loaded = true;
|
|
5610
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
6641
5611
|
/******/
|
|
6642
5612
|
/******/ // Return the exports of the module
|
|
6643
5613
|
/******/ return module.exports;
|
|
6644
5614
|
/******/ }
|
|
6645
5615
|
/******/
|
|
6646
5616
|
/************************************************************************/
|
|
6647
|
-
/******/ /* webpack/runtime/amd options */
|
|
6648
|
-
/******/ !function() {
|
|
6649
|
-
/******/ __webpack_require__.amdO = {};
|
|
6650
|
-
/******/ }();
|
|
6651
|
-
/******/
|
|
6652
5617
|
/******/ /* webpack/runtime/compat get default export */
|
|
6653
5618
|
/******/ !function() {
|
|
6654
5619
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
@@ -6701,15 +5666,6 @@ module.exports = Url;
|
|
|
6701
5666
|
/******/ };
|
|
6702
5667
|
/******/ }();
|
|
6703
5668
|
/******/
|
|
6704
|
-
/******/ /* webpack/runtime/node module decorator */
|
|
6705
|
-
/******/ !function() {
|
|
6706
|
-
/******/ __webpack_require__.nmd = function(module) {
|
|
6707
|
-
/******/ module.paths = [];
|
|
6708
|
-
/******/ if (!module.children) module.children = [];
|
|
6709
|
-
/******/ return module;
|
|
6710
|
-
/******/ };
|
|
6711
|
-
/******/ }();
|
|
6712
|
-
/******/
|
|
6713
5669
|
/************************************************************************/
|
|
6714
5670
|
var __webpack_exports__ = {};
|
|
6715
5671
|
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|