fix(decorators): Add Symbol.metadata polyfill and import it at entry to ensure decorator metadata is available

This commit is contained in:
2025-11-28 09:16:52 +00:00
parent 23aa29a5b8
commit 0a349180b2
5 changed files with 22 additions and 6 deletions

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartdata',
version: '7.0.3',
version: '7.0.4',
description: 'An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.'
}

View File

@@ -1,3 +1,6 @@
// Polyfill must be imported first - ES modules hoist exports before code runs
import './shim.js';
export * from './classes.db.js';
export * from './classes.collection.js';
export * from './classes.doc.js';

6
ts/shim.ts Normal file
View File

@@ -0,0 +1,6 @@
/**
* Polyfill for Symbol.metadata required by TC39 Stage 3 decorators.
* Must be imported before any decorator code loads.
* @see https://github.com/tc39/proposal-decorator-metadata
*/
(Symbol as any).metadata ??= Symbol.for('Symbol.metadata');