Skip to content

Commit a16c7c1

Browse files
authored
Merge pull request #3 from lopatnov/update-2026
Update 2026
2 parents 1924adf + 04d2fdb commit a16c7c1

67 files changed

Lines changed: 12247 additions & 11089 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/FUNDING.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
11
---
22
name: Bug report
3-
about: Create a report to help us improve
3+
about: Report a bug to help us improve
44
title: ''
5-
labels: ''
5+
labels: bug
66
assignees: ''
77

88
---
99

1010
**Describe the bug**
11-
A clear and concise description of what the bug is.
11+
A clear and concise description of the bug.
1212

1313
**To Reproduce**
14-
Steps to reproduce the behavior:
15-
1. Go to '...'
16-
2. Click on '....'
17-
3. Scroll down to '....'
18-
4. See error
1914

20-
**Expected behavior**
21-
A clear and concise description of what you expected to happen.
15+
```javascript
16+
// Minimal code example that reproduces the issue
17+
import javaScriptToString from "@lopatnov/javascripttostring";
2218

23-
**Screenshots**
24-
If applicable, add screenshots to help explain your problem.
19+
const value = /* ... */;
20+
const result = javaScriptToString(value);
21+
// Expected: ...
22+
// Actual: ...
23+
```
2524

26-
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser [e.g. chrome, safari]
29-
- Version [e.g. 22]
25+
**Expected behavior**
26+
A clear description of what you expected to happen.
3027

31-
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
28+
**Environment:**
29+
- Node.js version: [e.g. 20.x]
30+
- Package version: [e.g. 1.7.3]
31+
- OS: [e.g. Windows 11, macOS 14]
3632

3733
**Additional context**
3834
Add any other context about the problem here.

.github/pull_request_template.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
Thank you for your contribution to the JavaScriptToString repo.
2-
Before submitting this PR, please make sure:
1+
## Description
32

4-
- [ ] Your code builds clean without any errors or warnings
5-
- [ ] You have added unit tests
3+
Brief description of the changes.
4+
5+
## Type of Change
6+
7+
- [ ] Bug fix
8+
- [ ] New feature
9+
- [ ] Documentation update
10+
- [ ] Refactoring
11+
- [ ] Other (describe below)
12+
13+
## Checklist
14+
15+
- [ ] Code builds clean without errors or warnings
16+
- [ ] Tests have been added or updated
17+
- [ ] All tests pass (`npm test`)
18+
- [ ] Code style verified (`npm run check`)

.github/workflows/nodejs.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
name: Node CI
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98

109
strategy:
1110
matrix:
12-
node-version: [12.x]
11+
node-version: [18.x, 20.x, 22.x, 24.x]
1312

1413
steps:
15-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v4
15+
1616
- name: Use Node.js ${{ matrix.node-version }}
17-
uses: actions/setup-node@v1
17+
uses: actions/setup-node@v4
1818
with:
1919
node-version: ${{ matrix.node-version }}
20-
- name: npm install, build, and test
21-
run: |
22-
npm i
23-
npm run build --if-present
24-
npm test
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Lint and format check
26+
run: npm run check
27+
28+
- name: Build
29+
run: npm run build
30+
31+
- name: Test
32+
run: npm test
2533
env:
2634
CI: true

.github/workflows/npmpublish.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,29 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v1
12-
- uses: actions/setup-node@v1
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
1313
with:
14-
node-version: 12
14+
node-version: 22
15+
cache: 'npm'
1516
- run: npm ci
17+
- run: npm run check
1618
- run: npm run build
1719
- run: npm test
1820

1921
publish-npm:
2022
needs: build
2123
runs-on: ubuntu-latest
2224
steps:
23-
- uses: actions/checkout@v1
25+
- uses: actions/checkout@v4
2426
- run: npm run configure-npm
25-
- uses: actions/setup-node@v1
27+
- uses: actions/setup-node@v4
2628
with:
27-
node-version: '12.x'
29+
node-version: 22
2830
registry-url: 'https://registry.npmjs.org'
29-
- run: npm install
31+
cache: 'npm'
32+
- run: npm ci
33+
- run: npm run build
3034
- run: npm publish --access=public
3135
env:
3236
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
@@ -35,13 +39,16 @@ jobs:
3539
needs: build
3640
runs-on: ubuntu-latest
3741
steps:
38-
- uses: actions/checkout@v1
39-
- uses: actions/setup-node@v1
42+
- uses: actions/checkout@v4
43+
- uses: actions/setup-node@v4
4044
with:
41-
node-version: '12.x'
45+
node-version: 22
4246
registry-url: 'https://npm.pkg.github.com'
4347
scope: '@lopatnov'
48+
cache: 'npm'
4449
- run: npm run configure-gpr
50+
- run: npm ci
51+
- run: npm run build
4552
- run: npm publish --access=public
4653
env:
47-
NODE_AUTH_TOKEN: ${{ secrets.GPR_PAT }}
54+
NODE_AUTH_TOKEN: ${{ secrets.GPR_PAT }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ typings/
5959

6060
# next.js build output
6161
.next
62+
/.claude

.jshintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"name": "Launch Tests",
1111
"program": "${workspaceFolder}\\node_modules\\jest\\bin\\jest",
1212
"args": [
13-
"--debug"
13+
"--runInBand",
14+
"--no-cache"
1415
],
16+
"console": "integratedTerminal"
1517
}
1618
]
1719
}

