sass-embedded 1.56.2 → 1.58.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/src/compile.js +43 -39
- package/dist/lib/src/compile.js.map +1 -1
- package/dist/lib/src/compiler-path.js +6 -6
- package/dist/lib/src/compiler-path.js.map +1 -1
- package/dist/lib/src/deprotofy-span.js +9 -18
- package/dist/lib/src/deprotofy-span.js.map +1 -1
- package/dist/lib/src/dispatcher.js +48 -48
- package/dist/lib/src/dispatcher.js.map +1 -1
- package/dist/lib/src/exception.js +4 -4
- package/dist/lib/src/exception.js.map +1 -1
- package/dist/lib/src/function-registry.js +24 -25
- package/dist/lib/src/function-registry.js.map +1 -1
- package/dist/lib/src/importer-registry.js +57 -64
- package/dist/lib/src/importer-registry.js.map +1 -1
- package/dist/lib/src/legacy/index.js +1 -1
- package/dist/lib/src/legacy/index.js.map +1 -1
- package/dist/lib/src/message-transformer.js +8 -81
- package/dist/lib/src/message-transformer.js.map +1 -1
- package/dist/lib/src/messages.js +6 -0
- package/dist/lib/src/messages.js.map +1 -0
- package/dist/lib/src/packet-transformer.js.map +1 -1
- package/dist/lib/src/protofier.js +99 -116
- package/dist/lib/src/protofier.js.map +1 -1
- package/dist/lib/src/sync-compiler.js +5 -2
- package/dist/lib/src/sync-compiler.js.map +1 -1
- package/dist/lib/src/utils.js +1 -1
- package/dist/lib/src/utils.js.map +1 -1
- package/dist/package.json +23 -24
- package/dist/tool/get-embedded-compiler.js +68 -0
- package/dist/tool/get-embedded-compiler.js.map +1 -0
- package/dist/tool/get-embedded-protocol.js +41 -0
- package/dist/tool/get-embedded-protocol.js.map +1 -0
- package/dist/tool/get-js-api.js +33 -0
- package/dist/tool/get-js-api.js.map +1 -0
- package/dist/tool/{prepare-dev-environment.js → init.js} +18 -38
- package/dist/tool/init.js.map +1 -0
- package/dist/tool/prepare-optional-release.js +94 -3
- package/dist/tool/prepare-optional-release.js.map +1 -1
- package/dist/tool/prepare-release.js +4 -4
- package/dist/tool/prepare-release.js.map +1 -1
- package/dist/tool/utils.js +6 -248
- package/dist/tool/utils.js.map +1 -1
- package/package.json +23 -24
- package/CHANGELOG.md +0 -2761
- package/dist/.gitignore +0 -18
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js +0 -9031
- package/dist/lib/src/vendor/embedded-protocol/embedded_sass_pb.js.map +0 -1
- package/dist/tool/prepare-dev-environment.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-embedded-protocol.js","sourceRoot":"","sources":["../../tool/get-embedded-protocol.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,2CAAqC;AACrC,iCAAiC;AAEjC,uCAAuC;AACvC,iCAAiC;AAEjC;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CACvC,OAAe,EACf,OAAwC;IAExC,IAAI,CAAC,OAAO,IAAI,KAAK,IAAI,OAAO,EAAE;QAChC,IAAI,GAAG,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC;QACvB,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAW,CAAC;YAClD,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;SACnD;QAED,KAAK,CAAC,SAAS,CAAC,EAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAC,CAAC,CAAC;KACrE;SAAM,IAAI,CAAC,IAAA,sBAAS,EAAC,OAAO,CAAC,IAAI,EAAE,yBAAyB,CAAC,EAAE;QAC9D,MAAM,KAAK,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAChD,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;KAC3D;IAED,qBAAqB,EAAE,CAAC;AAC1B,CAAC;AAlBD,kDAkBC;AAED,4CAA4C;AAC5C,SAAS,qBAAqB;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9E,OAAO,CAAC,GAAG,CAAC,wBAAwB,OAAO,GAAG,CAAC,CAAC;IAChD,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2022 Google Inc. Use of this source code is governed by an
|
|
3
|
+
// MIT-style license that can be found in the LICENSE file or at
|
|
4
|
+
// https://opensource.org/licenses/MIT.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getJSApi = void 0;
|
|
7
|
+
const p = require("path");
|
|
8
|
+
const utils = require("./utils");
|
|
9
|
+
/**
|
|
10
|
+
* Checks out JS API type definitions from the Sass language repo.
|
|
11
|
+
*
|
|
12
|
+
* Can check out a Git `ref` or link to the source at `path`. By default, checks
|
|
13
|
+
* out the latest revision from GitHub.
|
|
14
|
+
*/
|
|
15
|
+
async function getJSApi(outPath, options) {
|
|
16
|
+
var _a;
|
|
17
|
+
const repo = 'sass';
|
|
18
|
+
let source;
|
|
19
|
+
if (!options || 'ref' in options) {
|
|
20
|
+
utils.fetchRepo({
|
|
21
|
+
repo,
|
|
22
|
+
outPath: utils.BUILD_PATH,
|
|
23
|
+
ref: (_a = options === null || options === void 0 ? void 0 : options.ref) !== null && _a !== void 0 ? _a : 'main',
|
|
24
|
+
});
|
|
25
|
+
source = p.join(utils.BUILD_PATH, repo);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
source = options.path;
|
|
29
|
+
}
|
|
30
|
+
await utils.link(p.join(source, 'js-api-doc'), p.join(outPath, repo));
|
|
31
|
+
}
|
|
32
|
+
exports.getJSApi = getJSApi;
|
|
33
|
+
//# sourceMappingURL=get-js-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-js-api.js","sourceRoot":"","sources":["../../tool/get-js-api.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,0BAA0B;AAE1B,iCAAiC;AAEjC;;;;;GAKG;AACI,KAAK,UAAU,QAAQ,CAC5B,OAAe,EACf,OAAwC;;IAExC,MAAM,IAAI,GAAG,MAAM,CAAC;IAEpB,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC,OAAO,IAAI,KAAK,IAAI,OAAO,EAAE;QAChC,KAAK,CAAC,SAAS,CAAC;YACd,IAAI;YACJ,OAAO,EAAE,KAAK,CAAC,UAAU;YACzB,GAAG,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,mCAAI,MAAM;SAC5B,CAAC,CAAC;QACH,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;KACzC;SAAM;QACL,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;KACvB;IAED,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AACxE,CAAC;AAnBD,4BAmBC"}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
// https://opensource.org/licenses/MIT.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const yargs_1 = require("yargs");
|
|
7
|
-
const
|
|
7
|
+
const get_embedded_compiler_1 = require("./get-embedded-compiler");
|
|
8
|
+
const get_embedded_protocol_1 = require("./get-embedded-protocol");
|
|
9
|
+
const get_js_api_1 = require("./get-js-api");
|
|
8
10
|
const argv = (0, yargs_1.default)(process.argv.slice(2))
|
|
9
11
|
.option('compiler-path', {
|
|
10
12
|
type: 'string',
|
|
@@ -13,10 +15,6 @@ const argv = (0, yargs_1.default)(process.argv.slice(2))
|
|
|
13
15
|
.option('compiler-ref', {
|
|
14
16
|
type: 'string',
|
|
15
17
|
description: 'Build the Embedded Dart Sass binary from this Git ref.',
|
|
16
|
-
})
|
|
17
|
-
.option('compiler-version', {
|
|
18
|
-
type: 'string',
|
|
19
|
-
description: 'Download this version of the Embedded Dart Sass binary.',
|
|
20
18
|
})
|
|
21
19
|
.option('skip-compiler', {
|
|
22
20
|
type: 'boolean',
|
|
@@ -29,10 +27,6 @@ const argv = (0, yargs_1.default)(process.argv.slice(2))
|
|
|
29
27
|
.option('protocol-ref', {
|
|
30
28
|
type: 'string',
|
|
31
29
|
description: 'Build the Embedded Protocol from this Git ref.',
|
|
32
|
-
})
|
|
33
|
-
.option('protocol-version', {
|
|
34
|
-
type: 'string',
|
|
35
|
-
description: 'Build the Embedded Protocol from this release version.',
|
|
36
30
|
})
|
|
37
31
|
.option('api-path', {
|
|
38
32
|
type: 'string',
|
|
@@ -43,69 +37,55 @@ const argv = (0, yargs_1.default)(process.argv.slice(2))
|
|
|
43
37
|
description: 'Build the JS API definitions from this Git ref.',
|
|
44
38
|
})
|
|
45
39
|
.conflicts({
|
|
46
|
-
'compiler-path': ['compiler-ref', '
|
|
47
|
-
'compiler-ref': ['
|
|
48
|
-
'
|
|
49
|
-
'protocol-path': ['protocol-ref', 'protocol-version'],
|
|
50
|
-
'protocol-ref': 'protocol-version',
|
|
40
|
+
'compiler-path': ['compiler-ref', 'skip-compiler'],
|
|
41
|
+
'compiler-ref': ['skip-compiler'],
|
|
42
|
+
'protocol-path': ['protocol-ref'],
|
|
51
43
|
'api-path': 'api-ref',
|
|
52
44
|
})
|
|
53
45
|
.parseSync();
|
|
54
46
|
(async () => {
|
|
55
47
|
try {
|
|
56
48
|
const outPath = 'lib/src/vendor';
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (argv['protocol-version']) {
|
|
60
|
-
await (0, utils_1.getEmbeddedProtocol)(outPath, {
|
|
61
|
-
version: argv['protocol-version'],
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
else if (argv['protocol-ref']) {
|
|
65
|
-
await (0, utils_1.getEmbeddedProtocol)(outPath, {
|
|
49
|
+
if (argv['protocol-ref']) {
|
|
50
|
+
await (0, get_embedded_protocol_1.getEmbeddedProtocol)(outPath, {
|
|
66
51
|
ref: argv['protocol-ref'],
|
|
67
52
|
});
|
|
68
53
|
}
|
|
69
54
|
else if (argv['protocol-path']) {
|
|
70
|
-
await (0,
|
|
55
|
+
await (0, get_embedded_protocol_1.getEmbeddedProtocol)(outPath, {
|
|
71
56
|
path: argv['protocol-path'],
|
|
72
57
|
});
|
|
73
58
|
}
|
|
74
59
|
else {
|
|
75
|
-
await (0,
|
|
60
|
+
await (0, get_embedded_protocol_1.getEmbeddedProtocol)(outPath);
|
|
76
61
|
}
|
|
77
62
|
if (!argv['skip-compiler']) {
|
|
78
|
-
if (argv['compiler-
|
|
79
|
-
await (0,
|
|
80
|
-
version: argv['compiler-version'],
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
else if (argv['compiler-ref']) {
|
|
84
|
-
await (0, utils_1.getDartSassEmbedded)(outPath, platform, arch, {
|
|
63
|
+
if (argv['compiler-ref']) {
|
|
64
|
+
await (0, get_embedded_compiler_1.getEmbeddedCompiler)(outPath, {
|
|
85
65
|
ref: argv['compiler-ref'],
|
|
86
66
|
});
|
|
87
67
|
}
|
|
88
68
|
else if (argv['compiler-path']) {
|
|
89
|
-
await (0,
|
|
69
|
+
await (0, get_embedded_compiler_1.getEmbeddedCompiler)(outPath, {
|
|
90
70
|
path: argv['compiler-path'],
|
|
91
71
|
});
|
|
92
72
|
}
|
|
93
73
|
else {
|
|
94
|
-
await (0,
|
|
74
|
+
await (0, get_embedded_compiler_1.getEmbeddedCompiler)(outPath);
|
|
95
75
|
}
|
|
96
76
|
}
|
|
97
77
|
if (argv['api-ref']) {
|
|
98
|
-
await (0,
|
|
78
|
+
await (0, get_js_api_1.getJSApi)(outPath, {
|
|
99
79
|
ref: argv['api-ref'],
|
|
100
80
|
});
|
|
101
81
|
}
|
|
102
82
|
else if (argv['api-path']) {
|
|
103
|
-
await (0,
|
|
83
|
+
await (0, get_js_api_1.getJSApi)(outPath, {
|
|
104
84
|
path: argv['api-path'],
|
|
105
85
|
});
|
|
106
86
|
}
|
|
107
87
|
else {
|
|
108
|
-
await (0,
|
|
88
|
+
await (0, get_js_api_1.getJSApi)(outPath);
|
|
109
89
|
}
|
|
110
90
|
}
|
|
111
91
|
catch (error) {
|
|
@@ -113,4 +93,4 @@ const argv = (0, yargs_1.default)(process.argv.slice(2))
|
|
|
113
93
|
process.exitCode = 1;
|
|
114
94
|
}
|
|
115
95
|
})();
|
|
116
|
-
//# sourceMappingURL=
|
|
96
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../tool/init.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AAEvC,iCAA0B;AAE1B,mEAA4D;AAC5D,mEAA4D;AAC5D,6CAAsC;AAEtC,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtC,MAAM,CAAC,eAAe,EAAE;IACvB,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,mEAAmE;CACtE,CAAC;KACD,MAAM,CAAC,cAAc,EAAE;IACtB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,wDAAwD;CACtE,CAAC;KACD,MAAM,CAAC,eAAe,EAAE;IACvB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,kCAAkC;CAChD,CAAC;KACD,MAAM,CAAC,eAAe,EAAE;IAC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gBAChC,MAAM,IAAA,2CAAmB,EAAC,OAAO,EAAE;oBACjC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC;iBAC5B,CAAC,CAAC;aACJ;iBAAM;gBACL,MAAM,IAAA,2CAAmB,EAAC,OAAO,CAAC,CAAC;aACpC;SACF;QAED,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE;YACnB,MAAM,IAAA,qBAAQ,EAAC,OAAO,EAAE;gBACtB,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC;aACrB,CAAC,CAAC;SACJ;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE;YAC3B,MAAM,IAAA,qBAAQ,EAAC,OAAO,EAAE;gBACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC;aACvB,CAAC,CAAC;SACJ;aAAM;YACL,MAAM,IAAA,qBAAQ,EAAC,OAAO,CAAC,CAAC;SACzB;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;KACtB;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeArchToDartArch = exports.nodePlatformToDartPlatform = void 0;
|
|
4
|
+
const extractZip = require("extract-zip");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const p = require("path");
|
|
7
|
+
const tar_1 = require("tar");
|
|
3
8
|
const yargs_1 = require("yargs");
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
9
|
const pkg = require("../package.json");
|
|
10
|
+
const utils = require("./utils");
|
|
6
11
|
const argv = (0, yargs_1.default)(process.argv.slice(2))
|
|
7
12
|
.option('package', {
|
|
8
13
|
type: 'string',
|
|
@@ -11,10 +16,96 @@ const argv = (0, yargs_1.default)(process.argv.slice(2))
|
|
|
11
16
|
choices: Object.keys(pkg.optionalDependencies).map(name => name.split('sass-embedded-')[1]),
|
|
12
17
|
})
|
|
13
18
|
.parseSync();
|
|
19
|
+
// Converts a Node-style platform name as returned by `process.platform` into a
|
|
20
|
+
// name used by Dart Sass. Throws if the operating system is not supported by
|
|
21
|
+
// Dart Sass Embedded.
|
|
22
|
+
function nodePlatformToDartPlatform(platform) {
|
|
23
|
+
switch (platform) {
|
|
24
|
+
case 'linux':
|
|
25
|
+
return 'linux';
|
|
26
|
+
case 'darwin':
|
|
27
|
+
return 'macos';
|
|
28
|
+
case 'win32':
|
|
29
|
+
return 'windows';
|
|
30
|
+
default:
|
|
31
|
+
throw Error(`Platform ${platform} is not supported.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.nodePlatformToDartPlatform = nodePlatformToDartPlatform;
|
|
35
|
+
// Converts a Node-style architecture name as returned by `process.arch` into a
|
|
36
|
+
// name used by Dart Sass. Throws if the architecture is not supported by Dart
|
|
37
|
+
// Sass Embedded.
|
|
38
|
+
function nodeArchToDartArch(arch) {
|
|
39
|
+
switch (arch) {
|
|
40
|
+
case 'ia32':
|
|
41
|
+
return 'ia32';
|
|
42
|
+
case 'x86':
|
|
43
|
+
return 'ia32';
|
|
44
|
+
case 'x64':
|
|
45
|
+
return 'x64';
|
|
46
|
+
case 'arm':
|
|
47
|
+
return 'arm';
|
|
48
|
+
case 'arm64':
|
|
49
|
+
return 'arm64';
|
|
50
|
+
default:
|
|
51
|
+
throw Error(`Architecture ${arch} is not supported.`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.nodeArchToDartArch = nodeArchToDartArch;
|
|
55
|
+
// Get the platform's file extension for archives.
|
|
56
|
+
function getArchiveExtension(platform) {
|
|
57
|
+
return platform === 'windows' ? '.zip' : '.tar.gz';
|
|
58
|
+
}
|
|
59
|
+
// Downloads the release for `repo` located at `assetUrl`, then unzips it into
|
|
60
|
+
// `outPath`.
|
|
61
|
+
async function downloadRelease(options) {
|
|
62
|
+
console.log(`Downloading ${options.repo} release asset.`);
|
|
63
|
+
const response = await fetch(options.assetUrl, {
|
|
64
|
+
redirect: 'follow',
|
|
65
|
+
});
|
|
66
|
+
if (!response.ok) {
|
|
67
|
+
throw Error(`Failed to download ${options.repo} release asset: ${response.statusText}`);
|
|
68
|
+
}
|
|
69
|
+
const releaseAsset = Buffer.from(await response.arrayBuffer());
|
|
70
|
+
console.log(`Unzipping ${options.repo} release asset to ${options.outPath}.`);
|
|
71
|
+
await utils.cleanDir(p.join(options.outPath, options.repo));
|
|
72
|
+
const archiveExtension = options.assetUrl.endsWith('.zip')
|
|
73
|
+
? '.zip'
|
|
74
|
+
: '.tar.gz';
|
|
75
|
+
const zippedAssetPath = options.outPath + '/' + options.repo + archiveExtension;
|
|
76
|
+
await fs_1.promises.writeFile(zippedAssetPath, releaseAsset);
|
|
77
|
+
if (archiveExtension === '.zip') {
|
|
78
|
+
await extractZip(zippedAssetPath, {
|
|
79
|
+
dir: p.join(process.cwd(), options.outPath),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
(0, tar_1.extract)({
|
|
84
|
+
file: zippedAssetPath,
|
|
85
|
+
cwd: options.outPath,
|
|
86
|
+
sync: true,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
await fs_1.promises.unlink(zippedAssetPath);
|
|
90
|
+
}
|
|
14
91
|
(async () => {
|
|
15
92
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
93
|
+
const version = pkg['compiler-version'];
|
|
94
|
+
if (version.endsWith('-dev')) {
|
|
95
|
+
throw Error("Can't release optional packages for a -dev compiler version.");
|
|
96
|
+
}
|
|
97
|
+
const [nodePlatform, nodeArch] = argv.package.split('-');
|
|
98
|
+
const dartPlatform = nodePlatformToDartPlatform(nodePlatform);
|
|
99
|
+
const dartArch = nodeArchToDartArch(nodeArch);
|
|
100
|
+
const outPath = p.join('npm', argv.package);
|
|
101
|
+
await downloadRelease({
|
|
102
|
+
repo: 'dart-sass-embedded',
|
|
103
|
+
assetUrl: 'https://github.com/sass/dart-sass-embedded/releases/download/' +
|
|
104
|
+
`${version}/sass_embedded-${version}-` +
|
|
105
|
+
`${dartPlatform}-${dartArch}${getArchiveExtension(dartPlatform)}`,
|
|
106
|
+
outPath,
|
|
107
|
+
});
|
|
108
|
+
await fs_1.promises.rename(p.join(outPath, 'sass_embedded'), p.join(outPath, 'dart-sass-embedded'));
|
|
18
109
|
}
|
|
19
110
|
catch (error) {
|
|
20
111
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-optional-release.js","sourceRoot":"","sources":["../../tool/prepare-optional-release.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prepare-optional-release.js","sourceRoot":"","sources":["../../tool/prepare-optional-release.ts"],"names":[],"mappings":";;;AAAA,0CAA2C;AAC3C,2BAAkC;AAClC,0BAA0B;AAC1B,6BAA0C;AAC1C,iCAA0B;AAE1B,uCAAuC;AACvC,iCAAiC;AAKjC,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtC,MAAM,CAAC,SAAS,EAAE;IACjB,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,2EAA2E;IAC7E,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAChD,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CACxC;CACF,CAAC;KACD,SAAS,EAAE,CAAC;AAEf,+EAA+E;AAC/E,6EAA6E;AAC7E,sBAAsB;AACtB,SAAgB,0BAA0B,CAAC,QAAgB;IACzD,QAAQ,QAAQ,EAAE;QAChB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,OAAO,CAA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AG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,eAAe,CAAC;YACpB,IAAI,EAAE,oBAAoB;YAC1B,QAAQ,EACN,+DAA+D;gBAC/D,GAAG,OAAO,kBAAkB,OAAO,GAAG;gBACtC,GAAG,YAAY,IAAI,QAAQ,GAAG,mBAAmB,CAAC,YAAY,CAAC,EAAE;YACnE,OAAO;SACR,CAAC,CAAC;QACH,MAAM,aAAE,CAAC,MAAM,CACb,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,EAChC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAoB,CAAC,CACtC,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;KACtB;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const shell = require("shelljs");
|
|
8
8
|
const pkg = require("../package.json");
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const get_embedded_protocol_1 = require("./get-embedded-protocol");
|
|
10
|
+
const get_js_api_1 = require("./get-js-api");
|
|
11
11
|
(async () => {
|
|
12
12
|
try {
|
|
13
13
|
await sanityCheckBeforeRelease();
|
|
14
|
-
await (0,
|
|
15
|
-
await (0,
|
|
14
|
+
await (0, get_embedded_protocol_1.getEmbeddedProtocol)('lib/src/vendor');
|
|
15
|
+
await (0, get_js_api_1.getJSApi)('lib/src/vendor');
|
|
16
16
|
console.log('Transpiling TS into dist.');
|
|
17
17
|
shell.exec('tsc');
|
|
18
18
|
console.log('Copying JS API types to dist.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-release.js","sourceRoot":"","sources":["../../tool/prepare-release.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AAEvC,2BAAkC;AAClC,iCAAiC;AAEjC,uCAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"prepare-release.js","sourceRoot":"","sources":["../../tool/prepare-release.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AAEvC,2BAAkC;AAClC,iCAAiC;AAEjC,uCAAuC;AACvC,mEAA4D;AAC5D,6CAAsC;AAEtC,CAAC,KAAK,IAAI,EAAE;IACV,IAAI;QACF,MAAM,wBAAwB,EAAE,CAAC;QAEjC,MAAM,IAAA,2CAAmB,EAAC,gBAAgB,CAAC,CAAC;QAE5C,MAAM,IAAA,qBAAQ,EAAC,gBAAgB,CAAC,CAAC;QAEjC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAElB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,EAAE,YAAY,CAAC,CAAC;QACpD,MAAM,aAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;QAExC,2EAA2E;QAC3E,oCAAoC;QACpC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAC3C,MAAM,aAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;QAEnD,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;KAC7C;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;KACtB;AACH,CAAC,CAAC,EAAE,CAAC;AAEL,8EAA8E;AAC9E,yBAAyB;AACzB,KAAK,UAAU,wBAAwB;IACrC,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IACvD,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC;IAEnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACtC,IAAI,GAAG,KAAK,aAAa,cAAc,EAAE,EAAE;QACzC,MAAM,KAAK,CACT,cAAc,GAAG,+CAA+C,cAAc,GAAG,CAClF,CAAC;KACH;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE;QACrE,IAAI,OAAO,KAAK,cAAc,EAAE;YAC9B,MAAM,KAAK,CACT,uBAAuB,GAAG,4BAA4B,cAAc,GAAG,CACxE,CAAC;SACH;KACF;IAED,IAAI,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;QACtC,MAAM,KAAK,CAAC,GAAG,cAAc,oBAAoB,CAAC,CAAC;KACpD;IAED,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,OAAO,cAAc,GAAG,EAAE,GAAG,CAAC,CAAC;IAChE,MAAM,SAAS,GAAG,MAAM,aAAE,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAC5D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;QACnC,MAAM,KAAK,CAAC,kCAAkC,cAAc,GAAG,CAAC,CAAC;KAClE;AACH,CAAC"}
|
package/dist/tool/utils.js
CHANGED
|
@@ -3,218 +3,13 @@
|
|
|
3
3
|
// MIT-style license that can be found in the LICENSE file or at
|
|
4
4
|
// https://opensource.org/licenses/MIT.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const extractZip = require("extract-zip");
|
|
6
|
+
exports.cleanDir = exports.link = exports.fetchRepo = exports.BUILD_PATH = void 0;
|
|
8
7
|
const fs_1 = require("fs");
|
|
9
|
-
const node_fetch_1 = require("node-fetch");
|
|
10
8
|
const p = require("path");
|
|
11
|
-
const yaml = require("yaml");
|
|
12
9
|
const shell = require("shelljs");
|
|
13
|
-
const tar_1 = require("tar");
|
|
14
|
-
const pkg = require("../package.json");
|
|
15
10
|
shell.config.fatal = true;
|
|
16
11
|
// Directory that holds source files.
|
|
17
|
-
|
|
18
|
-
// Converts a Node-style platform name as returned by `process.platform` into a
|
|
19
|
-
// name used by Dart Sass. Throws if the operating system is not supported by
|
|
20
|
-
// Dart Sass Embedded.
|
|
21
|
-
function nodePlatformToDartPlatform(platform) {
|
|
22
|
-
switch (platform) {
|
|
23
|
-
case 'linux':
|
|
24
|
-
return 'linux';
|
|
25
|
-
case 'darwin':
|
|
26
|
-
return 'macos';
|
|
27
|
-
case 'win32':
|
|
28
|
-
return 'windows';
|
|
29
|
-
default:
|
|
30
|
-
throw Error(`Platform ${platform} is not supported.`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.nodePlatformToDartPlatform = nodePlatformToDartPlatform;
|
|
34
|
-
// Converts a Node-style architecture name as returned by `process.arch` into a
|
|
35
|
-
// name used by Dart Sass. Throws if the architecture is not supported by Dart
|
|
36
|
-
// Sass Embedded.
|
|
37
|
-
function nodeArchToDartArch(arch) {
|
|
38
|
-
switch (arch) {
|
|
39
|
-
case 'ia32':
|
|
40
|
-
return 'ia32';
|
|
41
|
-
case 'x86':
|
|
42
|
-
return 'ia32';
|
|
43
|
-
case 'x64':
|
|
44
|
-
return 'x64';
|
|
45
|
-
case 'arm':
|
|
46
|
-
return 'arm';
|
|
47
|
-
case 'arm64':
|
|
48
|
-
return 'arm64';
|
|
49
|
-
default:
|
|
50
|
-
throw Error(`Architecture ${arch} is not supported.`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.nodeArchToDartArch = nodeArchToDartArch;
|
|
54
|
-
// Get the platform's file extension for archives.
|
|
55
|
-
function getArchiveExtension(platform) {
|
|
56
|
-
return platform === 'windows' ? '.zip' : '.tar.gz';
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Gets the Embedded Protocol.
|
|
60
|
-
*
|
|
61
|
-
* Can download the release `version`, check out and build the source from a Git
|
|
62
|
-
* `ref`, or build from the source at `path`.
|
|
63
|
-
*
|
|
64
|
-
* By default, downloads the release version specified in package.json. Throws
|
|
65
|
-
* if an error occurs.
|
|
66
|
-
*/
|
|
67
|
-
async function getEmbeddedProtocol(outPath, options) {
|
|
68
|
-
const repo = 'embedded-protocol';
|
|
69
|
-
options !== null && options !== void 0 ? options : (options = defaultVersionOption('protocol-version'));
|
|
70
|
-
if ('version' in options) {
|
|
71
|
-
const version = options === null || options === void 0 ? void 0 : options.version;
|
|
72
|
-
await downloadRelease({
|
|
73
|
-
repo,
|
|
74
|
-
assetUrl: `https://github.com/sass/${repo}/archive/${version}.tar.gz`,
|
|
75
|
-
outPath: BUILD_PATH,
|
|
76
|
-
});
|
|
77
|
-
await fs_1.promises.rename(p.join(BUILD_PATH, `${repo}-${version}`), p.join(BUILD_PATH, repo));
|
|
78
|
-
}
|
|
79
|
-
else if ('ref' in options) {
|
|
80
|
-
fetchRepo({
|
|
81
|
-
repo,
|
|
82
|
-
outPath: BUILD_PATH,
|
|
83
|
-
ref: options.ref,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
const source = options && 'path' in options ? options.path : p.join(BUILD_PATH, repo);
|
|
87
|
-
buildEmbeddedProtocol(source);
|
|
88
|
-
await link('build/embedded-protocol', p.join(outPath, repo));
|
|
89
|
-
}
|
|
90
|
-
exports.getEmbeddedProtocol = getEmbeddedProtocol;
|
|
91
|
-
/**
|
|
92
|
-
* Gets the Dart Sass wrapper for the Embedded Compiler.
|
|
93
|
-
*
|
|
94
|
-
* Can download the release `version`, check out and build the source from a Git
|
|
95
|
-
* `ref`, or build from the source at `path`.
|
|
96
|
-
*
|
|
97
|
-
* By default, downloads the release version specified in package.json. Throws
|
|
98
|
-
* if an error occurs.
|
|
99
|
-
*/
|
|
100
|
-
async function getDartSassEmbedded(outPath, platform, arch, options) {
|
|
101
|
-
const repo = 'dart-sass-embedded';
|
|
102
|
-
options !== null && options !== void 0 ? options : (options = defaultVersionOption('compiler-version'));
|
|
103
|
-
await checkForMusl();
|
|
104
|
-
if ('version' in options) {
|
|
105
|
-
const version = options === null || options === void 0 ? void 0 : options.version;
|
|
106
|
-
await downloadRelease({
|
|
107
|
-
repo,
|
|
108
|
-
assetUrl: `https://github.com/sass/${repo}/releases/download/` +
|
|
109
|
-
`${version}/sass_embedded-${version}-` +
|
|
110
|
-
`${platform}-${arch}${getArchiveExtension(platform)}`,
|
|
111
|
-
outPath,
|
|
112
|
-
});
|
|
113
|
-
await fs_1.promises.rename(p.join(outPath, 'sass_embedded'), p.join(outPath, repo));
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if ('ref' in options) {
|
|
117
|
-
fetchRepo({
|
|
118
|
-
repo,
|
|
119
|
-
outPath: BUILD_PATH,
|
|
120
|
-
ref: options.ref,
|
|
121
|
-
});
|
|
122
|
-
await maybeOverrideSassDependency(repo);
|
|
123
|
-
}
|
|
124
|
-
const source = 'path' in options ? options.path : p.join(BUILD_PATH, repo);
|
|
125
|
-
buildDartSassEmbedded(source);
|
|
126
|
-
await link(p.join(source, 'build'), p.join(outPath, repo));
|
|
127
|
-
}
|
|
128
|
-
exports.getDartSassEmbedded = getDartSassEmbedded;
|
|
129
|
-
/**
|
|
130
|
-
* Overrides the dart-sass dependency to latest git commit on main when the
|
|
131
|
-
* pubspec file declares it as a "-dev" dependency.
|
|
132
|
-
*/
|
|
133
|
-
async function maybeOverrideSassDependency(repo) {
|
|
134
|
-
var _a;
|
|
135
|
-
const pubspecPath = p.join(BUILD_PATH, repo, 'pubspec.yaml');
|
|
136
|
-
const pubspecRaw = await fs_1.promises.readFile(pubspecPath, { encoding: 'utf-8' });
|
|
137
|
-
const pubspec = yaml.parse(pubspecRaw);
|
|
138
|
-
const sassVersion = (_a = pubspec === null || pubspec === void 0 ? void 0 : pubspec.dependencies) === null || _a === void 0 ? void 0 : _a.sass;
|
|
139
|
-
if (typeof sassVersion !== 'string')
|
|
140
|
-
return;
|
|
141
|
-
if (!sassVersion.endsWith('-dev'))
|
|
142
|
-
return;
|
|
143
|
-
console.log(`${repo} depends on sass: ${sassVersion}, overriding with latest commit.`);
|
|
144
|
-
pubspec['dependency_overrides'] = {
|
|
145
|
-
...pubspec['dependency_overrides'],
|
|
146
|
-
sass: { git: 'https://github.com/sass/dart-sass.git' },
|
|
147
|
-
};
|
|
148
|
-
await fs_1.promises.writeFile(pubspecPath, yaml.stringify(pubspec), { encoding: 'utf-8' });
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Throws an informative error if we're running in a Linux environment that uses
|
|
152
|
-
* musl.
|
|
153
|
-
*/
|
|
154
|
-
async function checkForMusl() {
|
|
155
|
-
if (process.platform !== 'linux')
|
|
156
|
-
return;
|
|
157
|
-
const executable = await fs_1.promises.readFile(process.execPath);
|
|
158
|
-
if (!executable.includes('libc.musl-'))
|
|
159
|
-
return;
|
|
160
|
-
throw Error("sass-embedded doesn't support Linux distributions that use musl-libc.");
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Checks out JS API type definitions from the Sass language repo.
|
|
164
|
-
*
|
|
165
|
-
* Can check out a Git `ref`, or link to the source at `path`. By default,
|
|
166
|
-
* checks out the latest revision from GitHub.
|
|
167
|
-
*/
|
|
168
|
-
async function getJSApi(outPath, options) {
|
|
169
|
-
var _a;
|
|
170
|
-
const repo = 'sass';
|
|
171
|
-
let source;
|
|
172
|
-
if (!options || 'ref' in options) {
|
|
173
|
-
fetchRepo({
|
|
174
|
-
repo,
|
|
175
|
-
outPath: BUILD_PATH,
|
|
176
|
-
ref: (_a = options === null || options === void 0 ? void 0 : options.ref) !== null && _a !== void 0 ? _a : 'main',
|
|
177
|
-
});
|
|
178
|
-
source = p.join(BUILD_PATH, repo);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
source = options.path;
|
|
182
|
-
}
|
|
183
|
-
await link(p.join(source, 'js-api-doc'), p.join(outPath, repo));
|
|
184
|
-
}
|
|
185
|
-
exports.getJSApi = getJSApi;
|
|
186
|
-
// Downloads the release for `repo` located at `assetUrl`, then unzips it into
|
|
187
|
-
// `outPath`.
|
|
188
|
-
async function downloadRelease(options) {
|
|
189
|
-
console.log(`Downloading ${options.repo} release asset.`);
|
|
190
|
-
const response = await (0, node_fetch_1.default)(options.assetUrl, {
|
|
191
|
-
redirect: 'follow',
|
|
192
|
-
});
|
|
193
|
-
if (!response.ok) {
|
|
194
|
-
throw Error(`Failed to download ${options.repo} release asset: ${response.statusText}`);
|
|
195
|
-
}
|
|
196
|
-
const releaseAsset = await response.buffer();
|
|
197
|
-
console.log(`Unzipping ${options.repo} release asset to ${options.outPath}.`);
|
|
198
|
-
await cleanDir(p.join(options.outPath, options.repo));
|
|
199
|
-
const archiveExtension = options.assetUrl.endsWith('.zip')
|
|
200
|
-
? '.zip'
|
|
201
|
-
: '.tar.gz';
|
|
202
|
-
const zippedAssetPath = options.outPath + '/' + options.repo + archiveExtension;
|
|
203
|
-
await fs_1.promises.writeFile(zippedAssetPath, releaseAsset);
|
|
204
|
-
if (archiveExtension === '.zip') {
|
|
205
|
-
await extractZip(zippedAssetPath, {
|
|
206
|
-
dir: p.join(process.cwd(), options.outPath),
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
(0, tar_1.extract)({
|
|
211
|
-
file: zippedAssetPath,
|
|
212
|
-
cwd: options.outPath,
|
|
213
|
-
sync: true,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
await fs_1.promises.unlink(zippedAssetPath);
|
|
217
|
-
}
|
|
12
|
+
exports.BUILD_PATH = 'build';
|
|
218
13
|
// Clones `repo` into `outPath`, then checks out the given Git `ref`.
|
|
219
14
|
function fetchRepo(options) {
|
|
220
15
|
if (!(0, fs_1.existsSync)(p.join(options.outPath, options.repo))) {
|
|
@@ -231,46 +26,7 @@ function fetchRepo(options) {
|
|
|
231
26
|
cwd: p.join(options.outPath, options.repo),
|
|
232
27
|
});
|
|
233
28
|
}
|
|
234
|
-
|
|
235
|
-
function buildEmbeddedProtocol(repoPath) {
|
|
236
|
-
const proto = p.join(repoPath, 'embedded_sass.proto');
|
|
237
|
-
const protocPath = process.platform === 'win32'
|
|
238
|
-
? '%CD%/node_modules/protoc/protoc/bin/protoc.exe'
|
|
239
|
-
: 'node_modules/protoc/protoc/bin/protoc';
|
|
240
|
-
const version = shell
|
|
241
|
-
.exec(`${protocPath} --version`, { silent: true })
|
|
242
|
-
.stdout.trim();
|
|
243
|
-
console.log(`Building pbjs and TS declaration file from ${proto} with ${version}.`);
|
|
244
|
-
const pluginPath = process.platform === 'win32'
|
|
245
|
-
? '%CD%/node_modules/.bin/protoc-gen-ts.cmd'
|
|
246
|
-
: 'node_modules/.bin/protoc-gen-ts';
|
|
247
|
-
(0, fs_1.mkdirSync)('build/embedded-protocol', { recursive: true });
|
|
248
|
-
shell.exec(`${protocPath} \
|
|
249
|
-
--plugin="protoc-gen-ts=${pluginPath}" \
|
|
250
|
-
--js_out="import_style=commonjs,binary:build/embedded-protocol" \
|
|
251
|
-
--ts_out="build/embedded-protocol" \
|
|
252
|
-
--proto_path="${repoPath}" \
|
|
253
|
-
${proto}`, { silent: true });
|
|
254
|
-
}
|
|
255
|
-
// Builds the Embedded Dart Sass executable from the source at `repoPath`.
|
|
256
|
-
function buildDartSassEmbedded(repoPath) {
|
|
257
|
-
console.log('Downloading dart-sass-embedded dependencies.');
|
|
258
|
-
shell.exec('dart pub upgrade', {
|
|
259
|
-
cwd: repoPath,
|
|
260
|
-
silent: true,
|
|
261
|
-
});
|
|
262
|
-
console.log('Building dart-sass-embedded executable.');
|
|
263
|
-
shell.exec('dart run grinder protobuf pkg-standalone-dev', {
|
|
264
|
-
cwd: repoPath,
|
|
265
|
-
silent: true,
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
// Given the name of a field in `package.json`, returns the default version
|
|
269
|
-
// option described by that field.
|
|
270
|
-
function defaultVersionOption(pkgField) {
|
|
271
|
-
const version = pkg[pkgField];
|
|
272
|
-
return version.endsWith('-dev') ? { ref: 'main' } : { version };
|
|
273
|
-
}
|
|
29
|
+
exports.fetchRepo = fetchRepo;
|
|
274
30
|
// Links or copies the contents of `source` into `destination`.
|
|
275
31
|
async function link(source, destination) {
|
|
276
32
|
await cleanDir(destination);
|
|
@@ -284,14 +40,16 @@ async function link(source, destination) {
|
|
|
284
40
|
await fs_1.promises.symlink(p.resolve(source), destination);
|
|
285
41
|
}
|
|
286
42
|
}
|
|
43
|
+
exports.link = link;
|
|
287
44
|
// Ensures that `dir` does not exist, but its parent directory does.
|
|
288
45
|
async function cleanDir(dir) {
|
|
289
46
|
await fs_1.promises.mkdir(p.dirname(dir), { recursive: true });
|
|
290
47
|
try {
|
|
291
|
-
await fs_1.promises.
|
|
48
|
+
await fs_1.promises.rm(dir, { force: true, recursive: true });
|
|
292
49
|
}
|
|
293
50
|
catch (_) {
|
|
294
51
|
// If dir doesn't exist yet, that's fine.
|
|
295
52
|
}
|
|
296
53
|
}
|
|
54
|
+
exports.cleanDir = cleanDir;
|
|
297
55
|
//# sourceMappingURL=utils.js.map
|
package/dist/tool/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../tool/utils.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../tool/utils.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,2BAA8C;AAC9C,0BAA0B;AAC1B,iCAAiC;AAEjC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,I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