Skip to content

Commit

Permalink
fix: improved types
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Sep 19, 2024
1 parent 10bb289 commit f7e2d23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions packages/packem/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ export const SPECIAL_EXPORT_CONVENTIONS: Set<string> = new Set<string>([DEVELOPM
export const EXCLUDE_REGEXP: RegExp = /node_modules/;

// eslint-disable-next-line @typescript-eslint/no-inferrable-types
export const ENDING_RE: RegExp = /(?:\.d\.[mc]?ts|\.\w+)$/;
export const ENDING_RE: RegExp = /(?:\.d\.[mc]?tsx?|\.\w+)$/;

export const CHUNKS_PACKEM_FOLDER = "packem_chunks";
export const SHARED_PACKEM_FOLDER = "packem_shared";

export const ALLOWED_TRANSFORM_EXTENSIONS_REGEX = /\.(?:m|c)?(?:j|t)sx?$/;
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
export const ALLOWED_TRANSFORM_EXTENSIONS_REGEX: RegExp = /\.(?:m|c)?(?:j|t)sx?$/;
10 changes: 5 additions & 5 deletions packages/packem/src/rollup/plugins/chunk-splitter/parse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import assert from "node:assert/strict";

import { extractAssignedNames } from "@rollup/pluginutils";
import type { ExportAllDeclaration, ExportNamedDeclaration } from "estree";
import type { ExportAllDeclaration, ExportNamedDeclaration, Identifier } from "estree";
import type { ModuleInfo, PluginContext } from "rollup";

import type { ParsedExportInfo } from "./types";
Expand Down Expand Up @@ -45,8 +45,8 @@ const parseExportNamed = function* (statement: ExportNamedDeclaration): Generato
yield {
bindings: statement.specifiers.map((specifier) => {
return {
exportedName: specifier.exported.name,
importedName: specifier.local.name,
exportedName: (specifier.exported as Identifier).name,
importedName: (specifier.local as Identifier).name,
};
}),
from: "other",
Expand All @@ -56,7 +56,7 @@ const parseExportNamed = function* (statement: ExportNamedDeclaration): Generato
} else {
for (const specifier of statement.specifiers) {
yield {
exportedName: specifier.exported.name,
exportedName: (specifier.exported as Identifier).name,
from: "self",
type: "named",
};
Expand All @@ -67,7 +67,7 @@ const parseExportNamed = function* (statement: ExportNamedDeclaration): Generato
const parseExportAll = function* (statement: ExportAllDeclaration): Generator<ParsedExportInfo> {
if (statement.exported) {
yield {
exportedName: statement.exported.name,
exportedName: (statement.exported as Identifier).name,
from: "self",
type: "named",
};
Expand Down

0 comments on commit f7e2d23

Please sign in to comment.