Skip to content

Commit 7695a4f

Browse files
committed
wip
1 parent 0502595 commit 7695a4f

File tree

6 files changed

+8
-48
lines changed

6 files changed

+8
-48
lines changed

packages/signals/signals-runtime/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Encapsults Signals runtime functionality, in order to share logic between the si
55
`yarn build` generate the following artifacts:
66
| Generated File(s) | Description |
77
|--------|-------------|
8-
| `/dist/global/index.[platform].js`, `/[platform]/get-runtime-code.generated.js` | Exposes `globalThis.Signals` and constants (e.g. `SignalType`), either through the script tag or in the mobile JS engine |
9-
| `/dist/editor/[platform]-editor.d.ts` | Type definitions for monaco editor on app.segment.com
8+
| `/dist/runtime/index.[platform].js`, `/[platform]/get-runtime-code.generated.js` | Exposes `globalThis.Signals` and constants (e.g. `SignalType`), either through the script tag or in the mobile JS engine |
9+
| `/dist/editor/[platform]-editor.d.ts.txt` | Type definitions for monaco editor on app.segment.com
1010
| `/dist/esm/index.js` | Entry point for `@segment/analytics-signals` and the segment app, that want to consume the types / runtime code. |

packages/signals/signals-runtime/build-signals-runtime-global.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const getEntryPoint = (platform) => {
2222
}
2323

2424
const getOutFiles = (platform) => {
25-
const outfileMinified = `./dist/global/index.${platform}.min.js`
26-
const outfileUnminified = `./dist/global/index.${platform}.js`
25+
const outfileMinified = `./dist/runtime/index.${platform}.min.js`
26+
const outfileUnminified = `./dist/runtime/index.${platform}.js`
2727
return {
2828
outfileMinified,
2929
outfileUnminified,

packages/signals/signals-runtime/bundle-build-tests/global.test.ts renamed to packages/signals/signals-runtime/bundle-build-tests/runtime-env.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('Global Scope Test: Web', () => {
66
let dom: JSDOM
77
beforeAll(() => {
88
// Load the built file
9-
const filePath = path.resolve(__dirname, '../dist/global/index.web.js')
9+
const filePath = path.resolve(__dirname, '../dist/runtime/index.web.js')
1010
const scriptContent = fs.readFileSync(filePath, 'utf-8')
1111

1212
// Create a new JSDOM instance
@@ -39,7 +39,7 @@ describe('Global Scope Test: Mobile', () => {
3939
let dom: JSDOM
4040
beforeAll(() => {
4141
// Load the built file
42-
const filePath = path.resolve(__dirname, '../dist/global/index.mobile.js')
42+
const filePath = path.resolve(__dirname, '../dist/runtime/index.mobile.js')
4343
const scriptContent = fs.readFileSync(filePath, 'utf-8')
4444

4545
// Create a new JSDOM instance

packages/signals/signals-runtime/src/mobile/mobile-signals-types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BaseSignal, ISignalsRuntime } from '../shared/shared-types'
1+
import { BaseSignal } from '../shared/shared-types'
22

33
export type SignalTypes = Signal['type']
44

@@ -88,5 +88,3 @@ interface InstrumentationData {
8888
interface InstrumentationSignal extends RawSignal<'instrumentation'> {
8989
data: InstrumentationData
9090
}
91-
92-
export interface MobileSignalsRuntime extends ISignalsRuntime<Signal> {}

packages/signals/signals-runtime/src/shared/shared-types.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,6 @@ export type SignalOfType<
77
SignalType extends AllSignals['type']
88
> = AllSignals & { type: SignalType }
99

10-
/**
11-
* Interface for the Signals class (accessible via `signals` in the processSignal scope).
12-
*/
13-
export interface ISignalsRuntime<Signal extends BaseSignal> {
14-
/**
15-
* Finds a signal of a specific type from a given signal.
16-
*
17-
* SignalType - The type of the signal to find.
18-
* @param fromSignal - The signal to search from.
19-
* @param signalType - The type of the signal to find.
20-
* @param predicate - Optional predicate function to filter the signals.
21-
* @returns The found signal of the specified type, or undefined if not found.
22-
*/
23-
find: <SignalType extends Signal['type']>(
24-
fromSignal: Signal,
25-
signalType: SignalType,
26-
predicate?: (signal: SignalOfType<Signal, SignalType>) => boolean
27-
) => SignalOfType<Signal, SignalType> | undefined
28-
29-
/**
30-
* Filters signals of a specific type from a given signal.
31-
* SignalType - The type of the signals to filter.
32-
* @param fromSignal - The signal to search from.
33-
* @param signalType - The type of the signals to filter.
34-
* @param predicate - Optional predicate function to filter the signals.
35-
* @returns An array of signals of the specified type.
36-
*/
37-
filter: <SignalType extends Signal['type']>(
38-
fromSignal: Signal,
39-
signalType: SignalType,
40-
predicate?: (signal: SignalOfType<Signal, SignalType>) => boolean
41-
) => SignalOfType<Signal, SignalType>[]
42-
}
43-
4410
export type JSONPrimitive = string | number | boolean | null
4511
export type JSONValue = JSONPrimitive | JSONObject | JSONArray
4612
export type JSONObject = { [member: string]: JSONValue }

packages/signals/signals-runtime/src/shared/signals-runtime.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
BaseSignal,
3-
SignalOfType,
4-
ISignalsRuntime,
5-
} from '../shared/shared-types'
1+
import { BaseSignal, SignalOfType } from '../shared/shared-types'
62

73
/**
84
* Base class that provides runtime utilities for signals.

0 commit comments

Comments
 (0)