Skip to content

Commit 662327a

Browse files
authored
Merge pull request #498 from objectstack-ai/copilot/review-action-run
2 parents 690d666 + 1e0c9b0 commit 662327a

6 files changed

Lines changed: 29 additions & 9 deletions

File tree

examples/app-crm/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"version": "0.9.0",
44
"description": "Example CRM implementation using ObjectStack Protocol",
55
"private": true,
6+
"main": "./objectstack.config.ts",
7+
"types": "./objectstack.config.ts",
8+
"exports": {
9+
".": "./objectstack.config.ts",
10+
"./objectstack.config": "./objectstack.config.ts"
11+
},
612
"scripts": {
713
"dev": "objectstack dev",
814
"build": "objectstack compile objectstack.config.ts dist/crm.json",

examples/app-react-crud/src/mocks/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ObjectQLPlugin } from '@objectstack/objectql';
1010
import { InMemoryDriver } from '@objectstack/driver-memory';
1111
import { MSWPlugin } from '@objectstack/plugin-msw';
1212
// import appConfig from '../../objectstack.config';
13-
import todoConfig from '@objectstack/example-todo/objectstack.config';
13+
import todoConfig from '@example/app-todo/objectstack.config';
1414

1515
let kernel: ObjectKernel | null = null;
1616

examples/app-todo/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"version": "0.9.0",
44
"description": "Example Todo App using ObjectStack Protocol",
55
"private": true,
6+
"main": "./objectstack.config.ts",
7+
"types": "./objectstack.config.ts",
8+
"exports": {
9+
".": "./objectstack.config.ts",
10+
"./objectstack.config": "./objectstack.config.ts"
11+
},
612
"scripts": {
713
"dev": "objectstack dev",
814
"build": "objectstack compile objectstack.config.ts dist/objectstack.json",

examples/plugin-bi/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"name": "@example/plugin-bi",
33
"version": "0.9.0",
44
"main": "src/index.ts",
5+
"types": "src/index.ts",
6+
"exports": {
7+
".": "./src/index.ts",
8+
"./objectstack.config": "./objectstack.config.ts"
9+
},
510
"license": "MIT",
611
"private": true,
712
"scripts": {

packages/core/src/logger.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { createRequire } from 'module';
21
import type { LoggerConfig, LogLevel } from '@objectstack/spec/system';
32
import type { Logger } from '@objectstack/spec/contracts';
43

5-
const require = createRequire(import.meta.url);
6-
74
/**
85
* Universal Logger Implementation
96
*
@@ -24,6 +21,7 @@ export class ObjectLogger implements Logger {
2421
private isNode: boolean;
2522
private pinoLogger?: any; // Pino logger instance for Node.js
2623
private pinoInstance?: any; // Base Pino instance for creating child loggers
24+
private require?: any; // CommonJS require function for Node.js
2725

2826
constructor(config: Partial<LoggerConfig> = {}) {
2927
// Detect runtime environment
@@ -56,8 +54,13 @@ export class ObjectLogger implements Logger {
5654
if (!this.isNode) return;
5755

5856
try {
57+
// Create require function dynamically for Node.js (avoids bundling issues in browser)
58+
// @ts-ignore - dynamic import of Node.js module
59+
const { createRequire } = eval('require("module")');
60+
this.require = createRequire(import.meta.url);
61+
5962
// Synchronous import for Pino using createRequire (works in ESM)
60-
const pino = require('pino');
63+
const pino = this.require('pino');
6164

6265
// Build Pino options
6366
const pinoOptions: any = {
@@ -81,7 +84,7 @@ export class ObjectLogger implements Logger {
8184
// Check if pino-pretty is available
8285
let hasPretty = false;
8386
try {
84-
require.resolve('pino-pretty');
87+
this.require.resolve('pino-pretty');
8588
hasPretty = true;
8689
} catch (e) {
8790
// ignore

packages/core/src/security/plugin-signature-verifier.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import type { PluginMetadata } from '../plugin-loader.js';
55
let cryptoModule: typeof import('crypto') | null = null;
66
if (typeof (globalThis as any).window === 'undefined') {
77
try {
8-
// Dynamic import for Node.js crypto module
9-
// eslint-disable-next-line @typescript-eslint/no-var-requires
10-
cryptoModule = require('crypto');
8+
// Dynamic import for Node.js crypto module (using eval to avoid bundling issues)
9+
// @ts-ignore - dynamic require for Node.js
10+
cryptoModule = eval('require("crypto")');
1111
} catch {
1212
// Crypto module not available (e.g., browser environment)
1313
}

0 commit comments

Comments
 (0)