vite-plus 0.1.24 → 0.2.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/LICENSE +30 -0
- package/README.md +8 -6
- package/bin/oxfmt +5 -2
- package/bin/oxlint +12 -2
- package/binding/index.cjs +84 -67
- package/binding/index.d.cts +155 -4
- package/dist/{agent-Nuk-9l77.js → agent-BD31CsvU.js} +941 -70
- package/dist/bin.js +22 -30
- package/dist/{compat-DXZgnEyq.js → compat-Cql3K40m.js} +1 -1
- package/dist/config/bin.js +30 -14
- package/dist/constants-CrfJQIUX.js +66 -0
- package/dist/create/bin.d.ts +6 -0
- package/dist/create/bin.js +508 -232
- package/dist/define-config-2tfJoXr1.d.ts +305 -0
- package/dist/define-config-BGSjF6Xp.cjs +488 -0
- package/dist/define-config-DJUehepE.js +445 -0
- package/dist/define-config.cjs +8 -1
- package/dist/define-config.d.ts +2 -2
- package/dist/define-config.js +2 -2
- package/dist/dist-DRJUd9bL.js +3 -0
- package/dist/{dist-BgQuvbtq.js → dist-Oxo16Y0q.js} +4 -4
- package/dist/index.cjs +9 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{main-DpJl3LoU.js → json-Dn87fvjk.js} +137 -1
- package/dist/migration/bin.js +292 -76
- package/dist/{oxlint-plugin-config-B89iKTKN.js → oxlint-plugin-config-q8a5PFch.js} +1 -1
- package/dist/oxlint-plugin.js +11 -3
- package/dist/pack-bin.js +44 -15
- package/dist/{package-PmBUZ-ve.js → package-BHirM1_v.js} +3 -138
- package/dist/{report-DgSBQUdz.js → report-BHSkWqRR.js} +2 -0
- package/dist/{resolve-vite-config-TTvhycU1.js → resolve-vite-config-CmdsfQzS.js} +13 -4
- package/dist/staged/bin.js +3 -3
- package/dist/test/_at-vitest-browser/context.d.ts +2 -0
- package/dist/test/_at-vitest-browser.d.ts +2 -0
- package/dist/test/browser/context.d.ts +2 -2
- package/dist/test/browser/context.js +1 -1
- package/dist/test/browser/providers/playwright/context.d.ts +1 -0
- package/dist/test/browser/providers/playwright/context.js +1 -0
- package/dist/test/browser/providers/playwright.d.ts +124 -2
- package/dist/test/browser/providers/playwright.js +1 -1
- package/dist/test/browser/providers/preview/context.d.ts +1 -0
- package/dist/test/browser/providers/preview/context.js +1 -0
- package/dist/test/browser/providers/preview.d.ts +32 -2
- package/dist/test/browser/providers/preview.js +1 -1
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -0
- package/dist/test/browser/providers/webdriverio/context.js +1 -0
- package/dist/test/browser/providers/webdriverio.d.ts +77 -2
- package/dist/test/browser/providers/webdriverio.js +1 -1
- package/dist/test/browser-compat.d.ts +2 -0
- package/dist/test/browser-compat.js +1 -1
- package/dist/test/browser-playwright/context.d.ts +1 -0
- package/dist/test/browser-playwright/context.js +1 -0
- package/dist/test/browser-playwright.d.ts +124 -2
- package/dist/test/browser-playwright.js +1 -1
- package/dist/test/browser-preview/context.d.ts +1 -0
- package/dist/test/browser-preview/context.js +1 -0
- package/dist/test/browser-preview.d.ts +32 -2
- package/dist/test/browser-preview.js +1 -1
- package/dist/test/browser-webdriverio/context.d.ts +1 -0
- package/dist/test/browser-webdriverio/context.js +1 -0
- package/dist/test/browser-webdriverio.d.ts +77 -2
- package/dist/test/browser-webdriverio.js +1 -1
- package/dist/test/browser.d.ts +2 -2
- package/dist/test/browser.js +1 -1
- package/dist/test/client.js +1 -1
- package/dist/test/config.cjs +1 -1
- package/dist/test/config.d.ts +2 -2
- package/dist/test/config.js +1 -1
- package/dist/test/context.d.ts +942 -2
- package/dist/test/context.js +1 -1
- package/dist/test/coverage.d.ts +2 -2
- package/dist/test/coverage.js +1 -1
- package/dist/test/environments.d.ts +2 -2
- package/dist/test/environments.js +1 -1
- package/dist/test/globals.d.ts +2 -2
- package/dist/test/import-meta.d.ts +2 -2
- package/dist/test/importMeta.d.ts +2 -2
- package/dist/test/index.cjs +1 -1
- package/dist/test/index.d.cts +2 -2
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.js +1 -1
- package/dist/test/internal/browser.d.ts +2 -2
- package/dist/test/internal/browser.js +1 -1
- package/dist/test/jsdom.d.ts +2 -2
- package/dist/test/locators.d.ts +294 -0
- package/dist/test/locators.js +1 -1
- package/dist/test/matchers.d.ts +29 -0
- package/dist/test/matchers.js +1 -1
- package/dist/test/node.d.ts +2 -2
- package/dist/test/node.js +1 -1
- package/dist/test/optional-runtime-types.js.d.ts +2 -2
- package/dist/test/optional-types.js.d.ts +2 -2
- package/dist/test/plugins/browser-client.js +1 -1
- package/dist/test/plugins/browser-context.js +1 -1
- package/dist/test/plugins/browser-locators.js +1 -1
- package/dist/test/plugins/browser-playwright.js +1 -1
- package/dist/test/plugins/browser-preview.js +1 -1
- package/dist/test/plugins/browser-webdriverio.js +1 -1
- package/dist/test/plugins/browser.js +1 -1
- package/dist/test/plugins/expect.js +1 -1
- package/dist/test/plugins/mocker-automock.js +1 -1
- package/dist/test/plugins/mocker-browser.js +1 -1
- package/dist/test/plugins/mocker-node.js +1 -1
- package/dist/test/plugins/mocker-redirect.js +1 -1
- package/dist/test/plugins/mocker-register.js +1 -1
- package/dist/test/plugins/mocker-transforms.js +1 -1
- package/dist/test/plugins/mocker.js +1 -1
- package/dist/test/plugins/pretty-format.js +1 -1
- package/dist/test/plugins/runner-types.js +1 -1
- package/dist/test/plugins/runner-utils.js +1 -1
- package/dist/test/plugins/runner.js +1 -1
- package/dist/test/plugins/snapshot-environment.js +1 -1
- package/dist/test/plugins/snapshot-manager.js +1 -1
- package/dist/test/plugins/snapshot.js +1 -1
- package/dist/test/plugins/spy.js +1 -1
- package/dist/test/plugins/utils-constants.js +1 -1
- package/dist/test/plugins/utils-diff.js +1 -1
- package/dist/test/plugins/utils-display.js +1 -1
- package/dist/test/plugins/utils-error.js +1 -1
- package/dist/test/plugins/utils-helpers.js +1 -1
- package/dist/test/plugins/utils-offset.js +1 -1
- package/dist/test/plugins/utils-resolver.js +1 -1
- package/dist/test/plugins/utils-serialize.js +1 -1
- package/dist/test/plugins/utils-source-map-node.js +1 -1
- package/dist/test/plugins/utils-source-map.js +1 -1
- package/dist/test/plugins/utils-timers.js +1 -1
- package/dist/test/plugins/utils.js +1 -1
- package/dist/test/reporters.d.ts +2 -2
- package/dist/test/reporters.js +1 -1
- package/dist/test/runners.d.ts +2 -2
- package/dist/test/runners.js +1 -1
- package/dist/test/runtime.d.ts +2 -2
- package/dist/test/runtime.js +1 -1
- package/dist/test/snapshot.d.ts +2 -2
- package/dist/test/snapshot.js +1 -1
- package/dist/test/suite.d.ts +2 -2
- package/dist/test/suite.js +1 -1
- package/dist/test/utils.js +1 -1
- package/dist/test/worker.d.ts +2 -2
- package/dist/test/worker.js +1 -1
- package/dist/{tsconfig-DFb5BKyT.js → tsconfig-CJ_StdFc.js} +563 -229
- package/dist/tsgolint-path-B-yOos8p.js +32 -0
- package/dist/tsgolint-path.d.ts +8 -0
- package/dist/tsgolint-path.js +2 -0
- package/dist/version.js +3 -3
- package/dist/versions.d.ts +1 -1
- package/dist/versions.js +6 -6
- package/dist/{workspace-NL-m9wgM.js → workspace-Cjoc1c_A.js} +11 -9
- package/docs/_data/team.ts +2 -1
- package/docs/config/create.md +36 -1
- package/docs/config/index.md +7 -5
- package/docs/guide/commit-hooks.md +9 -0
- package/docs/guide/create.md +106 -2
- package/docs/guide/env.md +33 -5
- package/docs/guide/index.md +5 -3
- package/docs/guide/install.md +31 -12
- package/docs/guide/migrate.md +13 -3
- package/docs/guide/troubleshooting.md +2 -2
- package/docs/guide/upgrade.md +26 -7
- package/docs/package.json +3 -3
- package/docs/pnpm-lock.yaml +298 -395
- package/package.json +103 -55
- package/templates/generator/bin/index.ts +6 -3
- package/templates/generator/package.json +2 -3
- package/templates/generator/src/template.ts +0 -2
- package/templates/monorepo/package.json +1 -1
- package/dist/constants-DCBWlNrn.js +0 -33
- package/dist/define-config-BR1Y88zz.cjs +0 -84
- package/dist/define-config-BRC7qPNE.js +0 -21
- package/dist/define-config-COdn-tsn.d.ts +0 -177
- package/dist/dist-Bapm49IR.js +0 -3
- package/dist/test/plugins/utils-highlight.js +0 -1
- /package/dist/{chunk-DnnnRqeS.js → rolldown-runtime-DnnnRqeS.js} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
2
3
|
/**
|
|
3
4
|
* Creates a JSON scanner on the given text.
|
|
@@ -1223,4 +1224,139 @@ function applyEdits(text, edits) {
|
|
|
1223
1224
|
return text;
|
|
1224
1225
|
}
|
|
1225
1226
|
//#endregion
|
|
1226
|
-
|
|
1227
|
+
//#region ../../node_modules/.pnpm/detect-indent@7.0.2/node_modules/detect-indent/index.js
|
|
1228
|
+
const INDENT_REGEX = /^(?:( )+|\t+)/;
|
|
1229
|
+
const INDENT_TYPE_SPACE = "space";
|
|
1230
|
+
const INDENT_TYPE_TAB = "tab";
|
|
1231
|
+
function shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, value) {
|
|
1232
|
+
return ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && value === 1;
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
Make a Map that counts how many indents/unindents have occurred for a given size and how many lines follow a given indentation.
|
|
1236
|
+
|
|
1237
|
+
The key is a concatenation of the indentation type (s = space and t = tab) and the size of the indents/unindents.
|
|
1238
|
+
|
|
1239
|
+
```
|
|
1240
|
+
indents = {
|
|
1241
|
+
t3: [1, 0],
|
|
1242
|
+
t4: [1, 5],
|
|
1243
|
+
s5: [1, 0],
|
|
1244
|
+
s12: [1, 0],
|
|
1245
|
+
}
|
|
1246
|
+
```
|
|
1247
|
+
*/
|
|
1248
|
+
function makeIndentsMap(string, ignoreSingleSpaces) {
|
|
1249
|
+
const indents = /* @__PURE__ */ new Map();
|
|
1250
|
+
let previousSize = 0;
|
|
1251
|
+
let previousIndentType;
|
|
1252
|
+
let key;
|
|
1253
|
+
for (const line of string.split(/\n/g)) {
|
|
1254
|
+
if (!line) continue;
|
|
1255
|
+
const matches = line.match(INDENT_REGEX);
|
|
1256
|
+
if (matches === null) {
|
|
1257
|
+
previousSize = 0;
|
|
1258
|
+
previousIndentType = "";
|
|
1259
|
+
} else {
|
|
1260
|
+
const indent = matches[0].length;
|
|
1261
|
+
const indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
1262
|
+
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent)) continue;
|
|
1263
|
+
if (indentType !== previousIndentType) previousSize = 0;
|
|
1264
|
+
previousIndentType = indentType;
|
|
1265
|
+
let use = 1;
|
|
1266
|
+
let weight = 0;
|
|
1267
|
+
const indentDifference = indent - previousSize;
|
|
1268
|
+
previousSize = indent;
|
|
1269
|
+
if (indentDifference === 0) {
|
|
1270
|
+
use = 0;
|
|
1271
|
+
weight = 1;
|
|
1272
|
+
} else {
|
|
1273
|
+
const absoluteIndentDifference = Math.abs(indentDifference);
|
|
1274
|
+
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference)) continue;
|
|
1275
|
+
key = encodeIndentsKey(indentType, absoluteIndentDifference);
|
|
1276
|
+
}
|
|
1277
|
+
const entry = indents.get(key);
|
|
1278
|
+
indents.set(key, entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight]);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
return indents;
|
|
1282
|
+
}
|
|
1283
|
+
function encodeIndentsKey(indentType, indentAmount) {
|
|
1284
|
+
return (indentType === INDENT_TYPE_SPACE ? "s" : "t") + String(indentAmount);
|
|
1285
|
+
}
|
|
1286
|
+
function decodeIndentsKey(indentsKey) {
|
|
1287
|
+
return {
|
|
1288
|
+
type: indentsKey[0] === "s" ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB,
|
|
1289
|
+
amount: Number(indentsKey.slice(1))
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
function getMostUsedKey(indents) {
|
|
1293
|
+
let result;
|
|
1294
|
+
let maxUsed = 0;
|
|
1295
|
+
let maxWeight = 0;
|
|
1296
|
+
for (const [key, [usedCount, weight]] of indents) if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
|
|
1297
|
+
maxUsed = usedCount;
|
|
1298
|
+
maxWeight = weight;
|
|
1299
|
+
result = key;
|
|
1300
|
+
}
|
|
1301
|
+
return result;
|
|
1302
|
+
}
|
|
1303
|
+
function makeIndentString(type, amount) {
|
|
1304
|
+
return (type === INDENT_TYPE_SPACE ? " " : " ").repeat(amount);
|
|
1305
|
+
}
|
|
1306
|
+
function detectIndent(string) {
|
|
1307
|
+
if (typeof string !== "string") throw new TypeError("Expected a string");
|
|
1308
|
+
let indents = makeIndentsMap(string, true);
|
|
1309
|
+
if (indents.size === 0) indents = makeIndentsMap(string, false);
|
|
1310
|
+
const keyOfMostUsedIndent = getMostUsedKey(indents);
|
|
1311
|
+
let type;
|
|
1312
|
+
let amount = 0;
|
|
1313
|
+
let indent = "";
|
|
1314
|
+
if (keyOfMostUsedIndent !== void 0) {
|
|
1315
|
+
({type, amount} = decodeIndentsKey(keyOfMostUsedIndent));
|
|
1316
|
+
indent = makeIndentString(type, amount);
|
|
1317
|
+
}
|
|
1318
|
+
return {
|
|
1319
|
+
amount,
|
|
1320
|
+
type,
|
|
1321
|
+
indent
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
//#endregion
|
|
1325
|
+
//#region ../../node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
|
|
1326
|
+
function detectNewline(string) {
|
|
1327
|
+
if (typeof string !== "string") throw new TypeError("Expected a string");
|
|
1328
|
+
const newlines = string.match(/(?:\r?\n)/g) || [];
|
|
1329
|
+
if (newlines.length === 0) return;
|
|
1330
|
+
const crlf = newlines.filter((newline) => newline === "\r\n").length;
|
|
1331
|
+
return crlf > newlines.length - crlf ? "\r\n" : "\n";
|
|
1332
|
+
}
|
|
1333
|
+
//#endregion
|
|
1334
|
+
//#region src/utils/json.ts
|
|
1335
|
+
function readJsonFile(file, allowComments) {
|
|
1336
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
1337
|
+
return (allowComments ? parse : JSON.parse)(content);
|
|
1338
|
+
}
|
|
1339
|
+
function writeJsonFile(file, data) {
|
|
1340
|
+
let newline = "\n";
|
|
1341
|
+
let indent = " ";
|
|
1342
|
+
if (fs.existsSync(file)) {
|
|
1343
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
1344
|
+
indent = detectIndent(content).indent;
|
|
1345
|
+
newline = detectNewline(content) ?? "";
|
|
1346
|
+
}
|
|
1347
|
+
fs.writeFileSync(file, JSON.stringify(data, null, indent) + newline, "utf-8");
|
|
1348
|
+
}
|
|
1349
|
+
function editJsonFile(file, callback) {
|
|
1350
|
+
const newJson = callback(readJsonFile(file));
|
|
1351
|
+
if (newJson) writeJsonFile(file, newJson);
|
|
1352
|
+
}
|
|
1353
|
+
function isJsonFile(file) {
|
|
1354
|
+
try {
|
|
1355
|
+
readJsonFile(file);
|
|
1356
|
+
return true;
|
|
1357
|
+
} catch {
|
|
1358
|
+
return false;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
//#endregion
|
|
1362
|
+
export { applyEdits as a, writeJsonFile as i, isJsonFile as n, modify as o, readJsonFile as r, parse as s, editJsonFile as t };
|