native-document 1.0.276 → 1.0.277

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.
@@ -0,0 +1,2 @@
1
+
2
+ export const TRANSFORMED_OBSERVABLE_ID = '#__@TRANSFORMED_OBSERVABLE_ID@__#';
@@ -2,10 +2,13 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
 
4
4
  import { fileURLToPath } from 'node:url';
5
+ import {TRANSFORMED_OBSERVABLE_ID} from '../constantes';
5
6
 
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = path.dirname(__filename);
8
9
 
10
+
11
+
9
12
  export function template(code, params) {
10
13
  let codeFormatted = code;
11
14
  for(const key in params) {
@@ -46,7 +49,7 @@ export function transformObservableDeclarations(code, id) {
46
49
 
47
50
  return code.replace(regex, (match, varType, varName, caller, method) => {
48
51
  const obsName = method ? `${caller}${method}` : caller;
49
- return `${varType} ${varName} = ${obsName}('${varName}', '${id}', (typeof arguments !== 'undefined') ? Array.from(arguments).at(-1) : null, `;
52
+ return `${varType} ${varName} = ${obsName}('${TRANSFORMED_OBSERVABLE_ID}', '${varName}', '${id}', (typeof arguments !== 'undefined') ? Array.from(arguments).at(-1) : null, `;
50
53
  });
51
54
  }
52
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.276",
3
+ "version": "1.0.277",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -1,13 +1,18 @@
1
1
  import {Observable as ObservableOriginal} from './Observable';
2
+ import {call} from '@babel/traverse/lib/path/context';
3
+ import {TRANSFORMED_OBSERVABLE_ID} from '../../../devtools/constantes';
2
4
 
3
5
  const HrmGlobakObservableRegistry = new Map();
4
6
 
5
- const overrideMethods = ['array', 'init', 'object', 'json'];
7
+ const overrideMethods = ['array', 'init', 'object', 'json', 'computed', 'batch'];
6
8
  const noObservableOverride = ['ref', 'resource'];
7
9
 
8
10
 
9
11
  const override = (callback) => {
10
- return function(name, id, scope, value, configs = null) {
12
+ return function(transformed_key, name, id, scope, value, configs = null) {
13
+ if(transformed_key !== TRANSFORMED_OBSERVABLE_ID) {
14
+ return callback(...arguments);
15
+ }
11
16
  if(!scope?.__hrm) {
12
17
  scope = null;
13
18
  }