CHANGELOG.md

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,92 @@
1-
Version 1.0.0 - 1.2.0
2-
Added single default function javaScriptToString
3-
See https://github.com/lopatnov/jsToString/tree/2ad125ef392d7db45b26e14ec3225f35f28aad41
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [2.0.0] - 2026-02-14
6+
7+
### Added
8+
9+
- Cross-reference support: shared objects between different branches are now preserved as references
10+
- `throwOnNonSerializable` option: throws an error for non-serializable values instead of returning `"undefined"`
11+
- Explicit handling for non-serializable types: `Promise`, `Generator`, `WeakRef`, `WeakMap`, `WeakSet`, `FinalizationRegistry`
12+
- Negative zero (`-0`) preserved correctly
13+
- Sparse arrays preserved (holes are not filled with `undefined`)
14+
- `Symbol.for()` registry symbols distinguished from regular symbols
15+
- `Symbol("")` (empty description) distinguished from `Symbol()` (no description)
16+
- RegExp `lastIndex` preserved when non-zero
17+
- Error subclasses preserved: `TypeError`, `RangeError`, `ReferenceError`, `SyntaxError`, `URIError`, `EvalError`
18+
- `Object.create(null)` objects supported
19+
- Async functions and async generator functions supported
20+
- `SharedArrayBuffer` supported (grouped with `ArrayBuffer`)
21+
- ESM (`.mjs`) and CJS (`.cjs`) dual-package support via `exports` field
22+
- UMD build for browsers
23+
- `"type": "module"` in package.json
24+
- Biome for linting and formatting (replaced JSHint)
25+
- Jest coverage reporting enabled
26+
- 191 tests total (up from 53)
27+
28+
### Fixed
29+
30+
- **Issue #1:** Circular references to parent elements at the top level are now resolved correctly
31+
- Circular chain references (A -> B -> C -> A) now work at any depth
32+
- `counter = counter++` post-increment bug in cross-reference actions (value never incremented)
33+
- `Object.prototype.hasOwnProperty.call()` used instead of `value.hasOwnProperty()` to support null-prototype objects
34+
- Non-identifier property names in function properties now use bracket notation (`fn["my-prop"]` instead of invalid `fn.my-prop`)
35+
- Non-identifier property names in object literals are now quoted
36+
- Invalid `Date` objects now serialize as `new Date(NaN)` instead of `new Date("null")`
37+
- Date strings are now quoted in output
38+
39+
### Changed
40+
41+
- Cross-reference output uses dot notation when possible (`___ref1.prop` instead of `___ref1['prop']`)
42+
- Internal IIFE variable renamed from `___j2s_` to `___ref` for readability
43+
- Updated `@lopatnov/get-internal-type` to 2.0.0
44+
- Updated all dependencies to latest versions
45+
- Migrated from `rollup-plugin-*` to `@rollup/plugin-*` official packages
46+
- Migrated CI from Node.js 12.x to Node.js 18/20/22/24
47+
- Updated `@lopatnov/rollup-plugin-uglify` from 2.x to 3.x
48+
- Upgraded TypeScript to 5.8, Jest to 30, Rollup to 4, Biome to 2.x
49+
- tsconfig lib updated to ES2022
50+
- Minimum Node.js version is now 18.0.0
51+
52+
### Removed
53+
54+
- Travis CI configuration (replaced by GitHub Actions)
55+
- JSHint configuration (replaced by Biome)
56+
- `rollup-plugin-sourcemaps` (deprecated, no longer needed)
57+
58+
## [1.7.3] - 2022
59+
60+
### Changed
61+
62+
- Updated terser dependency
63+
64+
## [1.7.0 - 1.7.2]
65+
66+
### Changed
67+
68+
- Updated packages and dependencies
69+
70+
## [1.5.0 - 1.6.0]
71+
72+
### Added
73+
74+
- Options for limiting nesting depth (`nestedObjectsAmount`, `nestedArraysAmount`, `nestedFunctionsAmount`)
75+
76+
## [1.3.0 - 1.4.0]
77+
78+
### Added
79+
80+
- Support for Map, Set, TypedArray, ArrayBuffer, DataView
81+
- Support for BigInt, Symbol
82+
83+
## [1.0.0 - 1.2.0]
84+
85+
### Added
86+
87+
- Initial release with `javaScriptToString` function
88+
- Support for primitives, objects, arrays, functions, Date, RegExp, Error
89+
- Circular reference handling
90+
- Function properties and prototype serialization
91+
92+
See [GitHub releases](https://github.com/lopatnov/jsToString/releases) for more details.

0 commit comments

Comments
 (0)