@r_masseater/vite-plus-adopt 0.27.6 → 0.28.1

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 CHANGED
@@ -40,19 +40,12 @@ export default defineConfig({
40
40
  });
41
41
  ```
42
42
 
43
- `import type {} from "@r_masseater/vite-plus-adopt"` types the keys vpa reads (`commitlint`, `dependencyRules`, `fallow`, `h56m`, `skills`, `textlint` and `tools`) on `defineConfig`.
43
+ `import type {} from "@r_masseater/vite-plus-adopt"` types the keys vpa reads (`commitlint`, `dependencyRules`, `fallow`, `gitHooks`, `h56m`, `skills`, `textlint` and `tools`) on `defineConfig`.
44
44
  textlint checks the Markdown files Git tracks. To check other files too, list their globs (`files`) and the settings for them in `textlint.sources`. `presets` work there as well.
45
45
  `filterModules` takes textlint filter rules as modules, such as `{ comments: commentsFilter }`, and `filters: { comments: true }` turns one on, so the repository does not have to install them for textlint to find them. With `reportUnusedDirectives: true`, a `textlint-disable` comment that hides no message is an error. The check lints a file with a disable comment a second time without the filters.
46
46
  `pluginModules` takes textlint plugins as modules in the same way, and `plugins: { name: true }` turns one on. A plugin given this way parses its extensions before the built-in Markdown and text plugins do.
47
47
 
48
- Write the Git hooks like this.
49
-
50
- ```sh
51
- # .vite-hooks/pre-commit
52
- vpa --staged
53
- # .vite-hooks/commit-msg
54
- vpa --commit-msg "$1"
55
- ```
48
+ List the commands of each Git hook in `gitHooks`, such as `{ "pre-push": ["vpa --pre-push", "vp run verify"] }`, and `vpa --prepare` writes them to `.vite-hooks/` and keeps them out of Git. `vpa --pre-push` merges new commits of the default branch and the pushed branch from `origin` and stops the push, so the next push sends the merged tree.
56
49
 
57
50
  ## Agent skills
58
51
 
package/dist/attw.d.mts CHANGED
@@ -218,5 +218,4 @@ interface CheckPackageOptions {
218
218
  entrypointsLegacy?: boolean;
219
219
  }
220
220
  export declare function checkPackage(pkg: Package, options?: CheckPackageOptions): Promise<CheckResult>;
221
- export type { Analysis, AnalysisTypes, BuildTool, CJSOnlyExportsDefaultProblem, CJSResolvesToESMProblem, CheckPackageOptions, CheckResult, CreatePackageFromNpmOptions, EntrypointInfo, EntrypointResolutionAnalysis, EntrypointResolutionProblem, Failable, FallbackConditionProblem, FalseCJSProblem, FalseESMProblem, FalseExportDefaultProblem, FilePairProblem, FileTextRangeProblem, IncludedTypes, InternalResolutionErrorProblem, MissingExportEqualsProblem, ModuleKind, ModuleKindPairProblem, ModuleKindReason, NamedExportsProblem, NoResolutionProblem, ParsedPackageSpec, Problem, ProblemKind, ProgramInfo, Resolution, ResolutionKind, ResolutionOption, ResolvedPackageId, TypesPackage, UnexpectedModuleSyntaxProblem, UntypedResolutionProblem, UntypedResult };
222
- //# sourceMappingURL=attw.d.mts.map
221
+ export type { Analysis, AnalysisTypes, BuildTool, CJSOnlyExportsDefaultProblem, CJSResolvesToESMProblem, CheckPackageOptions, CheckResult, CreatePackageFromNpmOptions, EntrypointInfo, EntrypointResolutionAnalysis, EntrypointResolutionProblem, Failable, FallbackConditionProblem, FalseCJSProblem, FalseESMProblem, FalseExportDefaultProblem, FilePairProblem, FileTextRangeProblem, IncludedTypes, InternalResolutionErrorProblem, MissingExportEqualsProblem, ModuleKind, ModuleKindPairProblem, ModuleKindReason, NamedExportsProblem, NoResolutionProblem, ParsedPackageSpec, Problem, ProblemKind, ProgramInfo, Resolution, ResolutionKind, ResolutionOption, ResolvedPackageId, TypesPackage, UnexpectedModuleSyntaxProblem, UntypedResolutionProblem, UntypedResult };
package/dist/attw.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import { t as parseJson } from "./json-QtVKpodH.mjs";
2
- import { Array as Array$1, Function, MutableRef, Option, Order, Predicate, Record, String as String$1, pipe } from "effect";
1
+ import { untar } from "@andrewbranch/untar.js";
2
+ import { FlateErrorCode, Gunzip } from "fflate";
3
3
  import semver, { major, maxSatisfying, minor, valid, validRange } from "semver";
4
- import { init, parse } from "cjs-module-lexer";
5
- import { InternalSymbolName, ModifierFlags, NodeFlags, ScriptKind, ScriptTarget, SyntaxKind, escapeLeadingUnderscores, getNameOfDeclaration } from "tsrs/ast";
4
+ import { InternalSymbolName, ModifierFlags, NodeFlags, ScriptKind, ScriptTarget, SyntaxKind, escapeLeadingUnderscores as escapeLeadingUnderscores$1, getNameOfDeclaration } from "tsrs/ast";
6
5
  import { API, ModuleKind, ModuleResolutionKind, ObjectFlags, SignatureKind, SymbolFlags, TypeFlags, isObjectType } from "tsrs/sync";
6
+ import { Array as Array$1, Function, MutableRef, Option, Order, Predicate, Record, String as String$1, pipe } from "effect";
7
7
  import { isArrayBindingPattern, isArrayLiteralExpression, isArrowFunction, isBinaryExpression, isBindingElement, isBlock, isCallExpression, isCatchClause, isClassDeclaration, isClassExpression, isElementAccessExpression, isEnumDeclaration, isExportAssignment, isExportDeclaration, isExportSpecifier, isExpression, isExpressionStatement, isForInStatement, isFunctionDeclaration, isFunctionExpression, isIdentifier, isImportAttributes, isImportClause, isImportDeclaration, isImportEqualsDeclaration, isImportSpecifier, isImportTypeNode, isInterfaceDeclaration, isJSDoc, isJSDocCallbackTag, isJSDocImportTag, isJSDocTypedefTag, isModuleBlock, isModuleDeclaration, isNamedExports, isNamespaceExport, isNamespaceImport, isNumericLiteral, isObjectBindingPattern, isObjectLiteralExpression, isParameterDeclaration, isParenthesizedExpression, isPrefixUnaryExpression, isPropertyAccessExpression, isPropertyAssignment, isReturnStatement, isShorthandPropertyAssignment, isSourceFile, isStringLiteral, isStringLiteralLikeNode, isTypeAliasDeclaration, isVariableDeclaration, isVariableDeclarationList, isVariableStatement, isVoidExpression } from "tsrs/ast/is";
8
8
  import { serverFS } from "tsrs/fs";
9
- import { untar } from "@andrewbranch/untar.js";
10
- import { FlateErrorCode, Gunzip } from "fflate";
11
9
  import validatePackgeName from "validate-npm-package-name";
10
+ import { init, parse } from "cjs-module-lexer";
12
11
  import * as cjs from "@loaderkit/resolve/cjs";
13
12
  import * as esm from "@loaderkit/resolve/esm";
13
+ import { t as parseJson } from "./json-8aM4ydOI.mjs";
14
14
  // src/shared/lib/typescript/binder-symbol-table.ts
15
15
  var SymbolTable = class {
16
16
  #entries = /* @__PURE__ */ new Map();
@@ -99,7 +99,7 @@ const unescapeLeadingUnderscores = (name) => {
99
99
  if (String$1.startsWith(TRIPLE_UNDERSCORE)(name)) return String$1.slice(1)(name);
100
100
  return name;
101
101
  };
102
- const escapeLeadingUnderscores$1 = (name) => {
102
+ const escapeLeadingUnderscores = (name) => {
103
103
  if (String$1.startsWith(DOUBLE_UNDERSCORE)(name)) return `${UNDERSCORE}${name}`;
104
104
  return name;
105
105
  };
@@ -232,8 +232,8 @@ const nameText = (node) => {
232
232
  return Option.none();
233
233
  };
234
234
  const getElementOrPropertyAccessName = (node) => {
235
- if (isPropertyAccessExpression(node)) return nameText(node.name).pipe(Option.map(escapeLeadingUnderscores$1));
236
- return Option.liftPredicate(skipParentheses(node.argumentExpression), isStringOrNumericLiteralLike).pipe(Option.map((literal) => escapeLeadingUnderscores$1(literal.text)));
235
+ if (isPropertyAccessExpression(node)) return nameText(node.name).pipe(Option.map(escapeLeadingUnderscores));
236
+ return Option.liftPredicate(skipParentheses(node.argumentExpression), isStringOrNumericLiteralLike).pipe(Option.map((literal) => escapeLeadingUnderscores(literal.text)));
237
237
  };
238
238
  const isNamedIdentifier = Function.dual(DATA_FIRST_ARITY$33, (node, name) => isIdentifier(node) && node.text === name);
239
239
  const isExportsIdentifier = (node) => isIdentifier(node) && node.text === "exports";
@@ -392,7 +392,7 @@ const ambientModuleName = (name) => {
392
392
  const nameOfNamedDeclaration = (node, name) => {
393
393
  if (isAmbientModule(node)) return Option.some(ambientModuleName(name));
394
394
  if (isAccessExpression(name)) return getElementOrPropertyAccessName(name);
395
- return Option.map(nameText(name), escapeLeadingUnderscores$1);
395
+ return Option.map(nameText(name), escapeLeadingUnderscores);
396
396
  };
397
397
  const unnamedDeclarationName = (node) => {
398
398
  if (node.kind === SyntaxKind.ExportDeclaration) return Option.some("__export");
@@ -904,7 +904,7 @@ const createFileSymbol = (binding) => {
904
904
  const lookupSymbolForName = Function.dual(DATA_FIRST_ARITY$26, (binding, name) => {
905
905
  return Option.fromNullishOr(binding.locals.entries.get(name)).pipe(Option.map((found) => found.exportSymbol ?? found)).pipe(Option.orElse(() => Option.fromNullishOr(binding.symbol).pipe(Option.flatMap((file) => exportOf(file, name)))));
906
906
  });
907
- const lookupIdentifier = Function.dual(DATA_FIRST_ARITY$26, (binding, node) => Option.flatMap(Option.liftPredicate(node, isIdentifier), (identifier) => lookupSymbolForName(binding, escapeLeadingUnderscores$1(identifier.text))));
907
+ const lookupIdentifier = Function.dual(DATA_FIRST_ARITY$26, (binding, node) => Option.flatMap(Option.liftPredicate(node, isIdentifier), (identifier) => lookupSymbolForName(binding, escapeLeadingUnderscores(identifier.text))));
908
908
  const variableInitializer = Function.dual(DATA_FIRST_ARITY$26, (binding, node) => lookupIdentifier(binding, node).pipe(Option.flatMap((symbol) => Option.fromNullishOr(symbol.valueDeclaration)), Option.filter(isVariableDeclaration), Option.flatMap((declaration) => Option.fromNullishOr(declaration.initializer))));
909
909
  const aliasSources = (binding, node) => variableInitializer(binding, node).pipe(Option.map((initializer) => Option.match(Option.liftPredicate(initializer, isAssignmentExpression), {
910
910
  onNone: () => [initializer],
@@ -2045,7 +2045,7 @@ var _attw_typescript_default = {
2045
2045
  SymbolFlags,
2046
2046
  SyntaxKind,
2047
2047
  TypeFlags,
2048
- escapeLeadingUnderscores: escapeLeadingUnderscores$1,
2048
+ escapeLeadingUnderscores,
2049
2049
  hasSyntacticModifier,
2050
2050
  unescapeLeadingUnderscores,
2051
2051
  version: RESOLUTION_VERSION
@@ -3033,7 +3033,7 @@ const nameNode = (declaration) => Option.liftPredicate(declaration, isNameable).
3033
3033
  const missingSymbol = (symbol) => /* @__PURE__ */ new Error(`TypeScript has no symbol for ${symbol.name}`);
3034
3034
  const fromSourceFile = (session, file, symbol) => Option.fromNullishOr(session.checker.getSymbolOfSourceFile(`${session.mountPath}${file.fileName}`)).pipe(Option.getOrThrowWith(() => missingSymbol(symbol)));
3035
3035
  const isFileSymbol = (symbol) => firstDeclaration(symbol).pipe(Option.exists((declaration) => isSourceFile(declaration)));
3036
- const fromParentExports = (session, symbol, convert) => Option.fromNullishOr(symbol.parent).pipe(Option.filter((parent) => isFileSymbol(parent)), Option.flatMap((parent) => Option.fromNullishOr(convert(session, parent).getExports().get(escapeLeadingUnderscores(symbol.name)))));
3036
+ const fromParentExports = (session, symbol, convert) => Option.fromNullishOr(symbol.parent).pipe(Option.filter((parent) => isFileSymbol(parent)), Option.flatMap((parent) => Option.fromNullishOr(convert(session, parent).getExports().get(escapeLeadingUnderscores$1(symbol.name)))));
3037
3037
  const fromPosition = (session, declaration, symbol) => {
3038
3038
  const file = sourceFileOf(declaration);
3039
3039
  const found = session.checker.getSymbolAtPosition(`${session.mountPath}${file.fileName}`, nameNode(declaration).getStart(file));
@@ -3053,7 +3053,7 @@ const assignedIdentifier = (declaration) => {
3053
3053
  if (isExportAssignment(declaration)) return Option.liftPredicate(declaration.expression, (node) => isIdentifier(node));
3054
3054
  return Option.none();
3055
3055
  };
3056
- const localNamed = (identifier) => bindingOf(sourceFileOf(identifier)).pipe(Option.flatMap((binding) => Option.liftPredicate(identifier, (node) => isIdentifier(node)).pipe(Option.flatMap((node) => Option.fromNullishOr(binding.locals.entries.get(escapeLeadingUnderscores$1(node.text)))))));
3056
+ const localNamed = (identifier) => bindingOf(sourceFileOf(identifier)).pipe(Option.flatMap((binding) => Option.liftPredicate(identifier, (node) => isIdentifier(node)).pipe(Option.flatMap((node) => Option.fromNullishOr(binding.locals.entries.get(escapeLeadingUnderscores(node.text)))))));
3057
3057
  const boundExpandoExports = (moduleSymbol) => Option.fromNullishOr(moduleSymbol.exports).pipe(Option.flatMap((exports) => Option.fromNullishOr(exports.get(EXPORT_EQUALS))), Option.flatMap((exportEquals) => firstDeclaration(exportEquals)), Option.flatMap((declaration) => assignedIdentifier(declaration)), Option.flatMap((identifier) => localNamed(identifier)), Option.flatMap((local) => Option.fromNullishOr(local.exports)), Option.map((members) => pipe([...members.values()], Array$1.filter((member) => hasFlag(member.flags, SymbolFlags.Assignment)))), Option.getOrElse(() => []));
3058
3058
  // src/shared/lib/typescript/type-only.ts
3059
3059
  const isTypeOnlyImportClause = (node) => isImportClause(node) && node.phaseModifier === SyntaxKind.TypeKeyword;
@@ -3081,7 +3081,7 @@ const isAlias = (symbol) => hasFlag(symbol.flags, SymbolFlags.Alias);
3081
3081
  const isUnknownSymbol = (symbol) => symbol.name === UNKNOWN && symbol.declarations.length === NONE$1 && symbol.flags === SymbolFlags.Property;
3082
3082
  const resolveExternalModuleSymbol = (session, symbol) => {
3083
3083
  const moduleSymbol = toCheckerSymbol(session, symbol);
3084
- return Option.fromNullishOr(moduleSymbol.getExports().get(escapeLeadingUnderscores(EXPORT_EQUALS))).pipe(Option.map((exportEquals) => {
3084
+ return Option.fromNullishOr(moduleSymbol.getExports().get(escapeLeadingUnderscores$1(EXPORT_EQUALS))).pipe(Option.map((exportEquals) => {
3085
3085
  if (isAlias(exportEquals)) return session.checker.getAliasedSymbol(exportEquals);
3086
3086
  return exportEquals;
3087
3087
  }), Option.getOrElse(() => moduleSymbol));