Skip to content

Commit d9972d5

Browse files
authored
Migrate to pnpm (#10422)
Fixes #10197 # Important Notes From now on, package installation will be using `pnpm install`. Installing it globally is fine for convenience, but it can also be used as `corepack pnpm install` without having to install anything other than node. For now, all other scripts are still invoked using `npm`, so we can still invoke them with usual `--workspace` setting. As far as I can tell that doesn't really have any other side effects and is identical as running the script through `pnpm run` in respective workspace project subdirectory.
1 parent 82678aa commit d9972d5

File tree

85 files changed

+15541
-24772
lines changed

Some content is hidden

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

85 files changed

+15541
-24772
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ tools/http-test-helper/www-files
2929
**/scala-parser.js
3030
**/package-lock.json
3131
**/msdfgen_wasm.js
32+
pnpm-lock.yaml
3233

3334
# Generated files
3435
app/ide-desktop/lib/client/electron-builder-config.json

app/gui2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ See [Vite Configuration Reference](https://vitejs.dev/config/).
2424
## Project Setup
2525

2626
```sh
27-
npm install
27+
pnpm install
2828
```
2929

3030
### Compile and Hot-Reload for Development

app/gui2/mock/MockProjectStoreWrapper.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const emit = defineEmits<{ 'update:modelValue': [modelValue: string] }>()
1414
const projectStore = useProjectStore()
1515
const mod = projectStore.projectModel.createNewModule('Main.enso')
1616
projectStore.setObservedFileName('Main.enso')
17-
mod.doc.ydoc.emit('load', [])
17+
mod.doc.ydoc.emit('load', [mod.doc.ydoc])
1818
let syncedCode: string | undefined
1919
watch(
2020
() => projectStore.module,

app/gui2/node.env.d.ts

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

app/gui2/package.json

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,19 @@
4242
"@ag-grid-community/styles": "^30.2.0",
4343
"@ag-grid-enterprise/core": "^30.2.0",
4444
"@ag-grid-enterprise/range-selection": "^30.2.1",
45-
"@babel/parser": "^7.22.16",
45+
"@babel/parser": "^7.24.7",
46+
"@codemirror/commands": "^6.6.0",
47+
"@codemirror/language": "^6.10.2",
48+
"@codemirror/lint": "^6.8.1",
49+
"@codemirror/search": "^6.5.6",
50+
"@codemirror/state": "^6.4.1",
51+
"@codemirror/view": "^6.28.3",
4652
"@fast-check/vitest": "^0.0.8",
4753
"@floating-ui/vue": "^1.0.6",
4854
"@lexical/code": "^0.16.0",
4955
"@lexical/link": "^0.16.0",
5056
"@lexical/list": "^0.16.0",
57+
"@lexical/selection": "^0.16.0",
5158
"@lexical/markdown": "^0.16.0",
5259
"@lexical/plain-text": "^0.16.0",
5360
"@lexical/rich-text": "^0.16.0",
@@ -62,7 +69,7 @@
6269
"ag-grid-enterprise": "^30.2.1",
6370
"codemirror": "^6.0.1",
6471
"culori": "^3.2.0",
65-
"enso-dashboard": "^0.1.0",
72+
"enso-dashboard": "workspace:*",
6673
"events": "^3.3.0",
6774
"fast-diff": "^1.3.0",
6875
"hash-sum": "^2.0.0",
@@ -75,8 +82,8 @@
7582
"partysocket": "^1.0.1",
7683
"postcss-inline-svg": "^6.0.0",
7784
"postcss-nesting": "^12.0.1",
85+
"react-toastify": "^9.1.3",
7886
"rimraf": "^5.0.5",
79-
"semver": "^7.5.4",
8087
"sucrase": "^3.34.0",
8188
"veaury": "^2.3.18",
8289
"vue": "^3.4.19",
@@ -111,38 +118,39 @@
111118
"@vitejs/plugin-react": "^4.0.4",
112119
"@vitejs/plugin-vue": "^5.0.4",
113120
"@vitest/coverage-v8": "^1.3.1",
114-
"@volar/vue-typescript": "^1.6.5",
115121
"@vue/eslint-config-prettier": "^9.0.0",
116-
"@vue/eslint-config-typescript": "^12.0.0",
122+
"@vue/eslint-config-typescript": "^13.0.0",
117123
"@vue/test-utils": "^2.4.6",
118124
"@vue/tsconfig": "^0.5.1",
119125
"change-case": "^4.1.2",
120126
"cross-env": "^7.0.3",
121127
"css.escape": "^1.5.1",
122128
"d3": "^7.4.0",
123-
"enso-project-manager-shim": "^1.0.0",
124-
"esbuild": "^0.19.3",
129+
"react": "^18.3.1",
130+
"react-dom": "^18.3.1",
131+
"enso-common": "workspace:*",
132+
"enso-project-manager-shim": "workspace:*",
125133
"eslint": "^8.49.0",
126134
"eslint-plugin-vue": "^9.22.0",
127135
"floating-vue": "^2.0.0-beta.24",
128136
"hash-wasm": "^4.10.0",
129137
"histoire": "^0.17.2",
130-
"jsdom": "^22.1.0",
138+
"jsdom": "^24.1.0",
131139
"playwright": "^1.39.0",
132140
"postcss-nesting": "^12.0.1",
133-
"prettier": "^3.2.5",
134-
"prettier-plugin-organize-imports": "^3.2.4",
141+
"prettier": "^3.3.2",
142+
"prettier-plugin-organize-imports": "^4.0.0",
135143
"shuffle-seed": "^1.1.6",
136144
"sql-formatter": "^13.0.0",
137145
"tailwindcss": "^3.2.7",
138146
"tar": "^6.2.0",
139147
"tsx": "^4.7.1",
140-
"typescript": "~5.2.2",
148+
"typescript": "^5.5.3",
141149
"unbzip2-stream": "^1.4.3",
142-
"vite": "^5.3.1",
143-
"vite-plugin-vue-devtools": "7.3.4",
150+
"vite": "^5.3.3",
151+
"vite-plugin-vue-devtools": "7.3.5",
144152
"vitest": "^1.3.1",
145153
"vue-react-wrapper": "^0.3.1",
146-
"vue-tsc": "^1.8.27"
154+
"vue-tsc": "^2.0.24"
147155
}
148156
}

app/gui2/src/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ registerAutoBlurHandler()
7575
<ProjectView
7676
v-else
7777
v-show="!props.hidden"
78+
v-bind="$attrs"
7879
class="App"
7980
:class="[...classSet.keys()]"
8081
:renameProject="renameProject"

app/gui2/src/components/GraphEditor.vue

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,17 @@ import {
7070
type ComponentInstance,
7171
} from 'vue'
7272
73+
import { builtinWidgets } from '@/components/widgets'
74+
7375
const keyboard = provideKeyboard()
7476
const projectStore = useProjectStore()
7577
const suggestionDb = provideSuggestionDbStore(projectStore)
7678
const graphStore = provideGraphStore(projectStore, suggestionDb)
7779
const widgetRegistry = provideWidgetRegistry(graphStore.db)
7880
const _visualizationStore = provideVisualizationStore(projectStore)
7981
80-
widgetRegistry.loadBuiltins()
81-
8282
onMounted(() => {
83+
widgetRegistry.loadWidgets(Object.entries(builtinWidgets))
8384
if (isDevMode) {
8485
;(window as any).suggestionDb = toRaw(suggestionDb.entries)
8586
}
@@ -512,14 +513,6 @@ interface NewNodeOptions {
512513
sourcePort?: AstId | undefined
513514
}
514515
515-
/**
516-
* Start creating a node, basing its inputs and position on the current selection, if any;
517-
* or the current viewport, otherwise.
518-
*/
519-
function addNodeAuto() {
520-
createWithComponentBrowser(fromSelection() ?? { placement: { type: 'viewport' } })
521-
}
522-
523516
function addNodeDisconnected() {
524517
nodeSelection.deselectAll()
525518
createWithComponentBrowser({ placement: { type: 'viewport' } })
@@ -808,5 +801,11 @@ const groupColors = computed(() => {
808801
left: 0;
809802
width: 0;
810803
height: 0;
804+
contain: layout size style;
805+
will-change: transform;
806+
}
807+
808+
::selection {
809+
background-color: rgba(255, 255, 255, 20%);
811810
}
812811
</style>

app/gui2/src/components/GraphEditor/GraphNode.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ const nodeEditHandler = nodeEditBindings.handler({
335335
},
336336
})
337337
338-
function startEditingNode(position: Vec2 | undefined) {
338+
function startEditingNode(position?: Vec2 | undefined) {
339339
let sourceOffset = props.node.rootExpr.code().length
340340
if (position != null) {
341341
let domNode, domOffset
@@ -608,9 +608,6 @@ watchEffect(() => {
608608
border-radius: var(--node-border-radius);
609609
transition: box-shadow 0.2s ease-in-out;
610610
box-sizing: border-box;
611-
::selection {
612-
background-color: rgba(255, 255, 255, 20%);
613-
}
614611
}
615612
616613
.content {

app/gui2/src/components/GraphEditor/toasts.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useEvent } from '@/composables/events'
22
import { type ProjectStore } from '@/stores/project'
33
import { useToast } from '@/util/toast'
4-
import { ProjectManagerEvents } from '../../../../ide-desktop/lib/dashboard/src/services/ProjectManager'
54

65
export function useGraphEditorToasts(projectStore: ProjectStore) {
76
const toastStartup = useToast.info({ autoClose: false })
@@ -13,7 +12,7 @@ export function useGraphEditorToasts(projectStore: ProjectStore) {
1312
toastStartup.show('Initializing the project. This can take up to one minute.')
1413
projectStore.firstExecution.then(toastStartup.dismiss)
1514

16-
useEvent(document, ProjectManagerEvents.loadingFailed, () =>
15+
useEvent(document, 'project-manager-loading-failed', () =>
1716
toastConnectionLost.show('Lost connection to Language Server.'),
1817
)
1918

app/gui2/src/components/SizeTransition.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {}
1515
</script>
1616
<script setup lang="ts">
1717
import { hookBeforeFunctionCall } from '@/util/patching'
18-
import { nextTick } from 'process'
18+
import { nextTick } from 'vue'
1919
2020
const props = withDefaults(
2121
defineProps<{

app/gui2/src/components/VisualizationContainer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ const contentStyle = computed(() => {
222222
223223
.content {
224224
overflow: auto;
225+
contain: strict;
225226
}
226227
227228
.content.overflow {

app/gui2/src/components/visualizations/HistogramVisualization.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ function zoomed(event: d3.D3ZoomEvent<Element, unknown>) {
337337
const newYDomain = transformEvent.rescaleY(yScale_).domain()
338338
const yMin = newYDomain[0] ?? 0
339339
if (yMin >= -EPSILON && yMin <= EPSILON) {
340-
newYDomain[0] -= yMin
341-
newYDomain[1] -= yMin
340+
newYDomain[0]! -= yMin
341+
newYDomain[1]! -= yMin
342342
}
343343
if ((newYDomain[0] ?? 0) >= 0) {
344344
yDomain.value = newYDomain

app/gui2/src/components/visualizations/TableVisualization.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ const selectableRowLimits = computed(() => {
171171
}
172172
return defaults
173173
})
174-
const wasAutomaticallyAutosized = ref(false)
175174
176175
const newNodeSelectorValues = computed(() => {
177176
let selector
@@ -562,8 +561,7 @@ function lockColumnSize(e: ColumnResizedEvent) {
562561
if (!e.finished || e.source === 'api') return
563562
// If the user manually resized (or manually autosized) a column, we don't want to auto-size it
564563
// on a resize.
565-
const manuallySized = e.source !== 'autosizeColumns' || !wasAutomaticallyAutosized.value
566-
wasAutomaticallyAutosized.value = false
564+
const manuallySized = e.source !== 'autosizeColumns'
567565
for (const column of e.columns ?? []) {
568566
const field = column.getColDef().field
569567
if (field && manuallySized) widths.set(field, column.getActualWidth())

app/gui2/src/components/widgets/ListWidget.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { useAppClass } from '@/providers/appClass'
66
import { Range } from '@/util/data/range'
77
import { Vec2 } from '@/util/data/vec2'
88
import { uuidv4 } from 'lib0/random'
9-
import { nextTick } from 'process'
10-
import { computed, ref, shallowReactive, watchEffect, watchPostEffect } from 'vue'
9+
import { computed, nextTick, ref, shallowReactive, watchEffect, watchPostEffect } from 'vue'
1110
</script>
1211

1312
<script setup lang="ts" generic="T">
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const builtinWidgets = import.meta.glob('@/components/GraphEditor/widgets/*.vue', {
2+
eager: true,
3+
})

app/gui2/src/providers/interactionHandler.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class InteractionHandler {
2828

2929
setCurrent(interaction: Interaction | undefined) {
3030
if (!this.isActive(interaction)) {
31-
this.currentInteraction.value?.end()
31+
this.currentInteraction.value?.end?.()
3232
this.currentInteraction.value = interaction
3333
}
3434
}
@@ -46,21 +46,21 @@ export class InteractionHandler {
4646
end(interaction: Interaction) {
4747
if (this.isActive(interaction)) {
4848
this.currentInteraction.value = undefined
49-
interaction.end()
49+
interaction.end?.()
5050
}
5151
}
5252

5353
/** Cancel the current interaction, if it is the specified instance. */
5454
cancel(interaction: Interaction) {
5555
if (this.isActive(interaction)) {
5656
this.currentInteraction.value = undefined
57-
interaction.cancel()
57+
interaction.cancel?.()
5858
}
5959
}
6060

6161
handleCancel(): boolean {
6262
const hasCurrent = this.currentInteraction.value != null
63-
this.currentInteraction.value?.cancel()
63+
this.currentInteraction.value?.cancel?.()
6464
this.currentInteraction.value = undefined
6565
return hasCurrent
6666
}
@@ -87,9 +87,9 @@ type InteractionEventHandler = (event: PointerEvent, navigator: GraphNavigator)
8787

8888
export interface Interaction {
8989
/** Called when the interaction is explicitly canceled, e.g. with the `Esc` key. */
90-
cancel(): void
90+
cancel?(): void
9191
/** Called when the interaction is ended due to activity elsewhere. */
92-
end(): void
92+
end?(): void
9393
/** Uses a `capture` event handler to allow an interaction to respond to clicks over any element. */
9494
pointerdown?: InteractionEventHandler
9595
/** Uses a `capture` event handler to allow an interaction to respond to mouse button release

app/gui2/src/providers/widgetRegistry.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -330,19 +330,10 @@ export class WidgetRegistry {
330330
})
331331
constructor(private db: GraphDb) {}
332332

333-
loadBuiltins() {
334-
const bulitinWidgets = import.meta.glob('@/components/GraphEditor/widgets/*.vue')
335-
this.loadAndCheckWidgetModules(Object.entries(bulitinWidgets))
336-
}
337-
338-
async loadAndCheckWidgetModules(
339-
asyncModules: [path: string, asyncModule: () => Promise<unknown>][],
340-
) {
341-
for (const [path, mod] of asyncModules) {
342-
mod().then((mod) => {
343-
if (isWidgetModule(mod)) this.registerWidgetModule(mod)
344-
else console.error('Invalid widget module:', path, mod)
345-
})
333+
loadWidgets(modules: [path: string, module: unknown][]) {
334+
for (const [path, mod] of modules) {
335+
if (isWidgetModule(mod)) this.registerWidgetModule(mod)
336+
else console.error('Invalid widget module:', path, mod)
346337
}
347338
}
348339

app/gui2/src/providers/widgetRegistry/__tests__/editHandler.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@ import { useCurrentEdit, type CurrentEdit } from '@/providers/widgetTree'
55
import { assert } from 'shared/util/assert'
66
import { expect, test, vi, type Mock } from 'vitest'
77
import { proxyRefs } from 'vue'
8-
import { WidgetEditHandler } from '../editHandler'
8+
import { WidgetEditHandler, type WidgetEditHooks } from '../editHandler'
99

1010
// If widget's name is a prefix of another widget's name, then it is its ancestor.
1111
// The ancestor with longest name is a direct parent.
1212
function editHandlerTree(
1313
widgets: string[],
1414
interactionHandler: InteractionHandler,
15-
createInteraction: (name: PortId) => Record<string, Mock>,
15+
createInteraction: (name: PortId) => WidgetEditHooks & Record<string, Mock>,
1616
widgetTree: CurrentEdit,
17-
): Map<string, { handler: WidgetEditHandler; interaction: Record<string, Mock> }> {
17+
): Map<
18+
string,
19+
{ handler: WidgetEditHandler; interaction: WidgetEditHooks & Record<string, Mock> }
20+
> {
1821
const handlers = new Map()
1922
for (const id of widgets) {
2023
let parent: string | undefined
@@ -161,7 +164,7 @@ test.each`
161164
interactionHandler.handlePointerEvent(event, 'pointerdown', navigator)
162165
const handlersCalled = new Set<string>()
163166
for (const [id, { interaction }] of handlers)
164-
if (interaction.pointerdown?.mock.lastCall) handlersCalled.add(id)
167+
if ((interaction.pointerdown as Mock | undefined)?.mock.lastCall) handlersCalled.add(id)
165168
expect([...handlersCalled].sort()).toEqual([...expectedHandlerCallsSet].sort())
166169
},
167170
)

app/gui2/src/providers/widgetRegistry/editHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export interface WidgetEditHooks extends Interaction {
258258
* {@link WidgetEditHandler} being called, or because a child is to be started.
259259
*/
260260
start?(origin: PortId): void
261-
end(origin?: PortId | undefined): void
261+
end?(origin?: PortId | undefined): void
262262
childEnded?(origin?: PortId | undefined): void
263263
/**
264264
* Hook called when a child widget provides an updated value.

0 commit comments

Comments
 (0)