Skip to content

Commit 5bb0d36

Browse files
committed
Add Typescript support
1 parent bbac4ff commit 5bb0d36

23 files changed

+15186
-4340
lines changed

.babelrc.js renamed to .babelrc.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ module.exports = {
44
'@babel/preset-env',
55
{
66
targets: '> 0.25%, not dead',
7+
modules: 'commonjs',
78
},
89
],
10+
'@babel/preset-typescript',
911
],
1012
};

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/* -diff

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
node_modules
2-
lib
1+
node_modules

.prettierrc.js renamed to .prettierrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ module.exports = {
22
trailingComma: 'es5',
33
tabWidth: 2,
44
singleQuote: true,
5+
printWidth: 80,
56
};

bin/pseudo-localize

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const getStdin = require('get-stdin');
66
const flatten = require('flat');
77
const unflatten = require('flat').unflatten;
88

9-
const { localize } = require('../lib/index');
9+
const { localize } = require('../dist/cjs/index');
1010

1111
const argv = require('yargs')
1212
.usage(

devserver.js renamed to devserver.mjs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
var http = require('http');
2-
var url = require('url');
3-
var fs = require('fs');
4-
var path = require('path');
5-
var baseDirectory = __dirname;
1+
import http from 'http'
2+
import url from 'url'
3+
import fs from 'fs'
4+
import path from 'path'
65

7-
var port = 8080;
6+
const port = 8080;
7+
const baseDirectory = url.fileURLToPath(new URL('.', import.meta.url));
88

99
http
1010
.createServer(function(request, response) {
1111
try {
1212
var requestUrl = url.parse(request.url);
1313

1414
// need to use path.normalize so people can't access directories underneath baseDirectory
15-
var fsPath = baseDirectory + path.normalize(requestUrl.pathname);
15+
var fsPath = path.join(baseDirectory, path.normalize(requestUrl.pathname));
16+
17+
console.log(fsPath);
1618

1719
// Force correct content-type for JavaScript
1820
// This is a work-around for an issue where

dist/cjs/index.js

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

dist/cjs/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cjs/localize.js

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

0 commit comments

Comments
 (0)