Skip to content

Commit 1e72939

Browse files
committed
🎉 Web Extensions Enabled
1 parent 309e56c commit 1e72939

13 files changed

+230
-152
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
out
21
node_modules
3-
client/server
2+
dist
43
.vscode-test

.vscodeignore

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1+
.github/**
2+
.vscode/**
13
.gitignore
24
.travis.yml
3-
.vscode/**
45
**/*.map
56
**/*.ts
67
**/tsconfig.base.json
78
**/tsconfig.json
89
**/tslint.json
9-
client/node_modules/**
10+
**/node_modules/**
11+
**/*webpack.config.js
12+
**/package-lock.json
1013
client/src/**
11-
client/webpack.config.js
12-
contributing.md
13-
LICENSE
14-
node_modules/**
15-
server/node_modules/**
16-
server/src/**
17-
server/webpack.config.js
18-
shared.webpack.config.js
14+
server/src/**

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
## 2.0.0 (June 19, 2022)
2+
* Now available for [vscode.dev](https://vscode.dev/) and other web platforms.
3+
* Updated dependencies & HTML language server
4+
* Bug Fixes
5+
16
## 1.10.0 (March 13, 2022)
2-
* Respected editorconfig and file indendation (Issues #193, #338)
3-
* Updated dependencies & html language server
7+
* Respected editorconfig and file indentation (Issues #193, #338)
8+
* Updated dependencies & HTML language server
49
* Bug Fixes
510

611
## 1.9.0 (July 31, 2021)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
![GitHub closed issues](https://img.shields.io/github/issues-closed/aswinkumar863/smarty-vscode-support?color=blue)
88

99
This extension provides [Smarty Template](https://www.smarty.net/) support for Visual Studio Code.
10-
Supports `{...}` and `{{...}}` delimiters.
10+
Supports `{...}` and `{{...}}` delimiters. Available for both VSCode [desktop](https://code.visualstudio.com/Download) and [web](https://vscode.dev/).
1111

1212
## Features
1313

client/src/client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import * as path from "path";
2-
import { ExtensionContext } from "vscode";
2+
import { ExtensionContext, env } from "vscode";
33
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from "vscode-languageclient/node";
44

55
import * as CONSTANT from "./constants";
66

77
export function createLanguageClient(context: ExtensionContext) {
88
// The server is implemented in node
9+
let root = env.uiKind === 1 ? "node" : "web";
910
let serverModule = context.asAbsolutePath(
10-
path.join("server", "out", "server.js")
11+
path.join("server", "dist", root, "nodeServerMain.js")
1112
);
1213

1314
// The debug options for the server

client/webpack.config.js

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/* eslint-disable no-undef */
2+
/* eslint-disable @typescript-eslint/no-var-requires */
3+
4+
//@ts-check
5+
'use strict';
6+
7+
//@ts-check
8+
/** @typedef {import('webpack').Configuration} WebpackConfig **/
9+
10+
const path = require('path');
11+
12+
/** @type WebpackConfig */
13+
const browserClientConfig = {
14+
context: path.join(__dirname, 'client'),
15+
mode: 'none',
16+
target: 'webworker', // web extensions run in a webworker context
17+
entry: {
18+
browserClientMain: './src/extension.ts',
19+
},
20+
output: {
21+
filename: '[name].js',
22+
path: path.join(__dirname, 'client', 'dist', 'browser'),
23+
libraryTarget: 'commonjs',
24+
},
25+
resolve: {
26+
mainFields: ['module', 'main'],
27+
extensions: ['.ts', '.js'], // support ts-files and js-files
28+
alias: {},
29+
fallback: {
30+
path: require.resolve('path-browserify'),
31+
},
32+
},
33+
module: {
34+
rules: [
35+
{
36+
test: /\.ts$/,
37+
exclude: /node_modules/,
38+
use: [
39+
{
40+
loader: 'ts-loader',
41+
},
42+
],
43+
},
44+
],
45+
},
46+
externals: {
47+
vscode: 'commonjs vscode', // ignored because it doesn't exist
48+
},
49+
performance: {
50+
hints: false,
51+
},
52+
devtool: 'source-map',
53+
};
54+
55+
/** @type WebpackConfig */
56+
const browserServerConfig = {
57+
context: path.join(__dirname, 'server'),
58+
mode: 'none',
59+
target: 'webworker', // web extensions run in a webworker context
60+
entry: {
61+
browserServerMain: './src/node/htmlServerMain.ts',
62+
},
63+
output: {
64+
filename: '[name].js',
65+
path: path.join(__dirname, 'server', 'dist', 'browser'),
66+
libraryTarget: 'var',
67+
library: 'serverExportVar',
68+
},
69+
resolve: {
70+
mainFields: ['module', 'main'],
71+
extensions: ['.ts', '.js'], // support ts-files and js-files
72+
alias: {},
73+
fallback: {
74+
path: require.resolve("path-browserify"),
75+
fs: false
76+
},
77+
},
78+
module: {
79+
rules: [
80+
{
81+
test: /\.ts$/,
82+
exclude: /node_modules/,
83+
use: [
84+
{
85+
loader: 'ts-loader',
86+
},
87+
],
88+
},
89+
],
90+
},
91+
externals: {
92+
vscode: 'commonjs vscode', // ignored because it doesn't exist
93+
},
94+
performance: {
95+
hints: false,
96+
},
97+
devtool: 'source-map',
98+
};
99+
100+
module.exports = [browserClientConfig, browserServerConfig];

