Skip to content

Commit 5deca8e

Browse files
authored
Merge pull request #2 from drudrum/master
remove difference
2 parents 6d26642 + f401a35 commit 5deca8e

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const noop = () => {};
4545
*/
4646

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

5151
/** @typedef {ReturnType<Compiler["getInfrastructureLogger"]>} Logger */
@@ -88,6 +88,7 @@ const noop = () => {};
8888
* @property {boolean} [serverSideRender]
8989
* @property {OutputFileSystem} [outputFileSystem]
9090
* @property {boolean | string} [index]
91+
* @property {boolean | undefined} [historyApiFallback]
9192
*/
9293

9394
/**

src/utils/getFilenameFromUrl.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ function getFilenameFromUrl(context, url) {
9696
}
9797

9898
if (
99-
options.historyApiFallback &&
100-
!context.outputFileSystem.existsSync(filename)
99+
context.outputFileSystem.existsSync &&
100+
!context.outputFileSystem.existsSync(filename) &&
101+
options.historyApiFallback
101102
) {
102103
filename = path.join(outputPath);
103104
}

test/validation-options.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe("validation", () => {
4141
},
4242
historyApiFallback: {
4343
success: [true],
44-
failure: ["foo", 10],
44+
failure: [],
4545
},
4646
serverSideRender: {
4747
success: [true],

types/index.d.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export = wdm;
2828
* @typedef {ReturnType<Compiler["watch"]>} MultiWatching
2929
*/
3030
/**
31-
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, readFileSync?: import("fs").readFileSync }} OutputFileSystem
31+
* @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, existsSync?: import("fs").existsSync, readFileSync?: import("fs").readFileSync }} OutputFileSystem
3232
*/
3333
/** @typedef {ReturnType<Compiler["getInfrastructureLogger"]>} Logger */
3434
/**
@@ -66,6 +66,7 @@ export = wdm;
6666
* @property {boolean} [serverSideRender]
6767
* @property {OutputFileSystem} [outputFileSystem]
6868
* @property {boolean | string} [index]
69+
* @property {boolean | undefined} [historyApiFallback]
6970
*/
7071
/**
7172
* @template {IncomingMessage} RequestInternal
@@ -172,6 +173,7 @@ type Options<
172173
serverSideRender?: boolean | undefined;
173174
outputFileSystem?: OutputFileSystem | undefined;
174175
index?: string | boolean | undefined;
176+
historyApiFallback?: boolean | undefined;
175177
};
176178
type API<
177179
RequestInternal extends import("http").IncomingMessage,
@@ -204,6 +206,7 @@ type OutputFileSystem = Compiler["outputFileSystem"] & {
204206
createReadStream?: typeof import("fs").createReadStream;
205207
statSync?: import("fs").StatSyncFn;
206208
lstat?: typeof import("fs").lstat;
209+
existsSync?: typeof import("fs").existsSync;
207210
readFileSync?: typeof import("fs").readFileSync;
208211
};
209212
type Logger = ReturnType<Compiler["getInfrastructureLogger"]>;

0 commit comments

Comments
 (0)