File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
tools/pfe-tools/dev-server Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ function cors(ctx: Context, next: Next) {
7474
7575async function cacheBusterMiddleware ( ctx : Context , next : Next ) {
7676 await next ( ) ;
77- if ( ctx . path . match ( / e l e m e n t s \/ [ \w - ] + \/ [ \w - ] + .j s $ / ) ) {
77+ if ( ctx . path . match ( / ( e l e m e n t s | p f e - c o r e ) \/ . * \ .j s $ / ) ) {
7878 const lm = new Date ( ) . toString ( ) ;
7979 const etag = Date . now ( ) . toString ( ) ;
8080 ctx . response . set ( 'Cache-Control' , 'no-store, no-cache, must-revalidate' ) ;
@@ -87,8 +87,18 @@ async function cacheBusterMiddleware(ctx: Context, next: Next) {
8787function liveReloadTsChangesMiddleware (
8888 config : ReturnType < typeof normalizeOptions > ,
8989) : Middleware {
90+ /**
91+ * capture group 1:
92+ * Either config.elementsDir or `pfe-core`
93+ * `/`
94+ * **ANY** (_>= 0x_)
95+ * `.js`
96+ */
97+ const TYPESCRIPT_SOURCES_RE = new RegExp ( `(${ config . elementsDir } |pfe-core)/.*\\.js` ) ;
98+
9099 return function ( ctx , next ) {
91- if ( ! ctx . path . includes ( 'node_modules' ) && ctx . path . match ( new RegExp ( `/^${ config ?. elementsDir } \\/.*.js/` ) ) ) {
100+ if ( ! ctx . path . includes ( 'node_modules' ) && ctx . path
101+ . match ( TYPESCRIPT_SOURCES_RE ) ) {
92102 ctx . redirect ( ctx . path . replace ( '.js' , '.ts' ) ) ;
93103 } else {
94104 return next ( ) ;
You can’t perform that action at this time.
0 commit comments