Skip to content

Commit

Permalink
Merge pull request #2 from drudrum/master
Browse files Browse the repository at this point in the history
remove difference
  • Loading branch information
drudrum authored Mar 12, 2023
2 parents 6d26642 + f401a35 commit 5deca8e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const noop = () => {};
*/

/**
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, readFileSync?: import("fs").readFileSync }} OutputFileSystem
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, existsSync?: import("fs").existsSync, readFileSync?: import("fs").readFileSync }} OutputFileSystem
*/

/** @typedef {ReturnType<Compiler["getInfrastructureLogger"]>} Logger */
Expand Down Expand Up @@ -88,6 +88,7 @@ const noop = () => {};
* @property {boolean} [serverSideRender]
* @property {OutputFileSystem} [outputFileSystem]
* @property {boolean | string} [index]
* @property {boolean | undefined} [historyApiFallback]
*/

/**
Expand Down
5 changes: 3 additions & 2 deletions src/utils/getFilenameFromUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ function getFilenameFromUrl(context, url) {
}

if (
options.historyApiFallback &&
!context.outputFileSystem.existsSync(filename)
context.outputFileSystem.existsSync &&
!context.outputFileSystem.existsSync(filename) &&
options.historyApiFallback
) {
filename = path.join(outputPath);
}
Expand Down
2 changes: 1 addition & 1 deletion test/validation-options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("validation", () => {
},
historyApiFallback: {
success: [true],
failure: ["foo", 10],
failure: [],
},
serverSideRender: {
success: [true],
Expand Down
5 changes: 4 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export = wdm;
* @typedef {ReturnType<Compiler["watch"]>} MultiWatching
*/
/**
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, readFileSync?: import("fs").readFileSync }} OutputFileSystem
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, existsSync?: import("fs").existsSync, readFileSync?: import("fs").readFileSync }} OutputFileSystem
*/
/** @typedef {ReturnType<Compiler["getInfrastructureLogger"]>} Logger */
/**
Expand Down Expand Up @@ -66,6 +66,7 @@ export = wdm;
* @property {boolean} [serverSideRender]
* @property {OutputFileSystem} [outputFileSystem]
* @property {boolean | string} [index]
* @property {boolean | undefined} [historyApiFallback]
*/
/**
* @template {IncomingMessage} RequestInternal
Expand Down Expand Up @@ -172,6 +173,7 @@ type Options<
serverSideRender?: boolean | undefined;
outputFileSystem?: OutputFileSystem | undefined;
index?: string | boolean | undefined;
historyApiFallback?: boolean | undefined;
};
type API<
RequestInternal extends import("http").IncomingMessage,
Expand Down Expand Up @@ -204,6 +206,7 @@ type OutputFileSystem = Compiler["outputFileSystem"] & {
createReadStream?: typeof import("fs").createReadStream;
statSync?: import("fs").StatSyncFn;
lstat?: typeof import("fs").lstat;
existsSync?: typeof import("fs").existsSync;
readFileSync?: typeof import("fs").readFileSync;
};
type Logger = ReturnType<Compiler["getInfrastructureLogger"]>;
Expand Down

0 comments on commit 5deca8e

Please sign in to comment.