oox 0.3.0-beta10 → 0.3.0-beta11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/loader.mjs +17 -7
  2. package/package.json +1 -1
package/bin/loader.mjs CHANGED
@@ -187,14 +187,16 @@ function ooxRPCImportTransform ( originalSpecifier, specifier, parentURL ) {
187
187
 
188
188
  const { entryFile } = oox.config
189
189
 
190
+ const url = new URL ( specifier )
191
+
190
192
  const groupURL = entryFile.group ? new URL ( '/' + entryFile.group, 'file://' ) : null
191
193
 
192
194
  // OOX RPC Proxy URL generation
193
- if ( !specifier.endsWith ( entryFile.path ) && groupURL && specifier.startsWith ( groupURL.href ) ) {
195
+ if ( !specifier.endsWith ( entryFile.path ) && groupURL && url.href.startsWith ( groupURL.href ) ) {
194
196
 
195
- const subSpecifier = specifier.slice ( groupURL.href.length )
197
+ const subSpecifier = url.href.slice ( groupURL.href.length )
196
198
 
197
- const matchResult = subSpecifier.match ( /^\/?([\w-]+)(\/index)?(\.m?js)?$/ )
199
+ const matchResult = subSpecifier.match ( /^\/?([\w-]+)(\/index)?(\.((\w?js)|(ts\w?)))?$/ )
198
200
 
199
201
  if ( matchResult ) {
200
202
 
@@ -304,17 +306,25 @@ export async function resolve ( specifier, context, defaultResolve ) {
304
306
 
305
307
  if ( !isFileURL ( specifier ) ) {
306
308
 
307
- const { url } = defaultResolve ( specifier, context, defaultResolve )
309
+ try {
310
+
311
+ specifier = defaultResolve ( specifier, context, defaultResolve ).url
312
+ } catch ( error ) {
313
+
314
+ if ( !isFileURL ( parentURL ) ) throw error
315
+
316
+ const _specifier = directoryImportTransform ( new URL ( specifier, parentURL ).href )
308
317
 
309
- specifier = url
318
+ if ( _specifier === specifier ) throw error
319
+
320
+ specifier = _specifier
321
+ }
310
322
  }
311
323
 
312
324
  const ooxRPCTransform = ooxRPCImportTransform ( originalSpecifier, specifier, parentURL )
313
325
 
314
326
  if ( ooxRPCTransform ) return ooxRPCTransform
315
327
 
316
- specifier = directoryImportTransform ( specifier )
317
-
318
328
  if ( useCompatLoader ) {
319
329
 
320
330
  const iterator = compatLoaders.values ( )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oox",
3
- "version": "0.3.0-beta10",
3
+ "version": "0.3.0-beta11",
4
4
  "description": "Graceful NodeJS distributed application solution",
5
5
  "keywords": [
6
6
  "http",