Skip to content

Update Node.js & NPM #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
11b956f
Update Node.js & NPM in project's engines
marinaaisa Jul 2, 2025
b87aa7b
Update @vue/test-utils
marinaaisa Jul 3, 2025
18295a5
Update tree-sitter-vue
marinaaisa Jul 3, 2025
2c7a202
Fix LanguageSwitcher.spec.js
marinaaisa Jul 14, 2025
86d467f
Fix Column.spec.js
marinaaisa Jul 14, 2025
fb2b29d
Fix Hero.spec.js
marinaaisa Jul 14, 2025
b3b0960
Fix ColorSchemeToggle.spec.js
marinaaisa Jul 4, 2025
24f1035
Fix ImageAsset.spec.js
marinaaisa Jul 4, 2025
6ae5e2e
Fix Pager.spec.js
marinaaisa Jul 4, 2025
b4b8c2f
Fix Assessments.spec.js
marinaaisa Jul 4, 2025
72e642b
Fix swift.spec.js
marinaaisa Jul 7, 2025
9a7f54e
Fix FilterInput.spec.js
marinaaisa Jul 7, 2025
6deedf4
Replace wrapper.find
marinaaisa Jul 8, 2025
03e3a0c
Wait for wrapper.setProps
marinaaisa Jul 8, 2025
e89fed0
Wait for wrapper.setData
marinaaisa Jul 8, 2025
f29165a
Await after .trigger() function
marinaaisa Jul 8, 2025
f59d5b0
Fix Navigator.spec.js
marinaaisa Jul 8, 2025
a2fafeb
Fix ReplayableVideoAsset.spec.js
marinaaisa Jul 8, 2025
4264da4
Replace 'Contains'
marinaaisa Jul 8, 2025
d2afa0d
Wait for nextTick after emitting an event
marinaaisa Jul 8, 2025
93f58b1
Fix TopicsLinkCardGridItem.spec.js
marinaaisa Jul 9, 2025
f0253bb
Fix components/DocumentationTopic.spec.js
marinaaisa Jul 9, 2025
06e0b81
Fix Chapter.spec.js
marinaaisa Jul 9, 2025
9ef540b
Fix AdjustableSidebarWidth.spec.js
marinaaisa Jul 9, 2025
721f1fc
Fix Availability.spec.js
marinaaisa Jul 9, 2025
4739cf1
Fix Hierarchy.spec.js
marinaaisa Jul 9, 2025
455950a
Fix NavBase.spec.js
marinaaisa Jul 9, 2025
1b7ceee
Fix DocumentationLayout.spec.js
marinaaisa Jul 9, 2025
757458a
Fix TopicsLinkBlock.spec.js
marinaaisa Jul 9, 2025
e2644ec
Fix CodePreview.spec.js
marinaaisa Jul 9, 2025
e011738
Fix App.spec.js
marinaaisa Jul 9, 2025
950749d
Fix DropdownCustom.spec.js
marinaaisa Jul 9, 2025
13111be
Wait for .setValue()
marinaaisa Jul 9, 2025
7dfd1ec
Fix GenericModal.spec.js
marinaaisa Jul 9, 2025
479d5cd
Fix LinksBlock.spec.js
marinaaisa Jul 9, 2025
5e103cd
Fix ResourcesTile.spec.js
marinaaisa Jul 9, 2025
aeafa9c
Fix RelationshipsList.spec.js
marinaaisa Jul 9, 2025
d57df04
Fix all deprecated .is() method warnings
marinaaisa Jul 11, 2025
db46d1d
Fix .find() and .get() deprecation warnings
marinaaisa Jul 11, 2025
5e3380d
Fix .findAll() deprecation warnings
marinaaisa Jul 11, 2025
bf63402
Fix .contains() deprecation warnings
marinaaisa Jul 11, 2025
b58f318
Fix .isEmpty() deprecation warnings
marinaaisa Jul 11, 2025
39289ab
Fix attachToDocument deprecation warnings
marinaaisa Jul 11, 2025
bec3768
Fix QuickNavigationModal.spec.js
marinaaisa Jul 11, 2025
7f0c3d9
Fix console error warnings for TopicsLinkBlock.spec.js
marinaaisa Jul 11, 2025
625548d
Fix DocumentationTopic.spec.js
marinaaisa Jul 11, 2025
06928f5
Fix ResourcesTileGroup.spec.js
marinaaisa Jul 11, 2025
37605bf
Fix DeclarationTokenGroup.spec.js
marinaaisa Jul 14, 2025
c21347f
Remove redundant nextTick
marinaaisa Jul 24, 2025
bd2ee89
Update tree-sitter-javascript and tree-sitter-jsdoc
marinaaisa Jul 25, 2025
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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16.1
22.17.0
4 changes: 2 additions & 2 deletions build-script-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def ensure_npm_is_installed(verbose=False):
fatal_error('-- Error: %s' % error_msg)
try:
node_version = check_output(['node', '--version'], verbose=verbose)
if not node_version.startswith('v18.16.'):
warn_msg = "Unexpected version of 'node' installed. Swift-DocC-Render requires node 18.16.1. "\
if not node_version.startswith('v22.17.'):
warn_msg = "Unexpected version of 'node' installed. Swift-DocC-Render requires node 22.17.0. "\
"See the README.md file for more information about building Swift-DocC-Render."
printerr('-- Warning: %s' % warn_msg)
except:
Expand Down
26,337 changes: 7,278 additions & 19,059 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@vue/cli-plugin-unit-jest": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"@vue/eslint-config-airbnb": "^6.0.0",
"@vue/test-utils": "1.0.0-beta.27",
"@vue/test-utils": "1.3.6",
"@vue/vue2-jest": "^27.0.0-alpha.2",
"babel-jest": "^27.0.6",
"eslint": "^7.32.0",
Expand All @@ -50,9 +50,9 @@
"jest": "^27.0.5",
"sass": "^1.55.0",
"sass-loader": "^12.0.0",
"tree-sitter": "^0.20.6",
"tree-sitter-javascript": "^0.20.4",
"tree-sitter-jsdoc": "^0.19.0",
"tree-sitter": "^0.21.1",
"tree-sitter-javascript": "^0.23.1",
"tree-sitter-jsdoc": "^0.23.2",
"tree-sitter-vue": "^0.2.1",
"vue": "^2.7.10",
"vue-router": "^3.5.2",
Expand All @@ -63,7 +63,12 @@
"vue-router": "^3.5.2"
},
"engines": {
"node": ">=18.16.1 <21",
"npm": ">=9.5.1"
"node": ">=22.17.0 <23",
"npm": ">=10.9.2"
},
"overrides": {
"tree-sitter-vue": {
"nan": "^2.22.2"
}
}
}
28 changes: 0 additions & 28 deletions src/utils/custom-highlight-lang/swift.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,6 @@ import swift from 'highlight.js/lib/languages/swift';
export default function swiftOverride(hljs) {
const language = swift(hljs);

// Temporarily patch the Swift language syntax to recognize `distributed` as
// a keyword until the next version of highlight.js (v11.6) is released, which
// will have built-in support for this [1]
//
// [1]: https://github.com/highlightjs/highlight.js/pull/3523
language.keywords.keyword = [
...language.keywords.keyword,
'distributed',
];

const isClassMode = ({ beginKeywords = '' }) => beginKeywords
.split(' ')
.includes('class');
const classModeIndex = language.contains.findIndex(isClassMode);
if (classModeIndex >= 0) {
const {
beginKeywords, // purposefully strip this out
...classMode
} = language.contains[classModeIndex];
// Update the existing "class" mode by replacing the `beginKeywords` with
// a `begin` regular expression, which is careful not to mistakenly
// recognize class function declarations as class declarations
language.contains[classModeIndex] = {
...classMode,
begin: /\b(struct|protocol|extension|enum|actor|class\b(?!.*\bfunc))\b/,
};
}

// Checks if a given language sub-mode matches the "ESCAPED_NEWLINE" from the
// built-in Swift parser from hljs
const isEscapedNewlineMode = (mode) => {
Expand Down
70 changes: 36 additions & 34 deletions tests/unit/App.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ describe('App', () => {
const wrapper = createWrapper();
expect(wrapper.classes('hascustomheader')).toBe(false);

const header = wrapper.find('custom-header-stub');
const header = wrapper.findComponent('custom-header-stub');
expect(header.exists()).toBe(false);

const footer = wrapper.find('custom-footer-stub');
const footer = wrapper.findComponent('custom-footer-stub');
expect(footer.exists()).toBe(false);
});

Expand All @@ -115,7 +115,7 @@ describe('App', () => {

it('renders Skip Navigation', () => {
const wrapper = createWrapper();
const skipNavigation = wrapper.find('#skip-nav');
const skipNavigation = wrapper.findComponent('#skip-nav');
expect(skipNavigation.text()).toBe('accessibility.skip-navigation');
expect(skipNavigation.attributes('href')).toBe('#app-main');
});
Expand All @@ -126,7 +126,7 @@ describe('App', () => {
header: '<div class="header">Header</div>',
},
});
const header = wrapper.find('.header');
const header = wrapper.findComponent('.header');
expect(header.text()).toBe('Header');
});

Expand All @@ -135,49 +135,49 @@ describe('App', () => {
getSetting.mockReturnValue(true);

const wrapper = createWrapper();
wrapper.setData({
await wrapper.setData({
appState: {
...wrapper.vm.appState,
availableLocales,
},
});

const SuggestLangComponent = wrapper.find(SuggestLang);
const SuggestLangComponent = wrapper.findComponent(SuggestLang);
expect(SuggestLangComponent.exists()).toBe(true);
});

it('renders LocaleSelector if enablei18n is true', () => {
it('renders LocaleSelector if enablei18n is true', async () => {
const { LocaleSelector } = App.components;
({ getSetting } = require('docc-render/utils/theme-settings'));
getSetting.mockReturnValue(true);

const wrapper = createWrapper();
expect(wrapper.find(LocaleSelector).exists()).toBe(false);
wrapper.setData({
expect(wrapper.findComponent(LocaleSelector).exists()).toBe(false);
await wrapper.setData({
appState: {
...wrapper.vm.appState,
availableLocales,
},
});

expect(wrapper.find(LocaleSelector).exists()).toBe(true);
expect(wrapper.findComponent(LocaleSelector).exists()).toBe(true);
});

it('does not render LocaleSelector if there is less than two available locales', () => {
it('does not render LocaleSelector if there is less than two available locales', async () => {
const { LocaleSelector } = App.components;
({ getSetting } = require('docc-render/utils/theme-settings'));
getSetting.mockReturnValue(true);

const wrapper = createWrapper();
expect(wrapper.find(LocaleSelector).exists()).toBe(false);
wrapper.setData({
expect(wrapper.findComponent(LocaleSelector).exists()).toBe(false);
await wrapper.setData({
appState: {
...wrapper.vm.appState,
availableLocales: ['en-US'],
},
});

expect(wrapper.find(LocaleSelector).exists()).toBe(false);
expect(wrapper.findComponent(LocaleSelector).exists()).toBe(false);
});

it('renders the `#nav-sticky-anchor` between the header and loading placeholder', () => {
Expand All @@ -186,9 +186,9 @@ describe('App', () => {
header: '<div class="header">Footer</div>',
},
});
const header = wrapper.find('.header');
const stickyAnchor = wrapper.find(`#${baseNavStickyAnchorId}`);
const loadingPlaceholder = wrapper.find(InitialLoadingPlaceholder);
const header = wrapper.findComponent('.header');
const stickyAnchor = wrapper.findComponent(`#${baseNavStickyAnchorId}`);
const loadingPlaceholder = wrapper.findComponent(InitialLoadingPlaceholder);

// make sure the anchor is below the header and above the content
expect(header.element.nextElementSibling).toBe(stickyAnchor.element);
Expand All @@ -201,9 +201,9 @@ describe('App', () => {
default: '<div class="default">Default</div>',
},
});
const stickyAnchor = wrapper.find(`#${baseNavStickyAnchorId}`);
const content = wrapper.find('.default');
const placeholder = wrapper.find(InitialLoadingPlaceholder);
const stickyAnchor = wrapper.findComponent(`#${baseNavStickyAnchorId}`);
const content = wrapper.findComponent('.default');
const placeholder = wrapper.findComponent(InitialLoadingPlaceholder);
// make sure the anchor is below the header and above the content
expect(placeholder.exists()).toBe(true);
expect(stickyAnchor.element.nextElementSibling).toBe(placeholder.element);
Expand All @@ -216,7 +216,7 @@ describe('App', () => {
footer: '<div class="footer-slot">Footer</div>',
},
});
const footer = wrapper.find('.footer-slot');
const footer = wrapper.findComponent('.footer-slot');
expect(footer.text()).toBe('Footer');
});

Expand All @@ -226,22 +226,22 @@ describe('App', () => {
default: '<div class="default">Default</div>',
},
});
const slotContent = wrapper.find('.default');
const slotContent = wrapper.findComponent('.default');
expect(slotContent.text()).toBe('Default');
expect(wrapper.find('router-view-stub').exists()).toBe(false);
expect(wrapper.findComponent('router-view-stub').exists()).toBe(false);
});

it('renders a default `Footer` for non-IDE targets', () => {
it('renders a default `Footer` for non-IDE targets', async () => {
const wrapper = createWrapper();
expect(wrapper.contains(Footer)).toBe(true);
expect(wrapper.findComponent(Footer).exists()).toBe(true);

wrapper.setData({ isTargetIDE: true });
expect(wrapper.contains(Footer)).toBe(false);
await wrapper.setData({ isTargetIDE: true });
expect(wrapper.findComponent(Footer).exists()).toBe(false);
});

it('renders the app-top element', () => {
const wrapper = createWrapper();
expect(wrapper.find(`#${AppTopID}`).exists()).toBe(true);
expect(wrapper.findComponent(`#${AppTopID}`).exists()).toBe(true);
});

describe('Custom CSS Properties', () => {
Expand Down Expand Up @@ -295,7 +295,7 @@ describe('App', () => {
matches: true,
});
const wrapper = createWrapper();
wrapper.setData({
await wrapper.setData({
appState: {
...wrapper.vm.appState,
preferredColorScheme: ColorScheme.auto,
Expand All @@ -308,7 +308,7 @@ describe('App', () => {

it('dynamically changes the data, upon color scheme change (in auto mode)', async () => {
const wrapper = createWrapper();
wrapper.setData({
await wrapper.setData({
appState: {
...wrapper.vm.appState,
preferredColorScheme: ColorScheme.auto,
Expand All @@ -317,13 +317,14 @@ describe('App', () => {
await flushPromises();
expect(setPropertySpy).toHaveBeenCalledWith('--text', LightDarkModeCSSSettings.text.light);
matchMedia.addListener.mock.calls[0][0].call(wrapper.vm, { matches: true });
await wrapper.vm.$nextTick();
expect(setPropertySpy).toHaveBeenCalledTimes(2);
expect(setPropertySpy).toHaveBeenCalledWith('--text', LightDarkModeCSSSettings.text.dark);
});

it('updates the values applied to the root, if the colors update', async () => {
const wrapper = createWrapper();
wrapper.setData({
await wrapper.setData({
appState: {
...wrapper.vm.appState,
preferredColorScheme: ColorScheme.auto,
Expand All @@ -334,6 +335,7 @@ describe('App', () => {
expect(setPropertySpy).toHaveBeenCalledTimes(1);
expect(setPropertySpy).toHaveBeenCalledWith('--text', 'light');
matchMedia.addListener.mock.calls[0][0].call(wrapper.vm, { matches: true });
await wrapper.vm.$nextTick();
expect(removePropertySpy).toHaveBeenCalledTimes(2);
expect(removePropertySpy).toHaveBeenLastCalledWith('--text');
expect(setPropertySpy).toHaveBeenCalledWith('--text', 'dark');
Expand Down Expand Up @@ -365,7 +367,7 @@ describe('App', () => {
});

it('renders a <custom-header>', () => {
const header = wrapper.find('custom-header-stub');
const header = wrapper.findComponent('custom-header-stub');
expect(header.exists()).toBe(true);
expect(header.attributes('data-color-scheme')).toBeDefined();
});
Expand All @@ -376,15 +378,15 @@ describe('App', () => {
header: '<div class="header">Header</div>',
},
});
const header = wrapper.find('custom-header-stub');
const header = wrapper.findComponent('custom-header-stub');
expect(header.exists()).toBe(false);
});
});

it('renders a <custom-footer> if one has been defined', () => {
window.customElements.get.mockImplementation(name => name === 'custom-footer');
const wrapper = createWrapper();
const footer = wrapper.find('custom-footer-stub');
const footer = wrapper.findComponent('custom-footer-stub');
expect(footer.exists()).toBe(true);
expect(footer.attributes('data-color-scheme')).toBeDefined();
});
Expand Down
Loading