@webqit/oohtml 2.1.46 → 2.1.47
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/README.md +5 -5
- package/dist/main.js +9 -9
- package/dist/main.js.map +3 -3
- package/dist/scoped-js.js +13 -13
- package/dist/scoped-js.js.map +3 -3
- package/package.json +3 -3
- package/src/scoped-js/Compiler.js +3 -3
- package/src/scoped-js/index.js +4 -4
- package/test/index.js +1 -1
- package/test/scoped-css.test.js +1 -1
- package/test/scoped-js.test.js +1 -1
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.
|
|
17
|
+
"version": "2.1.47",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"postpublish": "git push && git push --tags"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@webqit/contract": "^2.1.48",
|
|
41
42
|
"@webqit/observer": "^2.1.5",
|
|
42
43
|
"@webqit/realdom": "^2.1.12",
|
|
43
|
-
"@webqit/subscript": "^2.1.41",
|
|
44
44
|
"@webqit/util": "^0.8.11"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@webqit/oohtml-ssr": "^1.2.
|
|
47
|
+
"@webqit/oohtml-ssr": "^1.2.13",
|
|
48
48
|
"chai": "^4.3.4",
|
|
49
49
|
"coveralls": "^3.1.1",
|
|
50
50
|
"esbuild": "^0.14.43",
|
|
@@ -54,7 +54,7 @@ export default class Compiler {
|
|
|
54
54
|
// Compile scipt
|
|
55
55
|
compile( script, thisContext ) {
|
|
56
56
|
const _static = this.constructor;
|
|
57
|
-
const { webqit: { oohtml,
|
|
57
|
+
const { webqit: { oohtml, ContractFunction } } = this.window;
|
|
58
58
|
const cache = oohtml.Script.compileCache[ script.contract ? 0 : 1 ];
|
|
59
59
|
const sourceHash = _static.toHash( script.textContent );
|
|
60
60
|
// Script instances are parsed only once
|
|
@@ -76,8 +76,8 @@ export default class Compiler {
|
|
|
76
76
|
if ( script.contract ) {
|
|
77
77
|
parserParams = { ...parserParams, allowAwaitOutsideFunction: script.type === 'module' };
|
|
78
78
|
runtimeParams = { ...runtimeParams, async: script.type === 'module' };
|
|
79
|
-
_Function =
|
|
80
|
-
Object.defineProperty( script, 'properties', { configurable: true, value:
|
|
79
|
+
_Function = ContractFunction( source, { compilerParams, parserParams, runtimeParams, } );
|
|
80
|
+
Object.defineProperty( script, 'properties', { configurable: true, value: ContractFunction.inspect( _Function, 'properties' ) } );
|
|
81
81
|
} else {
|
|
82
82
|
const isAsync = script.type === 'module'//meta.topLevelAwait || imports.length;
|
|
83
83
|
const _FunctionConstructor = isAsync ? Object.getPrototypeOf( async function() {} ).constructor : Function;
|
package/src/scoped-js/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @imports
|
|
4
4
|
*/
|
|
5
5
|
import { _isTypeObject } from '@webqit/util/js/index.js';
|
|
6
|
-
import { resolveParams } from '@webqit/
|
|
7
|
-
import
|
|
6
|
+
import { resolveParams } from '@webqit/contract/src/params.js';
|
|
7
|
+
import ContractFunction from '@webqit/contract/src/ContractFunctionLite.js';
|
|
8
8
|
import Observer from '@webqit/observer';
|
|
9
9
|
import Compiler from './Compiler.js';
|
|
10
10
|
import { _init } from '../util.js';
|
|
@@ -28,13 +28,13 @@ export default function init( { advanced = {}, ...$config } ) {
|
|
|
28
28
|
return selector.concat( `script${ qualifier }[scoped],script${ qualifier }[contract]` );
|
|
29
29
|
}, [] ).join( ',' );
|
|
30
30
|
window.webqit.oohtml.Script = { compileCache: [ new Map, new Map, ] };
|
|
31
|
-
window.webqit.
|
|
31
|
+
window.webqit.ContractFunction = ContractFunction;
|
|
32
32
|
window.webqit.Observer = Observer;
|
|
33
33
|
realtime.call( window, config );
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
ContractFunction,
|
|
38
38
|
Observer,
|
|
39
39
|
}
|
|
40
40
|
|
package/test/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export function createDocument( head = '', body = '', callback = null, ) {
|
|
|
21
21
|
<!DOCTYPE html>
|
|
22
22
|
<html>
|
|
23
23
|
<head>
|
|
24
|
-
<meta name="
|
|
24
|
+
<meta name="contract-compiler-url" content="../contract/dist/compiler.js">
|
|
25
25
|
<script ssr src="/dist/main.js"></script>
|
|
26
26
|
${ head }
|
|
27
27
|
</head>
|
package/test/scoped-css.test.js
CHANGED
|
@@ -21,7 +21,7 @@ describe(`Test: Scoped CSS`, function() {
|
|
|
21
21
|
</div>`;
|
|
22
22
|
|
|
23
23
|
const window = createDocument( head, body );
|
|
24
|
-
await delay( 160 ); // Takes time to dynamically load
|
|
24
|
+
await delay( 160 ); // Takes time to dynamically load Contract compiler
|
|
25
25
|
const styleElement = window.document.querySelector( 'style' );
|
|
26
26
|
|
|
27
27
|
expect( styleElement.textContent.substring( 0, 13 ) ).to.eq( '@scope from (' );
|
package/test/scoped-js.test.js
CHANGED
|
@@ -19,7 +19,7 @@ describe(`Test: Scoped JS`, function() {
|
|
|
19
19
|
|
|
20
20
|
const window = createDocument( head, body );
|
|
21
21
|
window.testRecords = [];
|
|
22
|
-
await delay( 160 ); // Takes time to dynamically load
|
|
22
|
+
await delay( 160 ); // Takes time to dynamically load Contract compiler
|
|
23
23
|
|
|
24
24
|
expect( window.testRecords ).to.have.length( 1 );
|
|
25
25
|
expect( window.testRecords[ 0 ] ).to.eql( window.document.body );
|