@m2c2kit/build-helpers 0.3.16 → 0.3.18
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/dist/index.js +74 -54
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5310,6 +5310,20 @@ for (let i = 0; i < chars$1.length; i++) {
|
|
|
5310
5310
|
intToChar[i] = c;
|
|
5311
5311
|
charToInt[c] = i;
|
|
5312
5312
|
}
|
|
5313
|
+
function encodeInteger(builder, num, relative) {
|
|
5314
|
+
let delta = num - relative;
|
|
5315
|
+
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
|
|
5316
|
+
do {
|
|
5317
|
+
let clamped = delta & 0b011111;
|
|
5318
|
+
delta >>>= 5;
|
|
5319
|
+
if (delta > 0)
|
|
5320
|
+
clamped |= 0b100000;
|
|
5321
|
+
builder.write(intToChar[clamped]);
|
|
5322
|
+
} while (delta > 0);
|
|
5323
|
+
return num;
|
|
5324
|
+
}
|
|
5325
|
+
|
|
5326
|
+
const bufLength = 1024 * 16;
|
|
5313
5327
|
// Provide a fallback for older environments.
|
|
5314
5328
|
const td = typeof TextDecoder !== 'undefined'
|
|
5315
5329
|
? /* #__PURE__ */ new TextDecoder()
|
|
@@ -5329,63 +5343,54 @@ const td = typeof TextDecoder !== 'undefined'
|
|
|
5329
5343
|
return out;
|
|
5330
5344
|
},
|
|
5331
5345
|
};
|
|
5346
|
+
class StringWriter {
|
|
5347
|
+
constructor() {
|
|
5348
|
+
this.pos = 0;
|
|
5349
|
+
this.out = '';
|
|
5350
|
+
this.buffer = new Uint8Array(bufLength);
|
|
5351
|
+
}
|
|
5352
|
+
write(v) {
|
|
5353
|
+
const { buffer } = this;
|
|
5354
|
+
buffer[this.pos++] = v;
|
|
5355
|
+
if (this.pos === bufLength) {
|
|
5356
|
+
this.out += td.decode(buffer);
|
|
5357
|
+
this.pos = 0;
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
flush() {
|
|
5361
|
+
const { buffer, out, pos } = this;
|
|
5362
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
5363
|
+
}
|
|
5364
|
+
}
|
|
5332
5365
|
function encode(decoded) {
|
|
5333
|
-
const
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
let pos = 0;
|
|
5339
|
-
let out = '';
|
|
5366
|
+
const writer = new StringWriter();
|
|
5367
|
+
let sourcesIndex = 0;
|
|
5368
|
+
let sourceLine = 0;
|
|
5369
|
+
let sourceColumn = 0;
|
|
5370
|
+
let namesIndex = 0;
|
|
5340
5371
|
for (let i = 0; i < decoded.length; i++) {
|
|
5341
5372
|
const line = decoded[i];
|
|
5342
|
-
if (i > 0)
|
|
5343
|
-
|
|
5344
|
-
out += td.decode(buf);
|
|
5345
|
-
pos = 0;
|
|
5346
|
-
}
|
|
5347
|
-
buf[pos++] = semicolon;
|
|
5348
|
-
}
|
|
5373
|
+
if (i > 0)
|
|
5374
|
+
writer.write(semicolon);
|
|
5349
5375
|
if (line.length === 0)
|
|
5350
5376
|
continue;
|
|
5351
|
-
|
|
5377
|
+
let genColumn = 0;
|
|
5352
5378
|
for (let j = 0; j < line.length; j++) {
|
|
5353
5379
|
const segment = line[j];
|
|
5354
|
-
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
|
5355
|
-
// may push a comma.
|
|
5356
|
-
if (pos > subLength) {
|
|
5357
|
-
out += td.decode(sub);
|
|
5358
|
-
buf.copyWithin(0, subLength, pos);
|
|
5359
|
-
pos -= subLength;
|
|
5360
|
-
}
|
|
5361
5380
|
if (j > 0)
|
|
5362
|
-
|
|
5363
|
-
|
|
5381
|
+
writer.write(comma);
|
|
5382
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
5364
5383
|
if (segment.length === 1)
|
|
5365
5384
|
continue;
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5385
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
5386
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
5387
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
5369
5388
|
if (segment.length === 4)
|
|
5370
5389
|
continue;
|
|
5371
|
-
|
|
5390
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
5372
5391
|
}
|
|
5373
5392
|
}
|
|
5374
|
-
return
|
|
5375
|
-
}
|
|
5376
|
-
function encodeInteger(buf, pos, state, segment, j) {
|
|
5377
|
-
const next = segment[j];
|
|
5378
|
-
let num = next - state[j];
|
|
5379
|
-
state[j] = next;
|
|
5380
|
-
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
5381
|
-
do {
|
|
5382
|
-
let clamped = num & 0b011111;
|
|
5383
|
-
num >>>= 5;
|
|
5384
|
-
if (num > 0)
|
|
5385
|
-
clamped |= 0b100000;
|
|
5386
|
-
buf[pos++] = intToChar[clamped];
|
|
5387
|
-
} while (num > 0);
|
|
5388
|
-
return pos;
|
|
5393
|
+
return writer.flush();
|
|
5389
5394
|
}
|
|
5390
5395
|
|
|
5391
5396
|
class BitSet {
|
|
@@ -6143,8 +6148,10 @@ class MagicString {
|
|
|
6143
6148
|
update(start, end, content, options) {
|
|
6144
6149
|
if (typeof content !== 'string') throw new TypeError('replacement content must be a string');
|
|
6145
6150
|
|
|
6146
|
-
|
|
6147
|
-
|
|
6151
|
+
if (this.original.length !== 0) {
|
|
6152
|
+
while (start < 0) start += this.original.length;
|
|
6153
|
+
while (end < 0) end += this.original.length;
|
|
6154
|
+
}
|
|
6148
6155
|
|
|
6149
6156
|
if (end > this.original.length) throw new Error('end is out of bounds');
|
|
6150
6157
|
if (start === end)
|
|
@@ -6240,8 +6247,10 @@ class MagicString {
|
|
|
6240
6247
|
}
|
|
6241
6248
|
|
|
6242
6249
|
remove(start, end) {
|
|
6243
|
-
|
|
6244
|
-
|
|
6250
|
+
if (this.original.length !== 0) {
|
|
6251
|
+
while (start < 0) start += this.original.length;
|
|
6252
|
+
while (end < 0) end += this.original.length;
|
|
6253
|
+
}
|
|
6245
6254
|
|
|
6246
6255
|
if (start === end) return this;
|
|
6247
6256
|
|
|
@@ -6264,8 +6273,10 @@ class MagicString {
|
|
|
6264
6273
|
}
|
|
6265
6274
|
|
|
6266
6275
|
reset(start, end) {
|
|
6267
|
-
|
|
6268
|
-
|
|
6276
|
+
if (this.original.length !== 0) {
|
|
6277
|
+
while (start < 0) start += this.original.length;
|
|
6278
|
+
while (end < 0) end += this.original.length;
|
|
6279
|
+
}
|
|
6269
6280
|
|
|
6270
6281
|
if (start === end) return this;
|
|
6271
6282
|
|
|
@@ -6327,8 +6338,10 @@ class MagicString {
|
|
|
6327
6338
|
}
|
|
6328
6339
|
|
|
6329
6340
|
slice(start = 0, end = this.original.length) {
|
|
6330
|
-
|
|
6331
|
-
|
|
6341
|
+
if (this.original.length !== 0) {
|
|
6342
|
+
while (start < 0) start += this.original.length;
|
|
6343
|
+
while (end < 0) end += this.original.length;
|
|
6344
|
+
}
|
|
6332
6345
|
|
|
6333
6346
|
let result = '';
|
|
6334
6347
|
|
|
@@ -7049,7 +7062,7 @@ var concatty = function concatty(a, b) {
|
|
|
7049
7062
|
|
|
7050
7063
|
var slicy = function slicy(arrLike, offset) {
|
|
7051
7064
|
var arr = [];
|
|
7052
|
-
for (var i = offset
|
|
7065
|
+
for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
7053
7066
|
arr[j] = arrLike[i];
|
|
7054
7067
|
}
|
|
7055
7068
|
return arr;
|
|
@@ -14519,7 +14532,12 @@ const util = require$$0$1;
|
|
|
14519
14532
|
const braces = braces_1;
|
|
14520
14533
|
const picomatch = picomatch$1;
|
|
14521
14534
|
const utils$b = utils$f;
|
|
14522
|
-
|
|
14535
|
+
|
|
14536
|
+
const isEmptyString = v => v === '' || v === './';
|
|
14537
|
+
const hasBraces = v => {
|
|
14538
|
+
const index = v.indexOf('{');
|
|
14539
|
+
return index > -1 && v.indexOf('}', index) > -1;
|
|
14540
|
+
};
|
|
14523
14541
|
|
|
14524
14542
|
/**
|
|
14525
14543
|
* Returns an array of strings that match one or more glob patterns.
|
|
@@ -14960,7 +14978,7 @@ micromatch$1.parse = (patterns, options) => {
|
|
|
14960
14978
|
|
|
14961
14979
|
micromatch$1.braces = (pattern, options) => {
|
|
14962
14980
|
if (typeof pattern !== 'string') throw new TypeError('Expected a string');
|
|
14963
|
-
if ((options && options.nobrace === true) ||
|
|
14981
|
+
if ((options && options.nobrace === true) || !hasBraces(pattern)) {
|
|
14964
14982
|
return [pattern];
|
|
14965
14983
|
}
|
|
14966
14984
|
return braces(pattern, options);
|
|
@@ -14979,6 +14997,8 @@ micromatch$1.braceExpand = (pattern, options) => {
|
|
|
14979
14997
|
* Expose micromatch
|
|
14980
14998
|
*/
|
|
14981
14999
|
|
|
15000
|
+
// exposed for tests
|
|
15001
|
+
micromatch$1.hasBraces = hasBraces;
|
|
14982
15002
|
var micromatch_1 = micromatch$1;
|
|
14983
15003
|
|
|
14984
15004
|
var micromatch$2 = /*@__PURE__*/getDefaultExportFromCjs(micromatch_1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m2c2kit/build-helpers",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"description": "Utility functions for building m2c2kit apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"@types/semver": "7.5.8",
|
|
24
24
|
"cpy": "10.1.0",
|
|
25
25
|
"findup-sync": "5.0.0",
|
|
26
|
-
"magic-string": "0.30.
|
|
26
|
+
"magic-string": "0.30.11",
|
|
27
27
|
"rimraf": "6.0.1",
|
|
28
|
-
"rollup": "4.
|
|
28
|
+
"rollup": "4.21.2",
|
|
29
29
|
"rollup-plugin-copy": "3.5.0",
|
|
30
30
|
"rollup-plugin-dts": "6.1.1",
|
|
31
31
|
"rollup-plugin-esbuild": "6.1.1",
|
|
32
32
|
"semver": "7.6.3",
|
|
33
|
-
"typescript": "5.5.
|
|
33
|
+
"typescript": "5.5.4"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "npm run clean && tsc && rollup -c",
|