Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on:
pull_request:
branches:
- main
- release-*

jobs:
quality_pipeline_lint:
quality_pipeline_lint_and_typecheck:
runs-on: ubuntu-24.04
timeout-minutes: 5

Expand All @@ -25,6 +26,9 @@ jobs:
- name: Lint
run: npm run lint

- name: Type Check
run: npm run test-types

quality_pipeline_nodejs:
runs-on: ubuntu-24.04
timeout-minutes: 5
Expand Down Expand Up @@ -68,6 +72,9 @@ jobs:
- name: Install
run: npm ci && npx playwright install --with-deps chromium

- name: Build
run: npm run build

- name: Test
run: npm run test:chromium

Expand All @@ -76,12 +83,6 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Archive logs
uses: actions/upload-artifact@v4
with:
name: chromium-logs
path: reports/logs/chromium-112.0.5615.29.log

quality_pipeline_firefox:
runs-on: ubuntu-24.04
timeout-minutes: 5
Expand All @@ -98,14 +99,12 @@ jobs:
- name: Install
run: npm ci && npx playwright install --with-deps firefox

- name: Build
run: npm run build

- name: Test
run: npm run test:firefox

- name: Report coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

quality_pipeline_webkit:
runs-on: ubuntu-24.04
timeout-minutes: 5
Expand All @@ -122,10 +121,8 @@ jobs:
- name: Install
run: npm ci && npx playwright install --with-deps webkit

- name: Build
run: npm run build

- name: Test
run: npm run test:webkit

- name: Report coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.11.0
24.15.0
44 changes: 19 additions & 25 deletions ci/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';
import globals from 'globals';

export default [...compat.extends('eslint:recommended'), {
languageOptions: {
globals: {
...globals.browser,
...globals.node
export default defineConfig(
js.configs.recommended,
tseslint.configs.recommended,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
},
ecmaVersion: 'latest',
sourceType: 'module'
},

ecmaVersion: 'latest',
sourceType: 'module'
},

rules: {
'no-shadow': 2
rules: {
'no-shadow': 'error',
semi: 'error'
}
}
}];
);
56 changes: 15 additions & 41 deletions ci/tools/build-utils.js
Original file line number Diff line number Diff line change
@@ -1,87 +1,62 @@
import path from 'node:path';
import fs from 'node:fs/promises';

import esbuild from 'esbuild';

import { calcIntegrity } from './integrity-utils.js';
import * as stdout from './stdout.js';

const SRC_DIR = 'src';
const DIST_DIR = 'dist';
const MAIN_FILE = 'object-observer.ts';
const ENTRY_POINT = path.join(SRC_DIR, MAIN_FILE);

stdout.writeGreen('Starting the build...');
stdout.writeNewline();
stdout.writeNewline();

try {
await cleanDistDir();
await buildESModule();
await buildCJSModule();
await buildCDNResources();
} catch (e) {
console.error(e);
}

stdout.writeGreen('... build done');
stdout.writeGreen('... done');
stdout.writeNewline();
stdout.writeNewline();

async function cleanDistDir() {
stdout.write(`\tcleaning "dist"...`);
stdout.write(`- cleaning "dist"...`);

await fs.rm(DIST_DIR, { recursive: true, force: true });
await fs.mkdir(DIST_DIR);

stdout.writeGreen('\tOK');
stdout.writeGreen('\t\tOK');
stdout.writeNewline();
}

