mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
fix import
This commit is contained in:
parent
7d56f52a25
commit
1fcd668be4
@ -1,10 +1,36 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { defineConfig } from 'tsup';
|
||||
import { createBasePlugin } from './plugins';
|
||||
|
||||
|
||||
const customNoExternal = new Set([
|
||||
"oauth4webapi",
|
||||
]);
|
||||
|
||||
// https://github.com/egoist/tsup/issues/953
|
||||
const fixImportExtensions = (extension: string = ".js") => ({
|
||||
name: "fix-import-extensions",
|
||||
setup(build) {
|
||||
build.onResolve({ filter: /.*/ }, (args) => {
|
||||
if (args.importer) {
|
||||
const filePath = path.join(args.resolveDir, args.path);
|
||||
let resolvedPath;
|
||||
|
||||
console.log(filePath);
|
||||
|
||||
if (fs.existsSync(filePath + ".ts") || fs.existsSync(filePath + ".tsx")) {
|
||||
resolvedPath = args.path + extension;
|
||||
} else if (fs.existsSync(path.join(filePath, `index.ts`)) || fs.existsSync(path.join(filePath, `index.tsx`))) {
|
||||
resolvedPath = args.path.endsWith("/") ? args.path + "index" + extension : args.path + "/index" + extension;
|
||||
}
|
||||
return { path: resolvedPath ?? args.path, external: true };
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
export default function createJsLibraryTsupConfig(options: { barrelFile: boolean }) {
|
||||
return defineConfig({
|
||||
entryPoints: ['src/**/*.(ts|tsx|js|jsx)'],
|
||||
@ -16,6 +42,7 @@ export default function createJsLibraryTsupConfig(options: { barrelFile: boolean
|
||||
format: ['esm', 'cjs'],
|
||||
legacyOutput: true,
|
||||
esbuildPlugins: [
|
||||
fixImportExtensions(),
|
||||
createBasePlugin({}),
|
||||
{
|
||||
name: 'stackframe: force most files to be external',
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export {
|
||||
StackAdminInterface
|
||||
} from "./interface/adminInterface";
|
||||
} from "./interface/admin-interface";
|
||||
export {
|
||||
StackClientInterface
|
||||
} from "./interface/clientInterface";
|
||||
} from "./interface/client-interface";
|
||||
export {
|
||||
StackServerInterface
|
||||
} from "./interface/serverInterface";
|
||||
} from "./interface/server-interface";
|
||||
export {
|
||||
KnownError,
|
||||
KnownErrors
|
||||
|
||||
@ -6,7 +6,7 @@ import { ProjectPermissionDefinitionsCrud } from "./crud/project-permissions";
|
||||
import { ProjectsCrud } from "./crud/projects";
|
||||
import { SvixTokenCrud } from "./crud/svix-token";
|
||||
import { TeamPermissionDefinitionsCrud } from "./crud/team-permissions";
|
||||
import { ServerAuthApplicationOptions, StackServerInterface } from "./serverInterface";
|
||||
import { ServerAuthApplicationOptions, StackServerInterface } from "./server-interface";
|
||||
|
||||
export type AdminAuthApplicationOptions = ServerAuthApplicationOptions &(
|
||||
| {
|
||||
@ -7,7 +7,7 @@ import { urlString } from "../utils/urls";
|
||||
import {
|
||||
ClientInterfaceOptions,
|
||||
StackClientInterface
|
||||
} from "./clientInterface";
|
||||
} from "./client-interface";
|
||||
import { ContactChannelsCrud } from "./crud/contact-channels";
|
||||
import { CurrentUserCrud } from "./crud/current-user";
|
||||
import { ConnectedAccountAccessTokenCrud } from "./crud/oauth";
|
||||
@ -1,6 +1,6 @@
|
||||
import { StackAdminInterface } from "@stackframe/stack-shared";
|
||||
import { getProductionModeErrors } from "@stackframe/stack-shared/dist/helpers/production-mode";
|
||||
import { InternalApiKeyCreateCrudResponse } from "@stackframe/stack-shared/dist/interface/adminInterface";
|
||||
import { InternalApiKeyCreateCrudResponse } from "@stackframe/stack-shared/dist/interface/admin-interface";
|
||||
import { EmailTemplateCrud, EmailTemplateType } from "@stackframe/stack-shared/dist/interface/crud/email-templates";
|
||||
import { InternalApiKeysCrud } from "@stackframe/stack-shared/dist/interface/crud/internal-api-keys";
|
||||
import { ProjectsCrud } from "@stackframe/stack-shared/dist/interface/crud/projects";
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { InternalApiKeyCreateCrudRequest } from "@stackframe/stack-shared/dist/interface/adminInterface";
|
||||
|
||||
import { InternalApiKeyCreateCrudRequest } from "@stackframe/stack-shared/dist/interface/admin-interface";
|
||||
import { InternalApiKeysCrud } from "@stackframe/stack-shared/dist/interface/crud/internal-api-keys";
|
||||
|
||||
export type InternalApiKeyBase = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user