Skip to content

Commit 8fa17a8

Browse files
committed
Improve name of WP file-not-found action callback
1 parent c2ea3e8 commit 8fa17a8

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

packages/php-wasm/node/src/test/php-request-handler.spec.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RecommendedPHPVersion } from '@wp-playground/common';
22
// eslint-disable-next-line @nx/enforce-module-boundaries -- ignore test-related interdependencies so we can test.
3-
import { defaultWordPressFileNotFoundActionCallBack } from '@wp-playground/wordpress';
3+
import { getFileNotFoundActionForWordPress } from '@wp-playground/wordpress';
44
import { loadNodeRuntime } from '..';
55
import {
66
FileNotFoundGetActionCallback,
@@ -427,8 +427,7 @@ describe.each(SupportedPHPVersions)(
427427

428428
describe('WordPress requests', () => {
429429
beforeEach(() => {
430-
getFileNotFoundActionTest =
431-
defaultWordPressFileNotFoundActionCallBack;
430+
getFileNotFoundActionTest = getFileNotFoundActionForWordPress;
432431
});
433432
it('should delegate request for non-existent PHP file to /index.php with query args', async () => {
434433
php.writeFile(

packages/playground/remote/src/lib/worker-thread.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import playgroundWebMuPlugin from './playground-mu-plugin/0-playground.php?raw';
3838
import { PHPResponse, PHPWorker } from '@php-wasm/universal';
3939
import {
4040
bootWordPress,
41-
defaultWordPressFileNotFoundActionCallBack,
41+
getFileNotFoundActionForWordPress,
4242
getLoadedWordPressVersion,
4343
} from '@wp-playground/wordpress';
4444
import { wpVersionToStaticAssetsDirectory } from '@wp-playground/wordpress-builds';
@@ -266,7 +266,7 @@ try {
266266
),
267267
};
268268
} else {
269-
return defaultWordPressFileNotFoundActionCallBack(relativeUri);
269+
return getFileNotFoundActionForWordPress(relativeUri);
270270
}
271271
},
272272
});

packages/playground/wordpress/src/boot.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ export async function bootWordPress(options: BootOptions) {
178178
absoluteUrl: options.siteUrl,
179179
rewriteRules: wordPressRewriteRules,
180180
getFileNotFoundAction:
181-
options.getFileNotFoundAction ??
182-
defaultWordPressFileNotFoundActionCallBack,
181+
options.getFileNotFoundAction ?? getFileNotFoundActionForWordPress,
183182
});
184183

185184
const php = await requestHandler.getPrimaryPhp();
@@ -268,7 +267,7 @@ async function installWordPress(php: PHP) {
268267
);
269268
}
270269

271-
export function defaultWordPressFileNotFoundActionCallBack(
270+
export function getFileNotFoundActionForWordPress(
272271
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- maintain consistent FileNotFoundGetActionCallback signature
273272
relativeUri: string
274273
): FileNotFoundAction {

packages/playground/wordpress/src/index.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { PHP, UniversalPHP } from '@php-wasm/universal';
22
import { joinPaths, phpVar } from '@php-wasm/util';
33
import { unzipFile } from '@wp-playground/common';
4-
export {
5-
bootWordPress,
6-
defaultWordPressFileNotFoundActionCallBack,
7-
} from './boot';
4+
export { bootWordPress, getFileNotFoundActionForWordPress } from './boot';
85
export {
96
getLoadedWordPressVersion,
107
isSupportedWordPressVersion,

0 commit comments

Comments
 (0)