async function buildESModule() {
stdout.write('\tbuilding ESM resources...');
stdout.write('- building ESM resources...');

await fs.copyFile(path.join(SRC_DIR, 'object-observer.d.ts'), path.join(DIST_DIR, 'object-observer.d.ts'));
await fs.copyFile(path.join(SRC_DIR, 'object-observer.js'), path.join(DIST_DIR, 'object-observer.js'));
await esbuild.build({
entryPoints: [path.join(DIST_DIR, 'object-observer.js')],
const config = {
entryPoints: [ENTRY_POINT],
bundle: true,
outdir: DIST_DIR,
minify: true,
format: 'esm',
minify: false,
sourcemap: true,
sourcesContent: false,
outExtension: { '.js': '.min.js' }
});

stdout.writeGreen('\tOK');
stdout.writeNewline();
}

async function buildCJSModule() {
stdout.write('\tbuilding CJS resources...');

const baseConfig = {
entryPoints: [path.join(SRC_DIR, 'object-observer.js')],
outdir: path.join(DIST_DIR, 'cjs'),
format: 'cjs',
outExtension: { '.js': '.cjs' }
sourcesContent: false
};
await esbuild.build(baseConfig);
await esbuild.build({
...baseConfig,
entryPoints: [path.join(DIST_DIR, 'cjs', 'object-observer.cjs')],
minify: true,
sourcemap: true,
sourcesContent: false,
outExtension: { '.js': '.min.cjs' }
});
await esbuild.build(config);
await esbuild.build({ ...config, minify: true, outExtension: { '.js': '.min.js' } });

stdout.writeGreen('\tOK');
stdout.writeNewline();
}

async function buildCDNResources() {
stdout.write('\tbuilding CDN resources...');
stdout.write('- building CDN resources...');

const CDN_DIR = path.join(DIST_DIR, 'cdn');

await fs.mkdir(CDN_DIR);

const files = (await fs.readdir(DIST_DIR))
Expand All @@ -92,7 +67,6 @@ async function buildCDNResources() {
}

const sriMap = await calcIntegrity(CDN_DIR);

await fs.writeFile('sri.json', JSON.stringify(sriMap, null, '\t'), { encoding: 'utf-8' });

stdout.writeGreen('\tOK');
Expand Down
12 changes: 12 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Architecture

```mermaid
classDiagram
class ObservableBase {

}

ObservableBase <|-- ObservableObject
ObservableBase <|-- ObservableArray
ObservableBase <|-- ObservableTypedArray
```
13 changes: 12 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
## [7.0.0]
### BREAKING CHANGE
- [Issue no. 152](https://github.com/gullerya/object-observer/issues/152) - `Observable.observe` options API replaced:
- removed: `path`, `pathsOf`, `pathsFrom`
- added: `filters` — a non-empty array of `Filter` instances; multiple filters compose as logical AND
- `Filter` is now exported from the package entry; use its static factories (`exactPaths`, `pathsStartWith`, `directChildrenOf`, `custom`) to build filters
- migration: `{ path: 'a.b' }` → `{ filters: [Filter.exactPaths(['a.b'])] }`; `{ pathsOf: 'a' }` → `{ filters: [Filter.directChildrenOf('a')] }`; `{ pathsFrom: 'a' }` → `{ filters: [Filter.pathsStartWith('a')] }`
### Added
- [Issue no. 149](https://github.com/gullerya/object-observer/issues/149) - added verifiers to prevent unallowed changes
- [Issue no. 152](https://github.com/gullerya/object-observer/issues/152) - change the way filters are configured
- `Filter.directChildrenOf(path)` factory — covers the previous `pathsOf` semantics, with a fixed sibling-prefix bug (`directChildrenOf('inner')` no longer matches `innerX.foo`)
### Fixed
- `npm test` script referenced a non-existent `.json` config; now points to the correct `.js` file
### Chore
- updated dependencies
- reorganized sources
- updated build scripts
- raised Node.js runtime to `24.15.0` (aligned with current LTS)
- browser support matrix updated to "last 2 versions" of Chrome, Firefox, Edge, Safari
- removed stale commented-out duplicate of the dispatch pipeline from `src/object-observer.ts`

## [6.1.4] - 2025-02-14
### Chore
Expand Down
73 changes: 0 additions & 73 deletions docs/filter-paths.md

This file was deleted.

Loading
Loading