Skip to content

Commit ee41557

Browse files
committed
More consistent POSIX-like virtual file system.
1 parent 9c25443 commit ee41557

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+13243
-8980
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js
4646
scripts/generateLocalizedDiagnosticMessages.js
4747
scripts/*.js.map
4848
scripts/typings/
49-
scripts/typemock/dist
49+
scripts/*/dist
5050
coverage/
5151
internal/
5252
**/.DS_Store

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ install:
2424
- npm uninstall tslint --no-save
2525
- npm install
2626
- if [ "$TRAVIS_NODE_VERSION" = "6" ]; then
27-
npm uninstall typemock --no-save;
28-
npm run build:typemock;
29-
npm install file:scripts/typemock --no-save;
27+
npm uninstall typemock @typescript/vfs-om @typescript/vfs @typescript/vfs-path @typescript/vfs-core @typescript/vfs-errors --no-save;
28+
npm run build:private-packages;
29+
npm install file:scripts/typemock file:scripts/vfs-om file:scripts/vfs file:scripts/vfs-path --no-save;
3030
fi
3131

3232
cache:

Gulpfile.ts

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const constEnumCaptureRegexp = /^(\s*)(export )?const enum (\S+) {(\s*)$/gm;
4343
const constEnumReplacement = "$1$2enum $3 {$4";
4444

4545
const cmdLineOptions = minimist(process.argv.slice(2), {
46-
boolean: ["debug", "inspect", "light", "colors", "lint", "soft"],
46+
boolean: ["debug", "inspect", "light", "colors", "lint", "soft", "bail"],
4747
string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout"],
4848
alias: {
4949
"b": "browser",
@@ -68,6 +68,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
6868
runners: process.env.runners || process.env.runner || process.env.ru,
6969
light: process.env.light === undefined || process.env.light !== "false",
7070
reporter: process.env.reporter || process.env.r,
71+
bail: false,
7172
lint: process.env.lint || true,
7273
files: process.env.f || process.env.file || process.env.files || "",
7374
workers: process.env.workerCount || os.cpus().length,
@@ -609,18 +610,60 @@ gulp.task("LKG", "Makes a new LKG out of the built js files", ["clean", "dontUse
609610
});
610611

611612
gulp.task("typemock", () => {
612-
const typemock = tsc.createProject("scripts/typemock/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ false));
613-
return typemock.src()
613+
const project = tsc.createProject("scripts/typemock/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ false));
614+
return project.src()
614615
.pipe(sourcemaps.init())
615-
.pipe(newer("scripts/typemock/dist"))
616-
.pipe(typemock())
617-
.pipe(sourcemaps.write(".", <any>{ includeContent: false, destPath: "scripts/typemock/dist" }))
616+
.pipe(newer("scripts/typemock/dist/index.js"))
617+
.pipe(project())
618+
.pipe(sourcemaps.write(".", <any>{ sourceRoot: "../src", includeContent: false, destPath: "scripts/typemock/dist" }))
618619
.pipe(gulp.dest("scripts/typemock/dist"));
619620
});
620621

622+
gulp.task("vfs-core", () => {
623+
const project = tsc.createProject("scripts/vfs-core/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ false));
624+
return project.src()
625+
.pipe(sourcemaps.init())
626+
.pipe(newer("scripts/vfs-core/dist/index.js"))
627+
.pipe(project())
628+
.pipe(sourcemaps.write(".", <any>{ sourceRoot: "../src", includeContent: false, destPath: "scripts/vfs-core/dist" }))
629+
.pipe(gulp.dest("scripts/vfs-core/dist"));
630+
});
631+
632+
gulp.task("vfs-errors", () => {
633+
const project = tsc.createProject("scripts/vfs-errors/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ false));
634+
return project.src()
635+
.pipe(sourcemaps.init())
636+
.pipe(newer("scripts/vfs-errors/dist/index.js"))
637+
.pipe(project())
638+
.pipe(sourcemaps.write(".", <any>{ sourceRoot: "../src", includeContent: false, destPath: "scripts/vfs-errors/dist" }))
639+
.pipe(gulp.dest("scripts/vfs-errors/dist"));
640+
});
641+
642+
gulp.task("vfs-path", ["vfs-core", "vfs-errors"], () => {
643+
const project = tsc.createProject("scripts/vfs-path/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ false));
644+
return project.src()
645+
.pipe(sourcemaps.init())
646+
.pipe(newer("scripts/vfs-path/dist/index.js"))
647+
.pipe(project())
648+
.pipe(sourcemaps.write(".", <any>{ sourceRoot: "../src", includeContent: false, destPath: "scripts/vfs-path/dist" }))
649+
.pipe(gulp.dest("scripts/vfs-path/dist"));
650+
});
651+
652+
gulp.task("vfs", ["vfs-core", "vfs-errors", "vfs-path"], () => {
653+
const project = tsc.createProject("scripts/vfs/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ false));
654+
return project.src()
655+
.pipe(sourcemaps.init())
656+
.pipe(newer("scripts/vfs/dist/index.js"))
657+
.pipe(project())
658+
.pipe(sourcemaps.write(".", <any>{ sourceRoot: "../src", includeContent: false, destPath: "scripts/vfs/dist" }))
659+
.pipe(gulp.dest("scripts/vfs/dist"));
660+
});
661+
662+
gulp.task("private-packages", ["typemock", "vfs"]);
663+
621664
// Task to build the tests infrastructure using the built compiler
622665
const run = path.join(builtLocalDirectory, "run.js");
623-
gulp.task(run, /*help*/ false, [servicesFile, tsserverLibraryFile, "typemock"], () => {
666+
gulp.task(run, /*help*/ false, [servicesFile, tsserverLibraryFile, "private-packages"], () => {
624667
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
625668
return testProject.src()
626669
.pipe(newer(run))
@@ -670,6 +713,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
670713
const runners = cmdLineOptions.runners;
671714
const light = cmdLineOptions.light;
672715
const stackTraceLimit = cmdLineOptions.stackTraceLimit;
716+
const bail = cmdLineOptions.bail;
673717
const testConfigFile = "test.config";
674718
if (fs.existsSync(testConfigFile)) {
675719
fs.unlinkSync(testConfigFile);
@@ -722,6 +766,9 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
722766
else {
723767
args.push("-t", testTimeout);
724768
}
769+
if (bail) {
770+
args.push("--bail");
771+
}
725772
args.push(run);
726773
setNodeEnvToDevelopment();
727774
exec(mocha, args, lintThenFinish, finish);

Jakefile.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,60 @@ task("typemock", function () {
792792
});
793793
}, { async: true });
794794

795+
task("vfs-core", function () {
796+
var startCompileTime = mark();
797+
execCompiler(/*useBuiltCompiler*/ false, ["-p", "scripts/vfs-core/tsconfig.json"], function (error) {
798+
if (error) {
799+
fail("Compilation unsuccessful.");
800+
}
801+
else {
802+
complete();
803+
}
804+
measure(startCompileTime);
805+
});
806+
}, { async: true });
807+
808+
task("vfs-errors", function () {
809+
var startCompileTime = mark();
810+
execCompiler(/*useBuiltCompiler*/ false, ["-p", "scripts/vfs-errors/tsconfig.json"], function (error) {
811+
if (error) {
812+
fail("Compilation unsuccessful.");
813+
}
814+
else {
815+
complete();
816+
}
817+
measure(startCompileTime);
818+
});
819+
}, { async: true });
820+
821+
task("vfs-path", ["vfs-core", "vfs-errors"], function () {
822+
var startCompileTime = mark();
823+
execCompiler(/*useBuiltCompiler*/ false, ["-p", "scripts/vfs-path/tsconfig.json"], function (error) {
824+
if (error) {
825+
fail("Compilation unsuccessful.");
826+
}
827+
else {
828+
complete();
829+
}
830+
measure(startCompileTime);
831+
});
832+
}, { async: true });
833+
834+
task("vfs", ["vfs-path", "vfs-core", "vfs-errors"], function () {
835+
var startCompileTime = mark();
836+
execCompiler(/*useBuiltCompiler*/ false, ["-p", "scripts/vfs/tsconfig.json"], function (error) {
837+
if (error) {
838+
fail("Compilation unsuccessful.");
839+
}
840+
else {
841+
complete();
842+
}
843+
measure(startCompileTime);
844+
});
845+
}, { async: true });
846+
847+
task("private-packages", ["typemock", "vfs"]);
848+
795849
// Task to build the tests infrastructure using the built compiler
796850
var run = path.join(builtLocalDirectory, "run.js");
797851
compileFile(

jenkins.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ npm install
1212

1313
# Node 6 uses an older version of npm that does not symlink a package with a "file:" reference
1414
if [ "$1" = "6" ]; then
15-
npm uninstall typemock --no-save;
16-
npm run build:typemock;
17-
npm install file:scripts/typemock --no-save;
15+
npm uninstall typemock @typescript/vfs-om @typescript/vfs @typescript/vfs-path @typescript/vfs-core @typescript/vfs-errors --no-save;
16+
npm run build:private-packages;
17+
npm install file:scripts/typemock file:scripts/vfs-om file:scripts/vfs file:scripts/vfs-path --no-save;
1818
fi
1919

2020
npm update

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"@types/source-map-support": "^0.4.0",
5252
"@types/through2": "latest",
5353
"@types/xml2js": "^0.4.0",
54+
"@typescript/vfs-path": "file:scripts/vfs-path",
55+
"@typescript/vfs": "file:scripts/vfs",
5456
"browser-resolve": "^1.11.2",
5557
"browserify": "latest",
5658
"chai": "latest",
@@ -91,7 +93,7 @@
9193
"build": "npm run build:compiler && npm run build:tests",
9294
"build:compiler": "jake local",
9395
"build:tests": "jake tests",
94-
"build:typemock": "jake typemock",
96+
"build:private-packages": "jake private-packages",
9597
"start": "node lib/tsc",
9698
"clean": "jake clean",
9799
"gulp": "gulp",

scripts/vfs-core/gulpfile.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const gulp = require("gulp");
2+
const sourcemaps = require("gulp-sourcemaps");
3+
const tsb = require("gulp-tsb");
4+
const del = require("del");
5+
6+
const project = tsb.create("tsconfig.json")
7+
8+
gulp.task("clean", () => del(["dist/**/*"]));
9+
10+
gulp.task("build", () => gulp.src(["src/**/*.ts"])
11+
.pipe(sourcemaps.init())
12+
.pipe(project())
13+
.pipe(sourcemaps.write(".", { sourceRoot: "../src", includeContent: false, destPath: "dist" }))
14+
.pipe(gulp.dest("dist")));
15+
16+
gulp.task("watch", () => gulp.watch(["src/**/*", "tsconfig.json"], ["build"]));
17+
18+
gulp.task("default", ["build"]);

scripts/vfs-core/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"private": true,
3+
"name": "@typescript/vfs-core",
4+
"version": "0.0.0",
5+
"description": "JavaScript Virtual File System core",
6+
"main": "dist/index.js",
7+
"types": "dist/index.d.ts",
8+
"author": "Ron Buckton (ron.buckton@microsoft.com)",
9+
"license": "Apache-2.0",
10+
"devDependencies": {
11+
"@types/node": "^8.0.20",
12+
"@types/source-map-support": "^0.4.0",
13+
"del": "^2.0.2",
14+
"gulp": "^3.9.1",
15+
"gulp-sourcemaps": "^2.6.1",
16+
"gulp-tsb": "^2.0.5",
17+
"source-map-support": "^0.5.0",
18+
"typescript": "^2.6.1"
19+
}
20+
}

0 commit comments

Comments
 (0)