Fix organize-imports-cli with satisfies operator (#7727)

This commit is contained in:
Bjorn Lu 2023-07-20 20:47:36 +08:00 committed by GitHub
parent 47c698b08a
commit d8bae784b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 80 additions and 64 deletions

View file

@ -5,6 +5,10 @@ examples/with-nanostores/src/layouts
# Ignoring this file for now due to https://github.com/withastro/compiler/issues/485
packages/markdown/component/Markdown.astro
# Benchmark artifacts
benchmark/projects/
benchmark/results/
# Deep Directories
**/dist
**/smoke

View file

@ -53,6 +53,7 @@
}
},
"overrides": {
"organize-imports-cli>ts-morph": "^19.0.0",
"tsconfig-resolver>type-fest": "3.0.0"
},
"peerDependencyRules": {

View file

@ -1,4 +1,4 @@
import { codecs as supportedFormats, preprocessors } from './codecs.js'
import { preprocessors, codecs as supportedFormats } from './codecs.js'
import ImageData from './image_data.js'
type EncoderKey = keyof typeof supportedFormats

View file

@ -1,5 +1,5 @@
import type { MarkdownHeading } from '@astrojs/markdown-remark';
import { string as zodString, ZodIssueCode } from 'zod';
import { ZodIssueCode, string as zodString } from 'zod';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { prependForwardSlash } from '../core/path.js';
import {

View file

@ -37,7 +37,7 @@ import { isServerLikeOutput } from '../../prerender/utils.js';
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import { debug, info } from '../logger/core.js';
import { getRedirectLocationOrThrow, RedirectSinglePageBuiltModule } from '../redirects/index.js';
import { RedirectSinglePageBuiltModule, getRedirectLocationOrThrow } from '../redirects/index.js';
import { isEndpointResult } from '../render/core.js';
import { createEnvironment, createRenderContext, tryRenderRoute } from '../render/index.js';
import { callGetStaticPaths } from '../render/route-cache.js';

View file

@ -1,7 +1,7 @@
import * as crypto from 'node:crypto';
import * as npath from 'node:path';
import type { GetModuleInfo } from 'rollup';
import { type Plugin as VitePlugin, type ResolvedConfig } from 'vite';
import { type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
import { isBuildableCSSRequest } from '../../render/dev/util.js';
import type { BuildInternals } from '../internal';
import type { AstroBuildPlugin } from '../plugin';

View file

@ -1,4 +1,4 @@
import type { Plugin as VitePlugin, UserConfig } from 'vite';
import type { UserConfig, Plugin as VitePlugin } from 'vite';
import type { BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin';
import { normalizeEntryId } from './plugin-component-entry.js';

View file

@ -1,4 +1,4 @@
import type { default as vite, InlineConfig } from 'vite';
import type { InlineConfig, default as vite } from 'vite';
import type {
AstroConfig,
AstroSettings,

View file

@ -3,10 +3,10 @@ export { AstroErrorData } from './errors-data.js';
export {
AggregateError,
AstroError,
CompilerError,
CSSError,
isAstroError,
CompilerError,
MarkdownError,
isAstroError,
} from './errors.js';
export { codeFrame } from './printer.js';
export { createSafeError, positionAt } from './utils.js';

View file

@ -104,4 +104,4 @@ function trySerializeLocals(value: unknown) {
}
// NOTE: this export must export only the functions that will be exposed to user-land as officials APIs
export { sequence, defineMiddleware, createContext, trySerializeLocals };
export { createContext, defineMiddleware, sequence, trySerializeLocals };

View file

@ -2,7 +2,7 @@ import type { ComponentInstance, Params, Props, RouteData } from '../../@types/a
import { AstroError, AstroErrorData } from '../errors/index.js';
import type { LogOptions } from '../logger/core.js';
import { getParams } from '../routing/params.js';
import { callGetStaticPaths, findPathItemByKey, RouteCache } from './route-cache.js';
import { RouteCache, callGetStaticPaths, findPathItemByKey } from './route-cache.js';
interface GetParamsAndPropsOptions {
mod: ComponentInstance;

View file

@ -85,4 +85,4 @@ function createVNode(type: any, props: Record<string, any>) {
return vnode;
}
export { AstroJSX, createVNode as jsx, createVNode as jsxs, createVNode as jsxDEV, Fragment };
export { AstroJSX, Fragment, createVNode as jsx, createVNode as jsxDEV, createVNode as jsxs };

View file

@ -16,6 +16,7 @@ export {
defineScriptVars,
Fragment,
maybeRenderHead,
renderTemplate as render,
renderAstroTemplateResult as renderAstroComponent,
renderComponent,
renderComponentToIterable,
@ -26,7 +27,6 @@ export {
renderScriptElement,
renderSlot,
renderSlotToString,
renderTemplate as render,
renderTemplate,
renderToString,
renderUniqueStylesheet,

View file

@ -2,8 +2,8 @@
import type { SSRResult } from '../../@types/astro.js';
import { AstroJSX, isVNode, type AstroVNode } from '../../jsx-runtime/index.js';
import {
escapeHTML,
HTMLString,
escapeHTML,
markHTMLString,
renderComponentToIterable,
renderToString,

View file

@ -17,7 +17,7 @@ import {
} from './astro/index.js';
import { Fragment, Renderer, stringifyChunk } from './common.js';
import { componentIsHTMLElement, renderHTMLElement } from './dom.js';
import { renderSlots, renderSlotToString, type ComponentSlots } from './slot.js';
import { renderSlotToString, renderSlots, type ComponentSlots } from './slot.js';
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js';
const rendererAliases = new Map([['solid', 'solid-js']]);

View file

@ -12,7 +12,7 @@ import {
isRenderTemplateResult,
renderAstroTemplateResult,
} from './astro/index.js';
import { chunkToByteArray, encoder, HTMLParts } from './common.js';
import { HTMLParts, chunkToByteArray, encoder } from './common.js';
import { renderComponent } from './component.js';
import { maybeRenderHead } from './head.js';

View file

@ -49,7 +49,7 @@ export function fade({
}: {
duration?: string | number;
} = {}): TransitionDirectionalAnimations {
const anim: TransitionAnimationPair = {
const anim = {
old: {
name: 'astroFadeInOut',
duration: duration ?? '0.2s',
@ -62,7 +62,7 @@ export function fade({
easing: 'linear',
fillMode: 'backwards',
},
};
} satisfies TransitionAnimationPair;
return {
forwards: anim,

View file

@ -1,5 +1,5 @@
import path from 'node:path';
import { normalizePath, type Plugin as VitePlugin, type ResolvedConfig } from 'vite';
import { normalizePath, type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
import type { AstroSettings } from '../@types/astro';
type Alias = {

View file

@ -48,14 +48,14 @@ export async function main() {
}
export {
setStdout,
getContext,
intro,
projectName,
template,
dependencies,
getContext,
git,
typescript,
setupTypeScript,
intro,
next,
projectName,
setStdout,
setupTypeScript,
template,
typescript,
};

View file

@ -1,5 +1,5 @@
/* eslint no-console: 'off' */
import { color, label, say as houston, spinner as load } from '@astrojs/cli-kit';
import { color, say as houston, label, spinner as load } from '@astrojs/cli-kit';
import { align, sleep } from '@astrojs/cli-kit/utils';
import { execa } from 'execa';
import fetch from 'node-fetch-native';

View file

@ -1,4 +1,4 @@
import type { ExecutionContext, Request as CFRequest } from '@cloudflare/workers-types';
import type { Request as CFRequest, ExecutionContext } from '@cloudflare/workers-types';
import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
import { getProcessEnvProxy, isNode } from './util.js';

View file

@ -1,4 +1,4 @@
import type { EventContext, Request as CFRequest } from '@cloudflare/workers-types';
import type { Request as CFRequest, EventContext } from '@cloudflare/workers-types';
import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
import { getProcessEnvProxy, isNode } from './util.js';

View file

@ -1,4 +1,4 @@
import { codecs as supportedFormats, preprocessors } from './codecs.js'
import { preprocessors, codecs as supportedFormats } from './codecs.js'
import ImageData from './image_data.js'
type EncoderKey = keyof typeof supportedFormats

View file

@ -6,7 +6,7 @@ import fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import type { ErrorPayload as ViteErrorPayload } from 'vite';
import type { ComponentConfig } from './config.js';
import { isComponentConfig, isValidUrl, MarkdocError, prependForwardSlash } from './utils.js';
import { MarkdocError, isComponentConfig, isValidUrl, prependForwardSlash } from './utils.js';
// @ts-expect-error Cannot get the types here without `moduleResolution: 'nodenext'`
import { emitESMImage } from 'astro/assets/utils';
import path from 'node:path';

View file

@ -3,8 +3,8 @@ import type { AstroConfig, AstroIntegration, ContentEntryType, HookParameters }
import { bold, red } from 'kleur/colors';
import { getContentEntryType } from './content-entry-type.js';
import {
loadMarkdocConfig,
SUPPORTED_MARKDOC_CONFIG_FILES,
loadMarkdocConfig,
type MarkdocConfigResult,
} from './load-config.js';

View file

@ -1,6 +1,6 @@
import type { MarkdownVFile } from '@astrojs/markdown-remark';
import { type Image, type Parent } from 'mdast';
import type { MdxjsEsm, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { MdxJsxFlowElement, MdxjsEsm } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
import { jsToTreeNode } from './utils.js';

View file

@ -110,4 +110,4 @@ function netlifyFunctions({
};
}
export { netlifyFunctions, netlifyFunctions as default };
export { netlifyFunctions as default, netlifyFunctions };

View file

@ -1,4 +1,3 @@
// organize-imports-ignore there's a bug where it strips out this import
import type { SitemapOptions } from './index.js';
export const SITEMAP_CONFIG_DEFAULTS = {

View file

@ -1,4 +1,4 @@
import type { VFile, VFileData as Data } from 'vfile';
import type { VFileData as Data, VFile } from 'vfile';
import type { MarkdownAstroData } from './types.js';
function isValidAstroData(obj: unknown): obj is MarkdownAstroData {

View file

@ -1,8 +1,8 @@
import type * as hast from 'hast';
import type * as mdast from 'mdast';
import type {
all as Handlers,
one as Handler,
all as Handlers,
Options as RemarkRehypeOptions,
} from 'remark-rehype';
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';

View file

@ -1,4 +1,4 @@
import { isCI, name as ciName } from 'ci-info';
import { name as ciName, isCI } from 'ci-info';
import isDocker from 'is-docker';
import isWSL from 'is-wsl';
import os from 'node:os';

View file

@ -15,7 +15,7 @@ import {
WritableStreamDefaultController,
WritableStreamDefaultWriter,
} from 'node:stream/web' // Remove when Node 16 is dropped for Node 18.
import { fetch, File, FormData, Headers, Request, Response } from 'undici' // Remove when Node 16 is dropped for Node 18.
import { File, FormData, Headers, Request, Response, fetch } from 'undici' // Remove when Node 16 is dropped for Node 18.
import { URLPattern } from 'urlpattern-polyfill'
import {
cancelAnimationFrame,
@ -25,9 +25,9 @@ import { CharacterData, Comment, Text } from './lib/CharacterData'
import { CustomEvent } from './lib/CustomEvent' // Look into removing when Node 18 is dropped for Node 20
import { DOMException } from './lib/DOMException'
import { cancelIdleCallback, requestIdleCallback } from './lib/IdleCallback'
import structuredClone from './lib/structuredClone' // Remove when Node 16 is dropped for Node 18.
import { clearTimeout, setTimeout } from './lib/Timeout'
import { TreeWalker } from './lib/TreeWalker'
import structuredClone from './lib/structuredClone' // Remove when Node 16 is dropped for Node 18.
import { CanvasRenderingContext2D } from './lib/CanvasRenderingContext2D'
import {
@ -51,7 +51,7 @@ import { HTMLCanvasElement } from './lib/HTMLCanvasElement'
import { HTMLImageElement } from './lib/HTMLImageElement'
import { Image } from './lib/Image'
import { ImageData } from './lib/ImageData'
import { initMediaQueryList, MediaQueryList } from './lib/MediaQueryList'
import { MediaQueryList, initMediaQueryList } from './lib/MediaQueryList'
import {
DocumentFragment,
Node,
@ -65,19 +65,19 @@ import {
ResizeObserver,
} from './lib/Observer'
import { OffscreenCanvas } from './lib/OffscreenCanvas'
import { initStorage, Storage } from './lib/Storage'
import { Storage, initStorage } from './lib/Storage'
import { CSSStyleSheet, StyleSheet } from './lib/StyleSheet'
import { initWindow, Window } from './lib/Window'
import { Window, initWindow } from './lib/Window'
import { alert } from './lib/Alert'
export {
ByteLengthQueuingStrategy,
CSSStyleSheet,
CanvasRenderingContext2D,
CharacterData,
Comment,
CountQueuingStrategy,
CSSStyleSheet,
CustomElementRegistry,
CustomEvent,
DOMException,
@ -88,7 +88,6 @@ export {
EventTarget,
File,
FormData,
Headers,
HTMLBodyElement,
HTMLCanvasElement,
HTMLDivElement,
@ -101,6 +100,7 @@ export {
HTMLStyleElement,
HTMLTemplateElement,
HTMLUnknownElement,
Headers,
Image,
ImageData,
IntersectionObserver,
@ -126,23 +126,23 @@ export {
TransformStream,
TreeWalker,
URLPattern,
Window,
WritableStream,
WritableStreamDefaultController,
WritableStreamDefaultWriter,
Window,
alert,
cancelAnimationFrame,
cancelIdleCallback,
clearTimeout,
crypto,
fetch,
requestAnimationFrame,
requestIdleCallback,
setTimeout,
structuredClone,
initCustomElementRegistry,
initDocument,
initMediaQueryList,
initStorage,
initWindow,
requestAnimationFrame,
requestIdleCallback,
setTimeout,
structuredClone,
}

View file

@ -5,6 +5,7 @@ settings:
excludeLinksFromLockfile: false
overrides:
organize-imports-cli>ts-morph: ^19.0.0
tsconfig-resolver>type-fest: 3.0.0
packageExtensionsChecksum: 01871422d489547c532184effb134b35
@ -8492,12 +8493,12 @@ packages:
engines: {node: '>= 10'}
dev: true
/@ts-morph/common@0.16.0:
resolution: {integrity: sha512-SgJpzkTgZKLKqQniCjLaE3c2L2sdL7UShvmTmPBejAKd2OKV/yfMpQ2IWpAuA+VY5wy7PkSUaEObIqEK6afFuw==}
/@ts-morph/common@0.20.0:
resolution: {integrity: sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q==}
dependencies:
fast-glob: 3.2.12
minimatch: 5.1.6
mkdirp: 1.0.4
minimatch: 7.4.6
mkdirp: 2.1.6
path-browserify: 1.0.1
dev: true
@ -10152,8 +10153,8 @@ packages:
resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==}
engines: {node: '>=0.8'}
/code-block-writer@11.0.3:
resolution: {integrity: sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw==}
/code-block-writer@12.0.0:
resolution: {integrity: sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w==}
dev: true
/color-convert@1.9.3:
@ -14085,6 +14086,14 @@ packages:
engines: {node: '>=10'}
dependencies:
brace-expansion: 2.0.1
dev: false
/minimatch@7.4.6:
resolution: {integrity: sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==}
engines: {node: '>=10'}
dependencies:
brace-expansion: 2.0.1
dev: true
/minimist-options@4.1.0:
resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==}
@ -14141,6 +14150,13 @@ packages:
resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
engines: {node: '>=10'}
hasBin: true
dev: false
/mkdirp@2.1.6:
resolution: {integrity: sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A==}
engines: {node: '>=10'}
hasBin: true
dev: true
/mlly@1.2.1:
resolution: {integrity: sha512-1aMEByaWgBPEbWV2BOPEMySRrzl7rIHXmQxam4DM8jVjalTQDjpN2ZKOLUrwyhfZQO7IXHml2StcHMhooDeEEQ==}
@ -14548,7 +14564,7 @@ packages:
dependencies:
chalk: 4.1.2
editorconfig: 0.15.3
ts-morph: 15.1.0
ts-morph: 19.0.0
tsconfig: 7.0.0
dev: true
@ -16926,11 +16942,11 @@ packages:
/ts-interface-checker@0.1.13:
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
/ts-morph@15.1.0:
resolution: {integrity: sha512-RBsGE2sDzUXFTnv8Ba22QfeuKbgvAGJFuTN7HfmIRUkgT/NaVLfDM/8OFm2NlFkGlWEXdpW5OaFIp1jvqdDuOg==}
/ts-morph@19.0.0:
resolution: {integrity: sha512-D6qcpiJdn46tUqV45vr5UGM2dnIEuTGNxVhg0sk5NX11orcouwj6i1bMqZIz2mZTZB1Hcgy7C3oEVhAT+f6mbQ==}
dependencies:
'@ts-morph/common': 0.16.0
code-block-writer: 11.0.3
'@ts-morph/common': 0.20.0
code-block-writer: 12.0.0
dev: true
/tsconfig-resolver@3.0.1:
@ -18269,25 +18285,21 @@ packages:
file:packages/astro/test/fixtures/css-assets/packages/font-awesome:
resolution: {directory: packages/astro/test/fixtures/css-assets/packages/font-awesome, type: directory}
name: '@test/astro-font-awesome-package'
version: 0.0.1
dev: false
file:packages/astro/test/fixtures/multiple-renderers/renderers/one:
resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/one, type: directory}
name: '@test/astro-renderer-one'
version: 1.0.0
dev: false
file:packages/astro/test/fixtures/multiple-renderers/renderers/two:
resolution: {directory: packages/astro/test/fixtures/multiple-renderers/renderers/two, type: directory}
name: '@test/astro-renderer-two'
version: 1.0.0
dev: false
file:packages/astro/test/fixtures/solid-component/deps/solid-jsx-component:
resolution: {directory: packages/astro/test/fixtures/solid-component/deps/solid-jsx-component, type: directory}
name: '@test/solid-jsx-component'
version: 0.0.0
dependencies:
solid-js: 1.7.6
dev: false