Skip to content

Commit

Permalink
fix: unclear licensing memfs fork transitive deps, types (#1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema authored Jul 3, 2024
1 parent f6c423f commit 3ae67e3
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 34 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-brooms-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Upgrade memfs esm fork to publish types and bumping stream to fix unclear licensing issue with transitive dependency.
7 changes: 2 additions & 5 deletions docs/src/components/sd-playground.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import StyleDictionary from 'style-dictionary';
import memfs from '@bundled-es-modules/memfs';
import type { fs as VolumeType } from 'memfs';
import { Volume } from '@bundled-es-modules/memfs';
import { LitElement, html, css } from 'lit';
import { posix as path } from 'path-unified';
import '@shoelace-style/shoelace/dist/components/radio-button/radio-button.js';
Expand All @@ -14,8 +13,6 @@ import { downloadZIP } from '../../../lib/utils/downloadFile.js';
import type SlRadioGroup from '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
import type { Config } from '../../../types/Config.ts';

const { Volume } = memfs;

const defaults = {
tokens: {
colors: {
Expand Down Expand Up @@ -175,7 +172,7 @@ class SdPlayground extends LitElement {
declare outputFiles: string[];
declare _currentFile: Files;
declare editor: any;
declare volume: typeof VolumeType;
declare volume: InstanceType<typeof Volume>;
declare hasInitialized: Promise<void>;
declare hasInitializedResolve: (value: void) => void;

Expand Down
4 changes: 3 additions & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import memfs from '@bundled-es-modules/memfs';

/**
* Allow to be overridden by setter, set default to memfs for browser env, node:fs for node env
* Default CJS export when converted to ESM, messes up the types a bit so we need to
* cast the default import to type of Volume by first casting to unknown...
*/
export let fs = /** @type {Volume} */ (memfs);
export let fs = /** @type {Volume} */ (/** @type {unknown} */ (memfs));

/**
* since ES modules exports are read-only, use a setter
Expand Down
29 changes: 6 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"dependencies": {
"@bundled-es-modules/deepmerge": "^4.3.1",
"@bundled-es-modules/glob": "^10.4.2",
"@bundled-es-modules/memfs": "^4.8.1",
"@bundled-es-modules/memfs": "^4.9.3",
"@zip.js/zip.js": "^2.7.44",
"chalk": "^5.3.0",
"change-case": "^5.3.0",
Expand Down Expand Up @@ -147,7 +147,6 @@
"lint-staged": "^12.3.1",
"lit": "^3.1.2",
"mdast": "^3.0.0",
"memfs": "^4.6.0",
"mermaid": "^10.9.1",
"mocha": "^10.2.0",
"monaco-editor": "^0.47.0",
Expand Down
6 changes: 4 additions & 2 deletions types/Volume.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { IFs } from 'memfs';
import type { Volume as _Volume } from '@bundled-es-modules/memfs';

export type Volume = (IFs | typeof import('node:fs')) & { __custom_fs__?: boolean };
export type Volume = (InstanceType<typeof _Volume> | typeof import('node:fs')) & {
__custom_fs__?: boolean;
};
1 change: 0 additions & 1 deletion types/typeless-modules/bundled-memfs.d.ts

This file was deleted.

0 comments on commit 3ae67e3

Please sign in to comment.