@r_masseater/vite-plus-adopt 0.25.0 → 0.26.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
@@ -43,6 +43,7 @@ export default defineConfig({
43
43
  `import type {} from "@r_masseater/vite-plus-adopt"` types the keys vpa reads (`commitlint`, `dependencyRules`, `fallow`, `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
+ `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.
46
47
 
47
48
  Write the Git hooks like this.
48
49
 
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as stagedSecrets, c as runCi, d as checkPushedRefs, i as lintMessageText, l as version, r as lintMessageFile, s as prepare, t as runAllChecks } from "./run-checks-RwkrfT5c.mjs";
2
+ import { a as stagedSecrets, c as runCi, d as checkPushedRefs, i as lintMessageText, l as version, r as lintMessageFile, s as prepare, t as runAllChecks } from "./run-checks-BEJcAppP.mjs";
3
3
  import { Effect, Option, Path } from "effect";
4
4
  import { hookFlags } from "@r_masseater/masseater-utils/hook-flags";
5
5
  import { runMain } from "@r_masseater/masseater-utils/node-main";
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Effect, FileSystem, Path, PlatformError, Schema, Stdio } from "effect";
2
2
  import { ChildProcessSpawner } from "effect/process";
3
3
  import { TextlintRcConfig } from "@textlint/config-loader";
4
- import { TextlintKernelFilterRule, TextlintKernelRule } from "@textlint/kernel";
4
+ import { TextlintKernelFilterRule, TextlintKernelPlugin, TextlintKernelRule } from "@textlint/kernel";
5
5
  import { H56mConfig } from "@r_masseater/h56m";
6
6
  import { DependencySection } from "@r_masseater/masseater-utils/kestrion";
7
7
  import { UserConfig } from "@commitlint/types";
@@ -42,6 +42,7 @@ interface TextlintConfig extends TextlintRcConfig {
42
42
  readonly ignores?: readonly string[];
43
43
  readonly presets?: Readonly<Record<string, TextlintPreset>>;
44
44
  readonly filterModules?: Readonly<Record<string, TextlintKernelFilterRule["rule"]>>;
45
+ readonly pluginModules?: Readonly<Record<string, TextlintKernelPlugin["plugin"]>>;
45
46
  readonly reportUnusedDirectives?: boolean;
46
47
  readonly sources?: readonly TextlintSource[];
47
48
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { f as loadViteConfig, n as HOOKS, o as usage, p as VpToolsError, t as runAllChecks, u as findCiDrift } from "./run-checks-RwkrfT5c.mjs";
1
+ import { f as loadViteConfig, n as HOOKS, o as usage, p as VpToolsError, t as runAllChecks, u as findCiDrift } from "./run-checks-BEJcAppP.mjs";
2
2
  import { Array, Function, Option, Record, pipe } from "effect";
3
3
  /** @internal */
4
4
  const runVpa = Function.dual(2, (root, args) => pipe(args, Array.match({
@@ -180,13 +180,33 @@ const filterRulesOf = ({ config, wrap }) => {
180
180
  options: pipe(Record.get(settings, name), Option.filter(isRuleOptions), Option.getOrElse(() => true))
181
181
  })));
182
182
  };
183
+ const isNames = (plugins) => Array.isArray(plugins);
184
+ const pluginSettingsOf = (plugins) => {
185
+ if (isNames(plugins)) return Record.fromIterableWith(plugins, (name) => [name, true]);
186
+ return plugins;
187
+ };
188
+ /** @internal */
189
+ const pluginsOf = (config) => {
190
+ const settings = pluginSettingsOf(config.plugins ?? {});
191
+ return pipe(Record.toEntries(config.pluginModules ?? {}), Array.flatMap(([name, plugin]) => pipe(Record.get(settings, name), Option.filter(Boolean), Option.map((setting) => ({
192
+ pluginId: name,
193
+ plugin,
194
+ options: pipe(Option.liftPredicate(setting, Predicate.isReadonlyObject), Option.getOrElse(() => true))
195
+ })), Option.toArray)));
196
+ };
197
+ const withoutModules = (plugins, modules) => {
198
+ const isModule = (name) => Record.has(modules, name);
199
+ if (isNames(plugins)) return pipe(plugins, Array.filter((name) => !isModule(name)));
200
+ return pipe(plugins, Record.filter((_setting, name) => !isModule(name)));
201
+ };
183
202
  /** @internal */
184
203
  const rawConfigOf = (config) => {
185
- const { ignores: _ignores, presets = {}, filterModules = {}, reportUnusedDirectives: _report, sources: _sources, ...rawConfig } = config;
204
+ const { ignores: _ignores, presets = {}, filterModules = {}, pluginModules = {}, reportUnusedDirectives: _report, sources: _sources, ...rawConfig } = config;
186
205
  return {
187
206
  ...rawConfig,
188
207
  rules: pipe(rawConfig.rules ?? {}, Record.filter((_setting, name) => !Record.has(presets, name))),
189
- filters: pipe(rawConfig.filters ?? {}, Record.filter((_setting, name) => !Record.has(filterModules, name)))
208
+ filters: pipe(rawConfig.filters ?? {}, Record.filter((_setting, name) => !Record.has(filterModules, name))),
209
+ plugins: withoutModules(rawConfig.plugins ?? {}, pluginModules)
190
210
  };
191
211
  };
192
212
  // src/features/check-text/model/textlint-descriptor.ts
@@ -206,7 +226,11 @@ const descriptorOf = ({ root, config, wrap }) => Effect.gen(function* descriptor
206
226
  config,
207
227
  wrap
208
228
  })],