extension.webpack.config.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/* eslint-disable no-undef */
2+
/* eslint-disable @typescript-eslint/no-var-requires */
3+
4+
//@ts-check
5+
'use strict';
6+
7+
//@ts-check
8+
/** @typedef {import('webpack').Configuration} WebpackConfig **/
9+
10+
const path = require('path');
11+
12+
/** @type WebpackConfig */
13+
const browserClientConfig = {
14+
context: path.join(__dirname, 'client'),
15+
mode: 'none',
16+
target: 'node', // vscode extensions run in a node context
17+
entry: {
18+
nodeClientMain: './src/extension.ts',
19+
},
20+
output: {
21+
filename: '[name].js',
22+
path: path.join(__dirname, 'client', 'dist', 'node'),
23+
libraryTarget: 'commonjs',
24+
},
25+
resolve: {
26+
extensions: ['.ts', '.js'], // support ts-files and js-files
27+
},
28+
module: {
29+
rules: [
30+
{
31+
test: /\.ts$/,
32+
exclude: /node_modules/,
33+
use: [
34+
{
35+
loader: 'ts-loader',
36+
},
37+
],
38+
},
39+
],
40+
},
41+
externals: {
42+
vscode: 'commonjs vscode', // ignored because it doesn't exist
43+
}
44+
};
45+
46+
/** @type WebpackConfig */
47+
const browserServerConfig = {
48+
context: path.join(__dirname, 'server'),
49+
mode: 'none',
50+
target: 'node', // vscode extensions run in a node context
51+
entry: {
52+
nodeServerMain: './src/node/htmlServerMain.ts',
53+
},
54+
output: {
55+
filename: '[name].js',
56+
path: path.join(__dirname, 'server', 'dist', 'node'),
57+
libraryTarget: 'commonjs',
58+
},
59+
resolve: {
60+
extensions: ['.ts', '.js'], // support ts-files and js-files
61+
},
62+
module: {
63+
rules: [
64+
{
65+
test: /\.ts$/,
66+
exclude: /node_modules/,
67+
use: [
68+
{
69+
loader: 'ts-loader',
70+
},
71+
],
72+
},
73+
],
74+
},
75+
externals: {
76+
vscode: 'commonjs vscode', // ignored because it doesn't exist
77+
}
78+
};
79+
80+
module.exports = [browserClientConfig, browserServerConfig];

package-lock.json

Lines changed: 15 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)