Skip to content

Commit

Permalink
Revert "Merge pull request h3poteto#1944 from h3poteto/revert-1923-swc"
Browse files Browse the repository at this point in the history
This reverts commit 6096976, reversing
changes made to 31508df.
  • Loading branch information
ThatOneCalculator committed Sep 26, 2023
1 parent 6096976 commit 68cdcf2
Show file tree
Hide file tree
Showing 8 changed files with 1,533 additions and 1,376 deletions.
20 changes: 20 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"jsc": {
"target": "es5",
"parser": {
"syntax": "typescript",
"tsx": false,
"decorators": true,
"dynamicImport": true
},
"transform": {
"decoratorMetadata": true
},
"keepClassNames": true
},
"module": {
"type": "commonjs"
},
"minify": false,
"sourceMaps": false
}
2 changes: 2 additions & 0 deletions example/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"megalodon": "*"
},
"devDependencies": {
"@swc/core": "^1.3.87",
"assert": "^2.1.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
Expand All @@ -24,6 +25,7 @@
"querystring-es3": "^0.2.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"swc-loader": "^0.2.3",
"ts-loader": "^9.4.4",
"typescript": "5.2.2",
"url": "^0.11.3",
Expand Down
22 changes: 19 additions & 3 deletions example/browser/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var path = require('path')
var webpack = require('webpack')
var path = require('path');
var webpack = require('webpack');

module.exports = {
entry: './src/index.ts',
Expand All @@ -11,6 +11,9 @@ module.exports = {
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.js'],
alias: {
megalodon: path.resolve(__dirname, '../../megalodon/lib/index.js'), // adjust the path if necessary
},
fallback: {
net: false,
tls: false,
Expand All @@ -32,7 +35,20 @@ module.exports = {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader'
exclude: /node_modules/,
use: [
{
loader: 'swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: false,
}
}
}
}
]
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion example/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "4.0.0",
"private": true,
"scripts": {
"build": "tsc -p ./",
"build": "swc ./src -d dist --source-maps",
"lint": "eslint --ext .js,.ts src"
},
"author": "h3poteto",
Expand Down
20 changes: 20 additions & 0 deletions megalodon/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"jsc": {
"target": "es5",
"parser": {
"syntax": "typescript",
"tsx": false,
"decorators": true,
"dynamicImport": true
},
"transform": {
"decoratorMetadata": true
},
"keepClassNames": true
},
"module": {
"type": "commonjs"
},
"minify": false,
"sourceMaps": false
}
13 changes: 9 additions & 4 deletions megalodon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./lib/src/index.js",
"typings": "./lib/src/index.d.ts",
"scripts": {
"build": "tsc -p ./",
"build": "swc ./src -d ./lib",
"lint": "eslint --ext .js,.ts src",
"doc": "typedoc --out ../docs ./src",
"test": "NODE_ENV=test jest -u --maxWorkers=3"
Expand Down Expand Up @@ -44,9 +44,12 @@
],
"preset": "ts-jest/presets/default",
"transform": {
"^.+\\.(ts|tsx)$": ["ts-jest", {
"tsconfig": "tsconfig.json"
}]
"^.+\\.(ts|tsx)$": [
"ts-jest",
{
"tsconfig": "tsconfig.json"
}
]
},
"testEnvironment": "node"
},
Expand All @@ -67,6 +70,8 @@
"ws": "8.14.2"
},
"devDependencies": {
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.87",
"@types/core-js": "^2.5.6",
"@types/form-data": "^2.5.0",
"@types/jest": "^29.5.5",
Expand Down
4 changes: 2 additions & 2 deletions megalodon/test/integration/detector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('detector', () => {
})

describe('friendica', () => {
const url = 'https://squeet.me'
const url = 'https://detracker.nu'
it('should be friendica', async () => {
const friendica = await detector(url)
expect(friendica).toEqual('friendica')
Expand All @@ -50,7 +50,7 @@ describe('detector', () => {
})

describe('firefish', () => {
const url = 'https://cybre.club'
const url = 'https://fedi.software'
it('should be firefish', async () => {
const firefish = await detector(url)
expect(firefish).toEqual('firefish')
Expand Down
Loading

0 comments on commit 68cdcf2

Please sign in to comment.