209
- plugins: [...builtIn.plugin.toKernelPluginsFormat(), ...plugins],
229
+ plugins: [
230
+ ...pluginsOf(config),
231
+ ...builtIn.plugin.toKernelPluginsFormat(),
232
+ ...plugins
233
+ ],
210
234
  configBaseDir: root
211
235
  });
212
236
  });
@@ -315,11 +339,12 @@ const mergeReports = (reports) => ({
315
339
  /** @internal */
316
340
  const textlintCheck = withSection("textlint", (config, { root }) => {
317
341
  const markdown = markdownFiles(root, config.ignores).pipe(Effect.flatMap((files) => lintTexts(config, root, files)));
318
- const { presets = {}, filterModules = {}, reportUnusedDirectives = false } = config;
342
+ const { presets = {}, filterModules = {}, pluginModules = {}, reportUnusedDirectives = false } = config;
319
343
  const sources = pipe(config.sources ?? [], Array.map(({ files, ...source }) => Effect.flatMap(sourceFiles(root, files), (listed) => lintTexts({
320
344
  ...source,
321
345
  presets,
322
346
  filterModules,
347
+ pluginModules,
323
348
  reportUnusedDirectives
324
349
  }, root, listed))));
325
350
  return Effect.all([markdown, ...sources], { concurrency: 1 }).pipe(Effect.map(mergeReports));
@@ -891,7 +916,7 @@ const syncCi = (root) => planned(root).pipe(Effect.flatMap(({ changes }) => Effe
891
916
  })));
892
917
  // package.json
893
918
  var name = "@r_masseater/vite-plus-adopt";
894
- var version = "0.25.0";
919
+ var version = "0.26.1";
895
920
  // src/features/sync-ci/model/installed-version.ts
896
921
  const RANGE_PREFIX = /^[\^~]/u;
897
922
  const pnpm$1 = attempt("pnpm");
@@ -1891,4 +1916,4 @@ const runAllChecks = (root) => Effect.gen(function* all() {
1891
1916
  });
1892
1917
  export { stagedSecrets as a, runCi as c, checkPushedRefs as d, loadViteConfig as f, lintMessageText as i, version as l, HOOKS as n, usage as o, VpToolsError as p, lintMessageFile as r, prepare as s, runAllChecks as t, findCiDrift as u };
1893
1918
 
1894
- //# sourceMappingURL=run-checks-RwkrfT5c.mjs.map
1919
+ //# sourceMappingURL=run-checks-BEJcAppP.mjs.map