knip 6.44.2 → 6.45.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/dist/ConfigurationChief.d.ts +23 -1033
- package/dist/ConfigurationChief.js +71 -15
- package/dist/DependencyDeputy.d.ts +10 -6
- package/dist/DependencyDeputy.js +51 -27
- package/dist/IssueCollector.d.ts +14 -11
- package/dist/IssueCollector.js +25 -20
- package/dist/IssueFixer.js +1 -1
- package/dist/PackagePeeker.d.ts +6 -0
- package/dist/PackagePeeker.js +43 -14
- package/dist/ProjectPrincipal.d.ts +6 -3
- package/dist/ProjectPrincipal.js +83 -32
- package/dist/WorkspaceWorker.d.ts +5 -1
- package/dist/WorkspaceWorker.js +39 -22
- package/dist/binaries/bash-parser.js +1 -7
- package/dist/binaries/command.d.ts +3 -3
- package/dist/binaries/command.js +6 -2
- package/dist/binaries/fallback.js +1 -1
- package/dist/binaries/plugins.d.ts +4 -1
- package/dist/binaries/plugins.js +66 -18
- package/dist/binaries/resolvers/npm.js +7 -5
- package/dist/binaries/resolvers/npx.js +8 -40
- package/dist/binaries/util.d.ts +13 -1
- package/dist/binaries/util.js +35 -1
- package/dist/cli.js +10 -84
- package/dist/configuration-hints.d.ts +16 -0
- package/dist/configuration-hints.js +64 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +2 -0
- package/dist/graph/SubpathReferences.d.ts +33 -0
- package/dist/graph/SubpathReferences.js +114 -0
- package/dist/graph/analyze.d.ts +4 -1
- package/dist/graph/analyze.js +16 -5
- package/dist/graph/build.d.ts +3 -1
- package/dist/graph/build.js +47 -23
- package/dist/graph-explorer/operations/resolve-export-origins.js +1 -1
- package/dist/plugins/angular/index.js +10 -17
- package/dist/plugins/aws-cdk/index.d.ts +3 -0
- package/dist/plugins/aws-cdk/index.js +32 -0
- package/dist/plugins/aws-cdk/types.d.ts +5 -0
- package/dist/plugins/aws-cdk/types.js +1 -0
- package/dist/plugins/babel/index.d.ts +1 -1
- package/dist/plugins/babel/index.js +19 -5
- package/dist/plugins/bun/index.js +8 -7
- package/dist/plugins/c8/index.js +17 -4
- package/dist/plugins/changesets/index.js +3 -2
- package/dist/plugins/commitizen/index.js +6 -3
- package/dist/plugins/commitlint/index.js +10 -11
- package/dist/plugins/cypress/index.js +4 -2
- package/dist/plugins/danger/index.js +1 -1
- package/dist/plugins/docusaurus/helpers.js +6 -6
- package/dist/plugins/docusaurus/index.js +2 -2
- package/dist/plugins/electron-forge/index.js +2 -2
- package/dist/plugins/electron-vite/index.js +2 -2
- package/dist/plugins/eleventy/index.js +3 -2
- package/dist/plugins/eslint/helpers.js +4 -3
- package/dist/plugins/eslint/resolveFromAST.js +2 -2
- package/dist/plugins/evalite/index.d.ts +3 -0
- package/dist/plugins/evalite/index.js +26 -0
- package/dist/plugins/flue/index.js +2 -2
- package/dist/plugins/github-action/index.js +2 -2
- package/dist/plugins/github-actions/index.js +2 -2
- package/dist/plugins/graphql-codegen/index.js +13 -9
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/jest/index.js +5 -5
- package/dist/plugins/knex/index.js +2 -2
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/lunaria/index.js +5 -2
- package/dist/plugins/markdownlint/index.js +8 -2
- package/dist/plugins/marko/index.js +2 -2
- package/dist/plugins/marko/taglibs.d.ts +1 -1
- package/dist/plugins/marko/taglibs.js +4 -28
- package/dist/plugins/mdx/index.d.ts +2 -1
- package/dist/plugins/mdx/index.js +7 -4
- package/dist/plugins/mdxlint/index.js +18 -15
- package/dist/plugins/mikro-orm/index.d.ts +3 -0
- package/dist/plugins/mikro-orm/index.js +77 -0
- package/dist/plugins/mikro-orm/types.d.ts +21 -0
- package/dist/plugins/mikro-orm/types.js +1 -0
- package/dist/plugins/msw/index.js +6 -3
- package/dist/plugins/msw/types.d.ts +1 -1
- package/dist/plugins/netlify/index.js +7 -3
- package/dist/plugins/next/index.js +63 -9
- package/dist/plugins/next/types.d.ts +5 -0
- package/dist/plugins/next-mdx/resolveFromAST.js +15 -10
- package/dist/plugins/nitro/index.js +5 -6
- package/dist/plugins/node/index.js +4 -4
- package/dist/plugins/npm-package-json-lint/index.js +10 -3
- package/dist/plugins/nuxt/index.js +18 -10
- package/dist/plugins/nuxt/types.d.ts +4 -0
- package/dist/plugins/nx/index.js +6 -3
- package/dist/plugins/openclaw/index.js +11 -11
- package/dist/plugins/oxlint/index.js +2 -2
- package/dist/plugins/payload/index.js +1 -1
- package/dist/plugins/playwright/index.js +3 -3
- package/dist/plugins/pm2/index.js +7 -7
- package/dist/plugins/prettier/index.js +2 -1
- package/dist/plugins/prisma/index.js +2 -2
- package/dist/plugins/quasar/resolveFromAST.js +14 -9
- package/dist/plugins/react-router/index.js +2 -2
- package/dist/plugins/release-it/index.js +6 -2
- package/dist/plugins/remix/index.js +3 -3
- package/dist/plugins/retry-cli/index.d.ts +3 -0
- package/dist/plugins/retry-cli/index.js +14 -0
- package/dist/plugins/rollup/index.js +1 -4
- package/dist/plugins/rstest/index.js +3 -3
- package/dist/plugins/semantic-release/index.js +3 -3
- package/dist/plugins/serverless-framework/index.js +10 -8
- package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/stencil/resolveFromAST.js +5 -5
- package/dist/plugins/stryker/index.js +2 -2
- package/dist/plugins/swc/index.js +4 -3
- package/dist/plugins/tailwind/index.js +2 -2
- package/dist/plugins/tanstack-router/index.js +2 -2
- package/dist/plugins/ts-node/index.js +6 -1
- package/dist/plugins/turbo/index.js +3 -3
- package/dist/plugins/typedoc/index.js +2 -2
- package/dist/plugins/typescript/content-mappers.d.ts +1 -1
- package/dist/plugins/typescript/index.js +6 -9
- package/dist/plugins/varlock/scan.js +1 -1
- package/dist/plugins/vite/helpers.d.ts +1 -0
- package/dist/plugins/vite/helpers.js +13 -3
- package/dist/plugins/vite/index.js +5 -2
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
- package/dist/plugins/vitest/index.js +14 -16
- package/dist/plugins/vue/index.js +1 -1
- package/dist/plugins/web-test-runner/index.d.ts +3 -0
- package/dist/plugins/web-test-runner/index.js +86 -0
- package/dist/plugins/wrangler/index.js +3 -3
- package/dist/plugins/yarn/index.js +5 -5
- package/dist/plugins.js +2 -5
- package/dist/reporters/github-actions.js +3 -7
- package/dist/reporters/json.d.ts +1 -0
- package/dist/reporters/json.js +1 -0
- package/dist/reporters/util/configuration-hints.d.ts +3 -1
- package/dist/reporters/util/configuration-hints.js +40 -21
- package/dist/reporters/util/util.d.ts +1 -1
- package/dist/run-cli.d.ts +2 -0
- package/dist/run-cli.js +82 -0
- package/dist/run.js +12 -0
- package/dist/session/incremental.d.ts +1 -0
- package/dist/session/incremental.js +1 -0
- package/dist/session/watch.js +2 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +5 -0
- package/dist/types/args.d.ts +3 -1
- package/dist/types/config.d.ts +17 -10
- package/dist/types/configuration.d.ts +45 -0
- package/dist/types/configuration.js +1 -0
- package/dist/types/issues.d.ts +4 -0
- package/dist/types/module-graph.d.ts +1 -0
- package/dist/types/options.d.ts +1 -0
- package/dist/types/package-json.d.ts +3 -8
- package/dist/types/workspace.d.ts +1 -0
- package/dist/typescript/get-imports-and-exports.js +18 -6
- package/dist/typescript/resolve-module-names.js +7 -45
- package/dist/typescript/visitors/calls.d.ts +1 -1
- package/dist/typescript/visitors/calls.js +14 -10
- package/dist/typescript/visitors/exports.js +16 -26
- package/dist/typescript/visitors/imports.d.ts +2 -1
- package/dist/typescript/visitors/imports.js +41 -24
- package/dist/typescript/visitors/members.d.ts +1 -1
- package/dist/typescript/visitors/members.js +38 -24
- package/dist/typescript/visitors/shadow.d.ts +2 -0
- package/dist/typescript/visitors/shadow.js +25 -0
- package/dist/typescript/visitors/walk.d.ts +20 -12
- package/dist/typescript/visitors/walk.js +78 -48
- package/dist/util/Performance.d.ts +25 -3
- package/dist/util/Performance.js +51 -27
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +4 -2
- package/dist/util/create-input-handler.js +138 -119
- package/dist/util/create-options.d.ts +4 -2071
- package/dist/util/create-options.js +6 -4
- package/dist/util/create-workspace-graph.js +2 -1
- package/dist/util/errors.d.ts +5 -2
- package/dist/util/errors.js +11 -18
- package/dist/util/fs.js +4 -2
- package/dist/util/input.d.ts +2 -2
- package/dist/util/input.js +2 -2
- package/dist/util/is-plugin-name.d.ts +2 -0
- package/dist/util/is-plugin-name.js +3 -0
- package/dist/util/jiti.d.ts +2 -1
- package/dist/util/jiti.js +10 -3
- package/dist/util/load-config.d.ts +1 -1
- package/dist/util/load-config.js +3 -2
- package/dist/util/loader.js +3 -2
- package/dist/util/map-workspaces.js +23 -1
- package/dist/util/module-graph.js +1 -0
- package/dist/util/modules.d.ts +2 -0
- package/dist/util/modules.js +78 -0
- package/dist/util/package-json.d.ts +12 -5
- package/dist/util/package-json.js +54 -26
- package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
- package/dist/util/parse-and-convert-gitignores.js +5 -5
- package/dist/util/parse-configuration.d.ts +2 -0
- package/dist/util/parse-configuration.js +66 -0
- package/dist/util/plugin.js +8 -12
- package/dist/util/resolve.d.ts +1 -0
- package/dist/util/resolve.js +3 -2
- package/dist/util/scripts.d.ts +0 -5
- package/dist/util/scripts.js +1 -32
- package/dist/util/to-source-path.d.ts +4 -1
- package/dist/util/to-source-path.js +2 -2
- package/dist/util/unhandled-rejection.d.ts +8 -0
- package/dist/util/unhandled-rejection.js +29 -0
- package/dist/util/validation.d.ts +11 -0
- package/dist/util/validation.js +68 -0
- package/dist/util/watch.d.ts +3 -1
- package/dist/util/watch.js +5 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -7
- package/schema.json +34 -0
- package/dist/schema/configuration.d.ts +0 -3103
- package/dist/schema/configuration.js +0 -94
- package/dist/schema/plugins.d.ts +0 -1019
- package/dist/schema/plugins.js +0 -215
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toDependency, toDeferResolveProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { isAbsolute, toAbsolute } from '../../util/path.js';
|
|
3
3
|
import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
|
|
4
4
|
const isLocalPath = (name) => name.startsWith('.') || isAbsolute(name);
|
|
@@ -61,10 +61,10 @@ const resolveArrayConfig = ([name, config], type, cwd) => {
|
|
|
61
61
|
if (typeof name !== 'string')
|
|
62
62
|
return [];
|
|
63
63
|
const sidebarPath = type !== 'theme' ? resolveSidebarPath(config) : undefined;
|
|
64
|
-
const sidebar = sidebarPath ? [
|
|
64
|
+
const sidebar = sidebarPath ? [toDeferResolveProductionEntry(sidebarPath, { dir: cwd })] : [];
|
|
65
65
|
if (isLocalPath(name))
|
|
66
|
-
return [
|
|
67
|
-
return [
|
|
66
|
+
return [toDeferResolveProductionEntry(toAbsolute(name, cwd)), ...sidebar];
|
|
67
|
+
return [toDependency(resolveModuleName(name, type)), ...sidebar];
|
|
68
68
|
};
|
|
69
69
|
export const resolveConfigItems = async (items, type, options) => {
|
|
70
70
|
const inputs = new Set();
|
|
@@ -75,9 +75,9 @@ export const resolveConfigItems = async (items, type, options) => {
|
|
|
75
75
|
continue;
|
|
76
76
|
if (typeof item === 'string') {
|
|
77
77
|
if (isLocalPath(item))
|
|
78
|
-
inputs.add(
|
|
78
|
+
inputs.add(toDeferResolveProductionEntry(toAbsolute(item, options.cwd)));
|
|
79
79
|
else
|
|
80
|
-
inputs.add(
|
|
80
|
+
inputs.add(toDependency(resolveModuleName(item, type)));
|
|
81
81
|
}
|
|
82
82
|
else if (Array.isArray(item)) {
|
|
83
83
|
for (const input of resolveArrayConfig(item, type, options.cwd))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toAlias, toConfig, toDependency, toIgnore, toProductionEntry } from '../../util/input.js';
|
|
1
|
+
import { toAlias, toConfig, toDeferResolveProductionEntry, toDependency, toIgnore, toProductionEntry, } from '../../util/input.js';
|
|
2
2
|
import { join } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
import { CORE_CLIENT_API, resolveConfigItems } from './helpers.js';
|
|
@@ -13,7 +13,7 @@ const resolveStaticAssets = (items, cwd) => {
|
|
|
13
13
|
for (const item of items ?? []) {
|
|
14
14
|
const value = typeof item === 'string' ? item : (item.src ?? item.href);
|
|
15
15
|
if (typeof value === 'string' && !value.includes('://'))
|
|
16
|
-
entries.push(
|
|
16
|
+
entries.push(toDeferResolveProductionEntry(join(cwd, 'static', value)));
|
|
17
17
|
}
|
|
18
18
|
return entries;
|
|
19
19
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toConfig, toDependency,
|
|
1
|
+
import { toConfig, toDependency, toDeferResolveProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { toAbsolute } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
|
|
@@ -25,7 +25,7 @@ const getPluginInputs = async (name, opts, options) => {
|
|
|
25
25
|
const inputs = [];
|
|
26
26
|
const addEntry = (value) => {
|
|
27
27
|
for (const id of toStrings(value))
|
|
28
|
-
inputs.push(
|
|
28
|
+
inputs.push(toDeferResolveProductionEntry(toAbsolute(id, cwd)));
|
|
29
29
|
};
|
|
30
30
|
const addConfig = async (pluginName, value) => {
|
|
31
31
|
if (typeof value === 'string') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toProductionEntry } from '../../util/input.js';
|
|
1
|
+
import { toDeferResolveProductionEntry, toProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { toAbsolute } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
import { getHtmlScriptEntries } from '../vite/helpers.js';
|
|
@@ -31,7 +31,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
31
31
|
const patterns = ids.length > 0 ? ids : [defaultEntry[name]];
|
|
32
32
|
for (const id of patterns) {
|
|
33
33
|
const resolved = toAbsolute(id, configFileDir);
|
|
34
|
-
inputs.push(toProductionEntry(resolved));
|
|
34
|
+
inputs.push(ids.length > 0 ? toDeferResolveProductionEntry(resolved) : toProductionEntry(resolved));
|
|
35
35
|
if (name === 'renderer' && resolved.endsWith('.html')) {
|
|
36
36
|
for (const input of await getHtmlScriptEntries(resolved))
|
|
37
37
|
inputs.push(input);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_EXTENSIONS } from '../../constants.js';
|
|
2
2
|
import { isDirectory } from '../../util/fs.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toDependency, toProductionEntry } from '../../util/input.js';
|
|
4
|
+
import { getPackageNameFromFilePath } from '../../util/modules.js';
|
|
4
5
|
import { isInNodeModules, join } from '../../util/path.js';
|
|
5
6
|
import { hasDependency } from '../../util/plugin.js';
|
|
6
7
|
import { DummyEleventyConfig, defaultEleventyConfig } from './helpers.js';
|
|
@@ -34,7 +35,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
34
35
|
copiedPackages.add(path);
|
|
35
36
|
}
|
|
36
37
|
return Array.from(copiedPackages)
|
|
37
|
-
.map(id =>
|
|
38
|
+
.map(id => toDependency(getPackageNameFromFilePath(id)))
|
|
38
39
|
.concat([
|
|
39
40
|
join(inputDir, dataDir, '**/*.{js,cjs,mjs}'),
|
|
40
41
|
join(inputDir, `**/*.{${typeof templateFormats === 'string' ? templateFormats : templateFormats.join(',')}}`),
|
|
@@ -24,13 +24,14 @@ const getInputsDeprecated = (config, options) => {
|
|
|
24
24
|
const plugins = config.plugins ? config.plugins.map(resolvePluginSpecifier) : [];
|
|
25
25
|
const parsers = getParsers(config);
|
|
26
26
|
const babelDependencies = config.parserOptions?.babelOptions
|
|
27
|
-
? getDependenciesFromConfig(config.parserOptions.babelOptions)
|
|
27
|
+
? getDependenciesFromConfig(config.parserOptions.babelOptions, false)
|
|
28
28
|
: [];
|
|
29
29
|
const settings = config.settings ? getDependenciesFromSettings(config.settings) : [];
|
|
30
30
|
const rules = getDependenciesFromRules({});
|
|
31
31
|
const overrides = config.overrides ? [config.overrides].flat().flatMap(d => getInputsDeprecated(d, options)) : [];
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const dependencies = compact([...extendsSpecifiers, ...plugins, ...rules]).map(id => toDependency(id));
|
|
33
|
+
const resolvers = compact(settings).map(id => toDeferResolve(id));
|
|
34
|
+
return [...extendConfigs, ...dependencies, ...resolvers, ...parsers, ...babelDependencies, ...overrides];
|
|
34
35
|
};
|
|
35
36
|
const isParserObject = (value) => typeof value.parseForESLint === 'function' || typeof value.parse === 'function';
|
|
36
37
|
export const toParser = (name) => toDeferResolve(name, name === 'espree' ? { optional: true } : {});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Visitor } from 'oxc-parser';
|
|
2
|
-
import { toDeferResolve } from '../../util/input.js';
|
|
2
|
+
import { toDeferResolve, toDependency } from '../../util/input.js';
|
|
3
3
|
import { findProperty, getPropertyKey } from '../../typescript/ast-helpers.js';
|
|
4
4
|
import { getStringValue } from '../../typescript/ast-nodes.js';
|
|
5
5
|
import { isInternal } from '../../util/path.js';
|
|
@@ -74,5 +74,5 @@ const getInputsFromSettingsAST = (program) => {
|
|
|
74
74
|
};
|
|
75
75
|
export const getInputsFromFlatConfigAST = (program) => [
|
|
76
76
|
...getInputsFromSettingsAST(program),
|
|
77
|
-
|
|
77
|
+
toDependency('eslint-import-resolver-typescript', { optional: true }),
|
|
78
78
|
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { collectPropertyValues } from '../../typescript/ast-helpers.js';
|
|
2
|
+
import { toDeferResolve, toEntry } from '../../util/input.js';
|
|
3
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
4
|
+
const title = 'Evalite';
|
|
5
|
+
const enablers = ['evalite'];
|
|
6
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
|
+
const config = ['evalite.config.{ts,mts,js,mjs}'];
|
|
8
|
+
const entry = ['**/*.eval.?(m)ts'];
|
|
9
|
+
const resolveFromAST = (program, options) => {
|
|
10
|
+
const inputs = [];
|
|
11
|
+
if (!options.config.entry)
|
|
12
|
+
for (const id of entry)
|
|
13
|
+
inputs.push(toEntry(id));
|
|
14
|
+
for (const id of collectPropertyValues(program, 'setupFiles'))
|
|
15
|
+
inputs.push(toDeferResolve(id));
|
|
16
|
+
return inputs;
|
|
17
|
+
};
|
|
18
|
+
const plugin = {
|
|
19
|
+
title,
|
|
20
|
+
enablers,
|
|
21
|
+
isEnabled,
|
|
22
|
+
config,
|
|
23
|
+
entry,
|
|
24
|
+
resolveFromAST,
|
|
25
|
+
};
|
|
26
|
+
export default plugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { collectFirstPropertyValue } from '../../typescript/ast-helpers.js';
|
|
2
2
|
import { isDirectory } from '../../util/fs.js';
|
|
3
|
-
import { toProductionEntry } from '../../util/input.js';
|
|
3
|
+
import { toDeferResolveProductionEntry, toProductionEntry } from '../../util/input.js';
|
|
4
4
|
import { join } from '../../util/path.js';
|
|
5
5
|
import { hasDependency } from '../../util/plugin.js';
|
|
6
6
|
const title = 'Flue';
|
|
@@ -23,7 +23,7 @@ const resolveFromAST = (program, { configFileDir }) => {
|
|
|
23
23
|
for (const name of entryNames) {
|
|
24
24
|
const filePath = collectFirstPropertyValue(program, name);
|
|
25
25
|
if (filePath)
|
|
26
|
-
inputs.push(
|
|
26
|
+
inputs.push(toDeferResolveProductionEntry(join(configFileDir, filePath)));
|
|
27
27
|
else
|
|
28
28
|
inputs.push(toProductionEntry(join(sourceRoot, `${name}.${extensions}`)));
|
|
29
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toDeferResolveEntry, toProject } from '../../util/input.js';
|
|
2
2
|
import { relative } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
import { getActionDependencies } from '../github-actions/index.js';
|
|
@@ -15,7 +15,7 @@ const resolveConfig = async (config, options) => {
|
|
|
15
15
|
if (isAssumeArtifact(relativePath))
|
|
16
16
|
inputs.push(toProject(`!${relativePath}`));
|
|
17
17
|
else
|
|
18
|
-
inputs.push(
|
|
18
|
+
inputs.push(toDeferResolveEntry(filePath));
|
|
19
19
|
}
|
|
20
20
|
return inputs;
|
|
21
21
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hasFileWithExtension } from '../../util/fs.js';
|
|
2
|
-
import { isDeferResolveEntry,
|
|
2
|
+
import { isDeferResolveEntry, toDeferResolveEntry } from '../../util/input.js';
|
|
3
3
|
import { findByKeyDeep } from '../../util/object.js';
|
|
4
4
|
import { join, relative } from '../../util/path.js';
|
|
5
5
|
const title = 'GitHub Actions';
|
|
@@ -45,7 +45,7 @@ const resolveConfig = async (config, options) => {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
return [...inputs, ...getActionDependencies(config, options).map(id =>
|
|
48
|
+
return [...inputs, ...getActionDependencies(config, options).map(id => toDeferResolveEntry(id))];
|
|
49
49
|
};
|
|
50
50
|
const plugin = {
|
|
51
51
|
title,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toDeferResolve, toDeferResolveEntry, toDeferResolveProductionEntry, toDependency, toProductionEntry, } from '../../util/input.js';
|
|
2
2
|
import { get } from '../../util/object.js';
|
|
3
3
|
import { isInternal, join, normalize } from '../../util/path.js';
|
|
4
4
|
import { hasDependency } from '../../util/plugin.js';
|
|
@@ -24,16 +24,18 @@ const getPluginPackageName = (name) => {
|
|
|
24
24
|
return name;
|
|
25
25
|
return `@graphql-codegen/${name}`;
|
|
26
26
|
};
|
|
27
|
-
const
|
|
27
|
+
const getOutputInput = (output, outputConfig, dir) => {
|
|
28
28
|
if (isConfigurationOutput(outputConfig) && isNearOperationFilePreset(outputConfig.preset)) {
|
|
29
29
|
const presetConfig = outputConfig.presetConfig ?? {};
|
|
30
30
|
const { folder = '', extension = '.generated.ts', fileName = '*', filePerOperation = false } = presetConfig;
|
|
31
31
|
const subfolder = normalize(folder)
|
|
32
32
|
.split('/')
|
|
33
33
|
.filter(segment => segment !== '' && segment !== '.' && segment !== '..');
|
|
34
|
-
return join(output, '**', ...subfolder, `${filePerOperation ? '*' : fileName}${extension}`);
|
|
34
|
+
return toProductionEntry(join(dir, output, '**', ...subfolder, `${filePerOperation ? '*' : fileName}${extension}`));
|
|
35
35
|
}
|
|
36
|
-
return output.endsWith('/')
|
|
36
|
+
return output.endsWith('/')
|
|
37
|
+
? toProductionEntry(join(dir, `${output}**`))
|
|
38
|
+
: toDeferResolveProductionEntry(output, { dir });
|
|
37
39
|
};
|
|
38
40
|
const resolveConfig = (config, options) => {
|
|
39
41
|
const codegenConfigs = isGraphqlProjectsConfigTypes(config)
|
|
@@ -45,14 +47,16 @@ const resolveConfig = (config, options) => {
|
|
|
45
47
|
const generateSet = generateConfigs.flatMap(config => Object.values(config.generates));
|
|
46
48
|
const outputs = generateConfigs
|
|
47
49
|
.flatMap(config => Object.entries(config.generates))
|
|
48
|
-
.map(([output, outputConfig]) =>
|
|
50
|
+
.map(([output, outputConfig]) => getOutputInput(output, outputConfig, options.configFileDir));
|
|
49
51
|
const configurationOutput = generateSet.filter(isConfigurationOutput);
|
|
50
52
|
const presets = configurationOutput
|
|
51
53
|
.map(configOutput => (configOutput.preset ? configOutput.preset : undefined))
|
|
52
54
|
.filter((preset) => typeof preset === 'string')
|
|
53
|
-
.map(presetName => presetName
|
|
54
|
-
? presetName
|
|
55
|
-
:
|
|
55
|
+
.map(presetName => isInternal(presetName)
|
|
56
|
+
? toDeferResolve(presetName, { dir: options.cwd })
|
|
57
|
+
: presetName.startsWith('@graphql-codegen/')
|
|
58
|
+
? presetName
|
|
59
|
+
: `@graphql-codegen/${presetName}${presetName.endsWith('-preset') ? '' : '-preset'}`);
|
|
56
60
|
const flatPlugins = generateSet
|
|
57
61
|
.filter((config) => !isConfigurationOutput(config))
|
|
58
62
|
.flatMap(item => Object.keys(item))
|
|
@@ -68,7 +72,7 @@ const resolveConfig = (config, options) => {
|
|
|
68
72
|
if (typeof plugin !== 'string')
|
|
69
73
|
return [];
|
|
70
74
|
if (isInternal(plugin))
|
|
71
|
-
return [
|
|
75
|
+
return [toDeferResolveEntry(plugin, { dir: options.cwd })];
|
|
72
76
|
return [toDependency(getPluginPackageName(plugin))];
|
|
73
77
|
});
|
|
74
78
|
return [...presets, ...flatPlugins, ...nestedPlugins, ...outputs].map(id => typeof id === 'string' ? toDependency(id) : id);
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const Plugins: {
|
|
|
5
5
|
'astro-markdoc': import("../types/config.ts").Plugin;
|
|
6
6
|
'astro-og-canvas': import("../types/config.ts").Plugin;
|
|
7
7
|
ava: import("../types/config.ts").Plugin;
|
|
8
|
+
'aws-cdk': import("../types/config.ts").Plugin;
|
|
8
9
|
babel: import("../types/config.ts").Plugin;
|
|
9
10
|
biome: import("../types/config.ts").Plugin;
|
|
10
11
|
borp: import("../types/config.ts").Plugin;
|
|
@@ -34,6 +35,7 @@ export declare const Plugins: {
|
|
|
34
35
|
eleventy: import("../types/config.ts").Plugin;
|
|
35
36
|
esbuild: import("../types/config.ts").Plugin;
|
|
36
37
|
eslint: import("../types/config.ts").Plugin;
|
|
38
|
+
evalite: import("../types/config.ts").Plugin;
|
|
37
39
|
eve: import("../types/config.ts").Plugin;
|
|
38
40
|
execa: import("../types/config.ts").Plugin;
|
|
39
41
|
expo: import("../types/config.ts").Plugin;
|
|
@@ -78,6 +80,7 @@ export declare const Plugins: {
|
|
|
78
80
|
mdx: import("../types/config.ts").Plugin;
|
|
79
81
|
mdxlint: import("../types/config.ts").Plugin;
|
|
80
82
|
metro: import("../types/config.ts").Plugin;
|
|
83
|
+
'mikro-orm': import("../types/config.ts").Plugin;
|
|
81
84
|
mise: import("../types/config.ts").Plugin;
|
|
82
85
|
mocha: import("../types/config.ts").Plugin;
|
|
83
86
|
moonrepo: import("../types/config.ts").Plugin;
|
|
@@ -133,6 +136,7 @@ export declare const Plugins: {
|
|
|
133
136
|
'release-it': import("../types/config.ts").Plugin;
|
|
134
137
|
remark: import("../types/config.ts").Plugin;
|
|
135
138
|
remix: import("../types/config.ts").Plugin;
|
|
139
|
+
'retry-cli': import("../types/config.ts").Plugin;
|
|
136
140
|
rolldown: import("../types/config.ts").Plugin;
|
|
137
141
|
rollup: import("../types/config.ts").Plugin;
|
|
138
142
|
rsbuild: import("../types/config.ts").Plugin;
|
|
@@ -197,6 +201,7 @@ export declare const Plugins: {
|
|
|
197
201
|
vitepress: import("../types/config.ts").Plugin;
|
|
198
202
|
vitest: import("../types/config.ts").Plugin;
|
|
199
203
|
vue: import("../types/config.ts").Plugin;
|
|
204
|
+
'web-test-runner': import("../types/config.ts").Plugin;
|
|
200
205
|
'webdriver-io': import("../types/config.ts").Plugin;
|
|
201
206
|
webpack: import("../types/config.ts").Plugin;
|
|
202
207
|
wireit: import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { default as astroDb } from './astro-db/index.js';
|
|
|
4
4
|
import { default as astroMarkdoc } from './astro-markdoc/index.js';
|
|
5
5
|
import { default as astroOgCanvas } from './astro-og-canvas/index.js';
|
|
6
6
|
import { default as ava } from './ava/index.js';
|
|
7
|
+
import { default as awsCdk } from './aws-cdk/index.js';
|
|
7
8
|
import { default as babel } from './babel/index.js';
|
|
8
9
|
import { default as biome } from './biome/index.js';
|
|
9
10
|
import { default as borp } from './borp/index.js';
|
|
@@ -33,6 +34,7 @@ import { default as electronVite } from './electron-vite/index.js';
|
|
|
33
34
|
import { default as eleventy } from './eleventy/index.js';
|
|
34
35
|
import { default as esbuild } from './esbuild/index.js';
|
|
35
36
|
import { default as eslint } from './eslint/index.js';
|
|
37
|
+
import { default as evalite } from './evalite/index.js';
|
|
36
38
|
import { default as eve } from './eve/index.js';
|
|
37
39
|
import { default as execa } from './execa/index.js';
|
|
38
40
|
import { default as expo } from './expo/index.js';
|
|
@@ -72,6 +74,7 @@ import { default as mcp } from './mcp/index.js';
|
|
|
72
74
|
import { default as mdx } from './mdx/index.js';
|
|
73
75
|
import { default as mdxlint } from './mdxlint/index.js';
|
|
74
76
|
import { default as metro } from './metro/index.js';
|
|
77
|
+
import { default as mikroOrm } from './mikro-orm/index.js';
|
|
75
78
|
import { default as mise } from './mise/index.js';
|
|
76
79
|
import { default as mocha } from './mocha/index.js';
|
|
77
80
|
import { default as moonrepo } from './moonrepo/index.js';
|
|
@@ -127,6 +130,7 @@ import { default as relay } from './relay/index.js';
|
|
|
127
130
|
import { default as releaseIt } from './release-it/index.js';
|
|
128
131
|
import { default as remark } from './remark/index.js';
|
|
129
132
|
import { default as remix } from './remix/index.js';
|
|
133
|
+
import { default as retryCli } from './retry-cli/index.js';
|
|
130
134
|
import { default as rolldown } from './rolldown/index.js';
|
|
131
135
|
import { default as rollup } from './rollup/index.js';
|
|
132
136
|
import { default as rsbuild } from './rsbuild/index.js';
|
|
@@ -191,6 +195,7 @@ import { default as vitePwaAssetsGenerator } from './vite-pwa-assets-generator/i
|
|
|
191
195
|
import { default as vitepress } from './vitepress/index.js';
|
|
192
196
|
import { default as vitest } from './vitest/index.js';
|
|
193
197
|
import { default as vue } from './vue/index.js';
|
|
198
|
+
import { default as webTestRunner } from './web-test-runner/index.js';
|
|
194
199
|
import { default as webdriverIo } from './webdriver-io/index.js';
|
|
195
200
|
import { default as webpack } from './webpack/index.js';
|
|
196
201
|
import { default as wireit } from './wireit/index.js';
|
|
@@ -207,6 +212,7 @@ export const Plugins = {
|
|
|
207
212
|
'astro-markdoc': astroMarkdoc,
|
|
208
213
|
'astro-og-canvas': astroOgCanvas,
|
|
209
214
|
ava,
|
|
215
|
+
'aws-cdk': awsCdk,
|
|
210
216
|
babel,
|
|
211
217
|
biome,
|
|
212
218
|
borp,
|
|
@@ -236,6 +242,7 @@ export const Plugins = {
|
|
|
236
242
|
eleventy,
|
|
237
243
|
esbuild,
|
|
238
244
|
eslint,
|
|
245
|
+
evalite,
|
|
239
246
|
eve,
|
|
240
247
|
execa,
|
|
241
248
|
expo,
|
|
@@ -275,6 +282,7 @@ export const Plugins = {
|
|
|
275
282
|
mdx,
|
|
276
283
|
mdxlint,
|
|
277
284
|
metro,
|
|
285
|
+
'mikro-orm': mikroOrm,
|
|
278
286
|
mise,
|
|
279
287
|
mocha,
|
|
280
288
|
moonrepo,
|
|
@@ -330,6 +338,7 @@ export const Plugins = {
|
|
|
330
338
|
'release-it': releaseIt,
|
|
331
339
|
remark,
|
|
332
340
|
remix,
|
|
341
|
+
'retry-cli': retryCli,
|
|
333
342
|
rolldown,
|
|
334
343
|
rollup,
|
|
335
344
|
rsbuild,
|
|
@@ -394,6 +403,7 @@ export const Plugins = {
|
|
|
394
403
|
vitepress,
|
|
395
404
|
vitest,
|
|
396
405
|
vue,
|
|
406
|
+
'web-test-runner': webTestRunner,
|
|
397
407
|
'webdriver-io': webdriverIo,
|
|
398
408
|
webpack,
|
|
399
409
|
wireit,
|
|
@@ -51,11 +51,11 @@ const resolveDependencies = async (config, rootDir, options) => {
|
|
|
51
51
|
if (config.testEnvironment === 'node') {
|
|
52
52
|
environments.push(toDependency('jest-environment-node', { optional: true }));
|
|
53
53
|
}
|
|
54
|
+
else if (config.testEnvironment === 'jsdom') {
|
|
55
|
+
environments.push(toDependency('jest-environment-jsdom'));
|
|
56
|
+
}
|
|
54
57
|
else if (config.testEnvironment) {
|
|
55
|
-
|
|
56
|
-
? 'jest-environment-jsdom'
|
|
57
|
-
: resolveWithPrefix('jest-environment-', config.testEnvironment, rootDir);
|
|
58
|
-
environments.push(toDeferResolve(environment));
|
|
58
|
+
environments.push(toDeferResolve(resolveWithPrefix('jest-environment-', config.testEnvironment, rootDir)));
|
|
59
59
|
}
|
|
60
60
|
const resolvers = config.resolver ? [config.resolver] : [];
|
|
61
61
|
const reporters = getReportersDependencies(config, options);
|
|
@@ -68,7 +68,7 @@ const resolveDependencies = async (config, rootDir, options) => {
|
|
|
68
68
|
else {
|
|
69
69
|
transform.push(transformer[0]);
|
|
70
70
|
if (isBabelJest(transformer)) {
|
|
71
|
-
transform.push(...getDependenciesFromConfig(transformer[1]));
|
|
71
|
+
transform.push(...getDependenciesFromConfig(transformer[1], false));
|
|
72
72
|
const { configFile } = transformer[1];
|
|
73
73
|
if (typeof configFile === 'string')
|
|
74
74
|
transform.push(toConfig('babel', rootDirRe.test(configFile) ? configFile : toAbsolute(configFile, options.cwd)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toEntry, toProductionDependency } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
import { clientToPackages } from './helpers.js';
|
|
4
4
|
import { createKnexClientVisitor } from './visitors/clientCall.js';
|
|
@@ -10,7 +10,7 @@ const processKnexConfig = (config) => {
|
|
|
10
10
|
const inputs = [];
|
|
11
11
|
if (config.client) {
|
|
12
12
|
const packages = clientToPackages(config.client);
|
|
13
|
-
inputs.push(...packages.map(pkg =>
|
|
13
|
+
inputs.push(...packages.map(pkg => toProductionDependency(pkg, { optional: true })));
|
|
14
14
|
}
|
|
15
15
|
if (config.migrations?.directory) {
|
|
16
16
|
const dirs = Array.isArray(config.migrations.directory)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findImportedCalls, findProperty, getStringValues } from '../../typescript/ast-helpers.js';
|
|
2
2
|
import { getStringValue } from '../../typescript/ast-nodes.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toDeferResolveProductionEntry } from '../../util/input.js';
|
|
4
4
|
import { join } from '../../util/path.js';
|
|
5
5
|
const enablers = ['laravel-vite-plugin'];
|
|
6
6
|
const addStringOrArray = (values, node) => {
|
|
@@ -21,7 +21,7 @@ export const resolveFromAST = (program, options) => {
|
|
|
21
21
|
addStringOrArray(specifiers, findProperty(arg, 'input'));
|
|
22
22
|
addStringOrArray(specifiers, findProperty(arg, 'ssr'));
|
|
23
23
|
for (const id of specifiers)
|
|
24
|
-
inputs.push(
|
|
24
|
+
inputs.push(toDeferResolveProductionEntry(join(options.configFileDir, id)));
|
|
25
25
|
}
|
|
26
26
|
return inputs;
|
|
27
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toAbsolute } from '../../util/path.js';
|
|
2
|
-
import { toProductionEntry } from '../../util/input.js';
|
|
2
|
+
import { toDeferResolveProductionEntry, toProductionEntry } from '../../util/input.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'Lunaria';
|
|
5
5
|
const enablers = ['@lunariajs/core', '@lunariajs/starlight'];
|
|
@@ -13,7 +13,10 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
13
13
|
const customCss = localConfig.dashboard?.customCss ?? [];
|
|
14
14
|
const favicon = localConfig.dashboard?.favicon?.inline ? [localConfig.dashboard.favicon.inline] : [];
|
|
15
15
|
const baseDir = options.configFileDir;
|
|
16
|
-
return [
|
|
16
|
+
return [
|
|
17
|
+
...files.map(id => toProductionEntry(toAbsolute(id, baseDir))),
|
|
18
|
+
...[...renderer, ...customCss, ...favicon].map(id => toDeferResolveProductionEntry(toAbsolute(id, baseDir))),
|
|
19
|
+
];
|
|
17
20
|
};
|
|
18
21
|
const args = {
|
|
19
22
|
binaries: ['lunaria'],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { toDependency } from '../../util/input.js';
|
|
1
|
+
import { toDeferResolve, toDependency } from '../../util/input.js';
|
|
2
|
+
import { isInternal } from '../../util/path.js';
|
|
2
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
4
|
import { getArgumentValues } from './helpers.js';
|
|
4
5
|
const title = 'markdownlint';
|
|
@@ -35,7 +36,12 @@ const resolveConfig = (config, options) => {
|
|
|
35
36
|
const uses = scripts
|
|
36
37
|
.filter(script => script.includes('markdownlint ') || script.includes('markdownlint-cli2 '))
|
|
37
38
|
.flatMap(script => getArgumentValues(script, / (--rules|-r)[ =]([^ ]+)/g));
|
|
38
|
-
return [
|
|
39
|
+
return [
|
|
40
|
+
...dependencies.filter(id => !isBundled(id)).map(id => (isInternal(id) ? toDeferResolve(id) : toDependency(id))),
|
|
41
|
+
...uses
|
|
42
|
+
.filter(id => !isBundled(id))
|
|
43
|
+
.map(id => (isInternal(id) ? toDeferResolve(id, { dir: options.cwd }) : toDependency(id))),
|
|
44
|
+
];
|
|
39
45
|
};
|
|
40
46
|
const plugin = {
|
|
41
47
|
title,
|
|
@@ -44,9 +44,9 @@ const resolveConfig = (localConfig, options) => {
|
|
|
44
44
|
}
|
|
45
45
|
return inputs;
|
|
46
46
|
};
|
|
47
|
-
const registerCompilers = async ({ cwd, registerCompiler, hasDependency }) => {
|
|
47
|
+
const registerCompilers = async ({ cwd, dependencies, registerCompiler, hasDependency }) => {
|
|
48
48
|
if (hasDependency('marko')) {
|
|
49
|
-
const { tagDependencies, fallbackDependencies } = await getTaglibDependencies(cwd);
|
|
49
|
+
const { tagDependencies, fallbackDependencies } = await getTaglibDependencies(cwd, dependencies);
|
|
50
50
|
registerCompiler({ extension: '.marko', compiler: createCompiler(tagDependencies, fallbackDependencies) });
|
|
51
51
|
}
|
|
52
52
|
};
|
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
import { readdirSync } from 'node:fs';
|
|
2
2
|
import { isFile, loadJSON } from '../../util/fs.js';
|
|
3
3
|
import { basename, dirname, join } from '../../util/path.js';
|
|
4
|
-
|
|
4
|
+
import { resolvePackageFilePath } from '../../util/resolve.js';
|
|
5
5
|
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
6
|
-
const
|
|
7
|
-
const manifest = await loadJSON(join(cwd, 'package.json'));
|
|
8
|
-
const dependencies = new Set();
|
|
9
|
-
if (!isRecord(manifest))
|
|
10
|
-
return dependencies;
|
|
11
|
-
for (const field of dependencyFields) {
|
|
12
|
-
const values = manifest[field];
|
|
13
|
-
if (isRecord(values))
|
|
14
|
-
for (const packageName in values)
|
|
15
|
-
dependencies.add(packageName);
|
|
16
|
-
}
|
|
17
|
-
return dependencies;
|
|
18
|
-
};
|
|
19
|
-
const findConfig = (cwd, packageName) => {
|
|
20
|
-
let dir = cwd;
|
|
21
|
-
while (true) {
|
|
22
|
-
const filePath = join(dir, 'node_modules', packageName, 'marko.json');
|
|
23
|
-
if (isFile(filePath))
|
|
24
|
-
return filePath;
|
|
25
|
-
const parent = dirname(dir);
|
|
26
|
-
if (parent === dir)
|
|
27
|
-
return;
|
|
28
|
-
dir = parent;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
6
|
+
const findConfig = (cwd, packageName) => resolvePackageFilePath(`${packageName}/marko.json`, cwd);
|
|
31
7
|
const readDir = (dir) => {
|
|
32
8
|
try {
|
|
33
9
|
return readdirSync(dir, { withFileTypes: true });
|
|
@@ -71,10 +47,10 @@ const getTags = (dir) => {
|
|
|
71
47
|
}
|
|
72
48
|
return tags;
|
|
73
49
|
};
|
|
74
|
-
export const getTaglibDependencies = async (cwd) => {
|
|
50
|
+
export const getTaglibDependencies = async (cwd, dependencies) => {
|
|
75
51
|
const tagDependencies = new Map();
|
|
76
52
|
const fallbackDependencies = [];
|
|
77
|
-
for (const packageName of
|
|
53
|
+
for (const packageName of dependencies) {
|
|
78
54
|
const configPath = findConfig(cwd, packageName);
|
|
79
55
|
if (!configPath)
|
|
80
56
|
continue;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from '../../types/config.ts';
|
|
2
2
|
import { type Input } from '../../util/input.ts';
|
|
3
3
|
export declare const contentMappers: string[];
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const toProviderInput: (provider: string, dir: string) => Input;
|
|
5
|
+
export declare const resolveContentMapperOptions: (options: Record<string, unknown>, dir: string) => Input[];
|
|
5
6
|
declare const plugin: Plugin;
|
|
6
7
|
export default plugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toDeferResolveProductionEntry, toDependency } from '../../util/input.js';
|
|
1
|
+
import { toDeferResolve, toDeferResolveProductionEntry, toDependency } from '../../util/input.js';
|
|
2
2
|
import { isInternal } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
const title = 'MDX';
|
|
@@ -19,11 +19,14 @@ const takeDependencies = (plugins) => {
|
|
|
19
19
|
};
|
|
20
20
|
export const contentMappers = ['mdx-content-mapper', '@mdx-js/content-mapper'];
|
|
21
21
|
const bundledPlugins = ['remark-mdx-frontmatter'];
|
|
22
|
-
export const
|
|
22
|
+
export const toProviderInput = (provider, dir) => isInternal(provider) || provider.startsWith('#')
|
|
23
|
+
? toDeferResolveProductionEntry(provider)
|
|
24
|
+
: toDeferResolve(provider, { dir, production: true });
|
|
25
|
+
export const resolveContentMapperOptions = (options, dir) => {
|
|
23
26
|
const inputs = takeDependencies(options.remarkPlugins).filter(input => !bundledPlugins.includes(input.specifier));
|
|
24
27
|
const provider = options.providerImportSource;
|
|
25
|
-
if (typeof provider === 'string'
|
|
26
|
-
inputs.push(
|
|
28
|
+
if (typeof provider === 'string')
|
|
29
|
+
inputs.push(toProviderInput(provider, dir));
|
|
27
30
|
return inputs;
|
|
28
31
|
};
|
|
29
32
|
const resolveConfig = async (config, options) => {
|