@webqit/oohtml 2.1.18 → 2.1.20

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.
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "wicg-proposal"
15
15
  ],
16
16
  "homepage": "https://webqit.io/tooling/oohtml",
17
- "version": "2.1.18",
17
+ "version": "2.1.20",
18
18
  "license": "MIT",
19
19
  "repository": {
20
20
  "type": "git",
@@ -50,7 +50,7 @@ export default function( config ) {
50
50
  };
51
51
 
52
52
  priv.importRequest = ( callback, signal = null ) => {
53
- const detail = priv.moduleRef && !priv.moduleRef.includes( '#' ) ? `${ priv.moduleRef }#default` : priv.moduleRef;
53
+ const detail = priv.moduleRef && !priv.moduleRef.includes( '#' ) && !priv.moduleRef.includes( '.' ) ? `${ priv.moduleRef }#default` : priv.moduleRef;
54
54
  const request = _HTMLImportsContext.createRequest( { detail, live: signal && true, signal } );
55
55
  HTMLContextManager.instance( this.el.isConnected ? this.el.parentNode : priv.anchorNode.parentNode ).ask( request, response => {
56
56
  callback( ( response instanceof Set ? new Set( response ) : response ) || [] );
@@ -40,7 +40,7 @@ export default class _HTMLImportsContext extends HTMLContext {
40
40
  // Parse and translate detail
41
41
  if ( ( event.request.detail || '' ).trim() === '/' ) return event.respondWith( this.modules );
42
42
  const $config = this.constructor.config;
43
- let path = ( event.request.detail || '' ).split( /\/|(?<=\w)(?=\W)/g ).map( x => x.trim() ).filter( x => x );
43
+ let path = ( event.request.detail || '' ).split( /\/|(?<=\w)(?=#)/g ).map( x => x.trim() ).filter( x => x );
44
44
  if ( path.length ) { path = path.join( `/${ $config.template.api.modules }/` )?.split( '/' ) || []; }
45
45
  // No detail?
46
46
  if ( !path.length ) return event.respondWith();
@@ -19,7 +19,7 @@ export default function init( { advanced = {}, ...$config } ) {
19
19
  advanced: resolveParams( advanced, {
20
20
  parserParams: { allowReturnOutsideFunction: false, allowSuperOutsideMethod: false },
21
21
  compilerParams: { globalsNoObserve: [ 'alert' ] },
22
- runtimeParams: { apiVersion: 2 },
22
+ runtimeParams: { apiVersion: 2, compileFunction: this.webqit.compileFunctionCallback },
23
23
  } ),
24
24
  } );
25
25
  config.scriptSelector = ( Array.isArray( config.script.mimeType ) ? config.script.mimeType : [ config.script.mimeType ] ).reduce( ( selector, mm ) => {
@@ -27,7 +27,7 @@ export default function init( { advanced = {}, ...$config } ) {
27
27
  return selector.concat( `script${ qualifier }[scoped],script${ qualifier }[contract]` );
28
28
  }, [] ).join( ',' );
29
29
  window.webqit.oohtml.Script = { compileCache: [ new Map, new Map, ] };
30
- window.webqit.SubscriptFunction = config.SubscriptFunction/* allow for injection, e.g. from test runner */ || SubscriptFunction;
30
+ window.webqit.SubscriptFunction/* if already injected */ || ( window.webqit.SubscriptFunction = SubscriptFunction );
31
31
  window.webqit.Observer = Observer;
32
32
  realtime.call( window, config );
33
33
  }
package/test/index.js CHANGED
@@ -55,16 +55,13 @@ export function createDocumentForScopedJS( head = '', body = '', callback = null
55
55
  window.testRecords = [];
56
56
  createContext( window );
57
57
  // Running advanced scripts
58
- init.call( window, { SCOPED_JS: {
58
+ window.webqit = {
59
59
  SubscriptFunction,
60
- advanced: {
61
- runtimeParams: {
62
- compileFunction: ( code, parameters ) => compileFunction( code, parameters, {
63
- parsingContext: window,
64
- } ),
65
- }
66
- }
67
- } } );
60
+ compileFunctionCallback: ( code, parameters ) => compileFunction( code, parameters, {
61
+ parsingContext: window,
62
+ } ),
63
+ };
64
+ init.call( window );
68
65
  // Running basic scripts
69
66
  const dom = webqitDom.call( window );
70
67
  if ( params.runScripts !== 'dangerously' ) {