Skip to content

Commit

Permalink
Merge pull request #2961 from opral/felixhaeberle/sherl-50-vs-code-ex…
Browse files Browse the repository at this point in the history
…tension-not-starting-missing-enabledapiproposal

vs code extension not starting missing enabledapiproposal
  • Loading branch information
felixhaeberle authored Jun 24, 2024
2 parents 54a8957 + aa5b543 commit 9e113f9
Show file tree
Hide file tree
Showing 7 changed files with 416 additions and 334 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-steaks-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vs-code-extension": minor
---

fix `missing enabledApiProposal` bug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cache
24 changes: 12 additions & 12 deletions inlang/source-code/ide-extension/assets/settings-component.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26971,7 +26971,7 @@ var b = class extends HTMLElement {
};
b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d("elementProperties")] = /* @__PURE__ */ new Map(), b[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: b }), (a.reactiveElementVersions ??= []).push("2.0.4");

// ../../../node_modules/.pnpm/lit-html@3.1.3/node_modules/lit-html/lit-html.js
// ../../../node_modules/.pnpm/lit-html@3.1.4/node_modules/lit-html/lit-html.js
var t2 = globalThis;
var i3 = t2.trustedTypes;
var s2 = i3 ? i3.createPolicy("lit-html", { createHTML: (t7) => t7 }) : void 0;
Expand Down Expand Up @@ -27229,7 +27229,7 @@ var L = class {
};
var z = { P: e3, A: h2, C: o3, M: 1, L: P, R: S2, D: u2, V: N, I: M, H: R, N: H, U: I, B: k, F: L };
var Z = t2.litHtmlPolyfillSupport;
Z?.(V, M), (t2.litHtmlVersions ??= []).push("3.1.3");
Z?.(V, M), (t2.litHtmlVersions ??= []).push("3.1.4");
var j = (t7, i5, s5) => {
const e11 = s5?.renderBefore ?? i5;
let h3 = e11._$litPart$;
Expand Down Expand Up @@ -28131,7 +28131,7 @@ var InlangModule = import_typebox9.Type.Object({
// ../sdk/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.js
var import_value = __toESM(require_value2(), 1);

// ../../../node_modules/.pnpm/dedent@1.5.1/node_modules/dedent/dist/dedent.mjs
// ../../../node_modules/.pnpm/dedent@1.5.1_babel-plugin-macros@2.8.0/node_modules/dedent/dist/dedent.mjs
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
Expand Down Expand Up @@ -29567,6 +29567,7 @@ var registry = [
"/": "./inlang/source-code/paraglide/paraglide-js/docs/why-paraglide.md",
"/getting-started": "./inlang/source-code/paraglide/paraglide-js/README.md",
"/usage": "./inlang/source-code/paraglide/paraglide-js/docs/usage.md",
"/scaling": "./inlang/source-code/paraglide/paraglide-js/docs/scaling.md",
"/architecture": "./inlang/source-code/paraglide/paraglide-js/docs/architecture.md",
"/changelog": "./inlang/source-code/paraglide/paraglide-js/CHANGELOG.md"
},
Expand Down Expand Up @@ -29782,8 +29783,7 @@ var registry = [
"/": "./inlang/source-code/paraglide/paraglide-sveltekit/docs/why-paraglide.md",
"/getting-started": "./inlang/source-code/paraglide/paraglide-sveltekit/README.md",
"/localised-routing": "./inlang/source-code/paraglide/paraglide-sveltekit/docs/localised-routing.md",
"/advanced-usage": "./inlang/source-code/paraglide/paraglide-sveltekit/docs/advanced-usage.md",
"/serverside-usage": "./inlang/source-code/paraglide/paraglide-sveltekit/docs/serverside-usage.md"
"/advanced-usage": "./inlang/source-code/paraglide/paraglide-sveltekit/docs/advanced-usage.md"
},
Appendix: {
"/manual-setup": "./inlang/source-code/paraglide/paraglide-sveltekit/docs/manual-setup.md",
Expand Down Expand Up @@ -32300,7 +32300,7 @@ __decorateClass2([
n4()
], ShoelaceElement.prototype, "lang", 2);

// ../../../node_modules/.pnpm/lit-html@3.1.3/node_modules/lit-html/directive-helpers.js
// ../../../node_modules/.pnpm/lit-html@3.1.4/node_modules/lit-html/directive-helpers.js
var { I: t4 } = z;
var e6 = (o9, t7) => void 0 === t7 ? void 0 !== o9?._$litType$ : o9?._$litType$ === t7;
var f3 = (o9) => void 0 === o9.strings;
Expand Down Expand Up @@ -32457,7 +32457,7 @@ __decorateClass2([
watch(["name", "src", "library"])
], SlIcon.prototype, "setIcon", 1);

// ../../../node_modules/.pnpm/lit-html@3.1.3/node_modules/lit-html/directive.js
// ../../../node_modules/.pnpm/lit-html@3.1.4/node_modules/lit-html/directive.js
var t5 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
var e7 = (t7) => (...e11) => ({ _$litDirective$: t7, values: e11 });
var i4 = class {
Expand All @@ -32477,7 +32477,7 @@ var i4 = class {
}
};

// ../../../node_modules/.pnpm/lit-html@3.1.3/node_modules/lit-html/directives/class-map.js
// ../../../node_modules/.pnpm/lit-html@3.1.4/node_modules/lit-html/directives/class-map.js
var e8 = e7(class extends i4 {
constructor(t7) {
if (super(t7), t7.type !== t5.ATTRIBUTE || "class" !== t7.name || t7.strings?.length > 2)
Expand All @@ -32504,7 +32504,7 @@ var e8 = e7(class extends i4 {
}
});

// ../../../node_modules/.pnpm/lit-html@3.1.3/node_modules/lit-html/static.js
// ../../../node_modules/.pnpm/lit-html@3.1.4/node_modules/lit-html/static.js
var e9 = Symbol.for("");
var o5 = (t7) => {
if (t7?.r === e9)
Expand Down Expand Up @@ -32536,7 +32536,7 @@ var l3 = (t7) => (r8, ...e11) => {
var n5 = l3(x);
var u4 = l3(b2);

// ../../../node_modules/.pnpm/lit-html@3.1.3/node_modules/lit-html/directives/if-defined.js
// ../../../node_modules/.pnpm/lit-html@3.1.4/node_modules/lit-html/directives/if-defined.js
var o6 = (o9) => o9 ?? T;

// ../../../node_modules/.pnpm/@shoelace-style+shoelace@2.14.0_@types+react@18.3.1/node_modules/@shoelace-style/shoelace/dist/chunks/chunk.7XLSSP47.js
Expand Down Expand Up @@ -35561,7 +35561,7 @@ var HasSlotController = class {
}
};

// ../../../node_modules/.pnpm/lit-html@3.1.3/node_modules/lit-html/directives/unsafe-html.js
// ../../../node_modules/.pnpm/lit-html@3.1.4/node_modules/lit-html/directives/unsafe-html.js
var e10 = class extends i4 {
constructor(i5) {
if (super(i5), this.it = T, i5.type !== t5.CHILD)
Expand Down Expand Up @@ -36796,7 +36796,7 @@ var input_styles_default = i`
}
`;

// ../../../node_modules/.pnpm/lit-html@3.1.3/node_modules/lit-html/directives/live.js
// ../../../node_modules/.pnpm/lit-html@3.1.4/node_modules/lit-html/directives/live.js
var l4 = e7(class extends i4 {
constructor(r8) {
if (super(r8), r8.type !== t5.PROPERTY && r8.type !== t5.ATTRIBUTE && r8.type !== t5.BOOLEAN_ATTRIBUTE)
Expand Down
38 changes: 19 additions & 19 deletions inlang/source-code/ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,40 +242,40 @@
"@lix-js/fs": "workspace:*",
"@vitest/coverage-v8": "0.34.6",
"https-proxy-agent": "7.0.2",
"lit-html": "^3.1.4",
"lit-html": "^3.1.2",
"require-from-string": "^2.0.2",
"throttle-debounce": "^5.0.0",
"vitest": "0.34.6"
},
"devDependencies": {
"@sentry/node": "^7.117.0",
"@types/fs-extra": "^11.0.4",
"@sentry/node": "^7.99.0",
"@types/fs-extra": "^11.0.2",
"@types/glob": "^8.1.0",
"@types/mocha": "^10.0.6",
"@types/node": "^20.14.7",
"@types/require-from-string": "^1.2.3",
"@types/mocha": "^10.0.2",
"@types/node": "^20.11.16",
"@types/require-from-string": "^1.2.1",
"@types/throttle-debounce": "^5.0.2",
"@types/ungap__structured-clone": "^0.3.3",
"@types/vscode": "^1.84.2",
"@vscode/vsce": "^2.29.0",
"@wdio/cli": "^8.39.0",
"@wdio/globals": "^8.39.0",
"@wdio/local-runner": "^8.39.0",
"@wdio/mocha-framework": "^8.39.0",
"@wdio/spec-reporter": "^8.39.0",
"@wdio/types": "^8.39.0",
"@vscode/vsce": "^2.26.1",
"@wdio/cli": "^8.24.6",
"@wdio/globals": "^8.24.6",
"@wdio/local-runner": "^8.24.6",
"@wdio/mocha-framework": "^8.24.6",
"@wdio/spec-reporter": "^8.24.2",
"@wdio/types": "^8.24.2",
"chromedriver": "^121.0.2",
"comment-json": "^4.2.3",
"esbuild": "^0.19.12",
"expect-webdriverio": "^4.15.1",
"esbuild": "^0.19.8",
"expect-webdriverio": "^4.6.1",
"fs-extra": "^11.2.0",
"mocha": "^10.4.0",
"mocha": "^10.2.0",
"node-fetch": "^3.3.2",
"ovsx": "^0.8.4",
"posthog-node": "^3.6.3",
"ts-node": "^10.9.2",
"posthog-node": "^3.1.2",
"ts-node": "^10.9.1",
"typescript": "5.3.2",
"wdio-vscode-service": "^6.1.0"
"wdio-vscode-service": "^6.0.0"
},
"activationEvents": [
"onStartupFinished"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("createFileSystemMapper", () => {
stat: vi.fn(),
watch: vi.fn(),
lstat: vi.fn(),
rm: vi.fn(),
rmdir: vi.fn(),
unlink: vi.fn(),
readlink: vi.fn(),
Expand All @@ -32,7 +33,8 @@ describe("createFileSystemMapper", () => {

expect(mockFs.writeFile).toHaveBeenCalledWith(
testPath.startsWith(normalizedBase) ? testPath : _path.resolve(normalizedBase, testPath),
"test content"
"test content",
undefined
)
})

Expand All @@ -59,6 +61,18 @@ describe("createFileSystemMapper", () => {
)
})

it("should map rm correctly", async () => {
const fs = createFileSystemMapper(normalizedBase, mockFs)
const testPath = "/test/path"

await fs.rm(testPath, { recursive: true })

expect(mockFs.rm).toHaveBeenCalledWith(
testPath.startsWith(normalizedBase) ? testPath : _path.resolve(normalizedBase, testPath),
{ recursive: true }
)
})

it("should map rmdir correctly", async () => {
const fs = createFileSystemMapper(normalizedBase, mockFs)
const testPath = "/test/path"
Expand Down Expand Up @@ -109,10 +123,11 @@ describe("createFileSystemMapper", () => {
const fs = createFileSystemMapper(normalizedBase, mockFs)
const testPath = "/test/path"

await fs.mkdir(testPath)
await fs.mkdir(testPath, { recursive: true })

expect(mockFs.mkdir).toHaveBeenCalledWith(
testPath.startsWith(normalizedBase) ? testPath : _path.resolve(normalizedBase, testPath)
testPath.startsWith(normalizedBase) ? testPath : _path.resolve(normalizedBase, testPath),
{ recursive: true }
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,66 @@ export function createFileSystemMapper(base: string, fs: NodeishFilesystem): Nod
// Prevent path issue on non Unix based system normalizing the <base> before using it
const normalizedBase = normalizePath(base)

/**
* Returns a function that normalizes it's first argument (the path) and calls the original function
*/
const normalized = <T extends any[], R>(
fn: (path: string, ...rest: T) => R
): ((path: string, ...rest: T) => R) => {
return (path: string, ...rest: T): R => {
return fn(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path)),
...rest
)
}
}

return {
// @ts-expect-error
readFile: normalized(fs.readFile),
writeFile: normalized(fs.writeFile),
mkdir: normalized(fs.mkdir),
rmdir: normalized(fs.rmdir),
unlink: normalized(fs.unlink),
readdir: normalized(fs.readdir),
readlink: normalized(fs.readlink),

// this is the only one where the wrapper does not work since there are two args ;)
readFile: async (
path: Parameters<NodeishFilesystem["readFile"]>[0],
options: Parameters<NodeishFilesystem["readFile"]>[1]
): Promise<string | Uint8Array> => {
return fs.readFile(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path)),
options
)
},
writeFile: async (
path: Parameters<NodeishFilesystem["writeFile"]>[0],
data: Parameters<NodeishFilesystem["writeFile"]>[1],
options: Parameters<NodeishFilesystem["writeFile"]>[2]
) => {
return fs.writeFile(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path)),
data,
options
)
},
mkdir: async (
path: Parameters<NodeishFilesystem["mkdir"]>[0],
options: Parameters<NodeishFilesystem["mkdir"]>[1]
) => {
return fs.mkdir(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path)),
options
)
},
rmdir: async (path: Parameters<NodeishFilesystem["rmdir"]>[0]) => {
return fs.rmdir(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path))
)
},
rm: async (
path: Parameters<NodeishFilesystem["rm"]>[0],
options: Parameters<NodeishFilesystem["rm"]>[1]
) => {
return fs.rm(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path)),
options
)
},
unlink: async (path: Parameters<NodeishFilesystem["unlink"]>[0]) => {
return fs.unlink(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path))
)
},
readdir: async (path: Parameters<NodeishFilesystem["readdir"]>[0]) => {
return fs.readdir(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path))
)
},
readlink: async (path: Parameters<NodeishFilesystem["readlink"]>[0]) => {
return fs.readlink(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path))
)
},
symlink: async (
path: Parameters<NodeishFilesystem["symlink"]>[0],
target: Parameters<NodeishFilesystem["symlink"]>[1]
Expand All @@ -47,8 +82,24 @@ export function createFileSystemMapper(base: string, fs: NodeishFilesystem): Nod
)
)
},
stat: normalized(fs.stat),
watch: normalized(fs.watch),
lstat: normalized(fs.lstat),
stat: async (path: Parameters<NodeishFilesystem["stat"]>[0]) => {
return fs.stat(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path))
)
},
watch: (
path: Parameters<NodeishFilesystem["watch"]>[0],
options: Parameters<NodeishFilesystem["watch"]>[1]
) => {
return fs.watch(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path)),
options
)
},
lstat: async (path: Parameters<NodeishFilesystem["lstat"]>[0]) => {
return fs.lstat(
normalizePath(path.startsWith(normalizedBase) ? path : _path.resolve(normalizedBase, path))
)
},
}
}
Loading

0 comments on commit 9e113f9

Please sign in to comment.