@movable/rollup-plugin-manifest-merger 2.40.0 → 2.41.0-up-yarn-lock
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/build/src/plugins/manifest-merger.js +3 -3
- package/build/src/plugins/studio-index-builder.js +4 -4
- package/build/src/utils/index-js-builder.js +3 -3
- package/build/test/helpers/expect-ast-equals.js +4 -4
- package/build/test/helpers/setup-fixture.js +2 -2
- package/build/test/index-test.js +12 -12
- package/build/test/plugins/manifest-merger-test.js +24 -24
- package/build/test/utils/index-js-builder-test.js +7 -7
- package/package.json +2 -2
|
@@ -8,8 +8,8 @@ const yamljs_1 = __importDefault(require("yamljs"));
|
|
|
8
8
|
const resolve_1 = __importDefault(require("resolve"));
|
|
9
9
|
const pkg_dir_1 = __importDefault(require("pkg-dir"));
|
|
10
10
|
const fs_1 = require("fs");
|
|
11
|
-
const APP_FILTER = pluginutils_1.createFilter(/app-manifest\.yml$/);
|
|
12
|
-
const PACKAGE_FILTER = pluginutils_1.createFilter(/\.yml$/);
|
|
11
|
+
const APP_FILTER = (0, pluginutils_1.createFilter)(/app-manifest\.yml$/);
|
|
12
|
+
const PACKAGE_FILTER = (0, pluginutils_1.createFilter)(/\.yml$/);
|
|
13
13
|
function manifestMerger(opts) {
|
|
14
14
|
const fileName = opts.output;
|
|
15
15
|
const outputJSON = !!opts.outputJSON;
|
|
@@ -28,7 +28,7 @@ function manifestMerger(opts) {
|
|
|
28
28
|
buildStart() {
|
|
29
29
|
if (opts.appManifest) {
|
|
30
30
|
this.addWatchFile(opts.appManifest);
|
|
31
|
-
appManifest = yamljs_1.default.parse(fs_1.readFileSync(opts.appManifest).toString('utf-8'));
|
|
31
|
+
appManifest = yamljs_1.default.parse((0, fs_1.readFileSync)(opts.appManifest).toString('utf-8'));
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
buildEnd() {
|
|
@@ -8,10 +8,10 @@ const uuid_1 = require("uuid");
|
|
|
8
8
|
const index_js_builder_1 = __importDefault(require("../utils/index-js-builder"));
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
exports.INPUT_FILE = `${uuid_1.v4()}.js`;
|
|
11
|
+
exports.INPUT_FILE = `${(0, uuid_1.v4)()}.js`;
|
|
12
12
|
function packageBuilder(opts) {
|
|
13
|
-
const pkg = JSON.parse(fs_1.readFileSync('./package.json').toString('utf-8'));
|
|
14
|
-
const indexHtmlSource = fs_1.readFileSync(path_1.default.join(__dirname, '../utils/default-package-index.html')).toString('utf-8');
|
|
13
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)('./package.json').toString('utf-8'));
|
|
14
|
+
const indexHtmlSource = (0, fs_1.readFileSync)(path_1.default.join(__dirname, '../utils/default-package-index.html')).toString('utf-8');
|
|
15
15
|
return {
|
|
16
16
|
name: 'Studio Package Builder Rollup Plugin',
|
|
17
17
|
resolveId(id) {
|
|
@@ -22,7 +22,7 @@ function packageBuilder(opts) {
|
|
|
22
22
|
},
|
|
23
23
|
async load(id) {
|
|
24
24
|
if (id === exports.INPUT_FILE) {
|
|
25
|
-
return index_js_builder_1.default(pkg, opts.entry);
|
|
25
|
+
return (0, index_js_builder_1.default)(pkg, opts.entry);
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
},
|
|
@@ -100,13 +100,13 @@ function generateImports(pkg, entryPath) {
|
|
|
100
100
|
return [imports, setups];
|
|
101
101
|
}
|
|
102
102
|
function generateApp(pkg, entryPath) {
|
|
103
|
-
const app = recast_1.parse(BASE);
|
|
103
|
+
const app = (0, recast_1.parse)(BASE);
|
|
104
104
|
const [imports, setups] = generateImports(pkg, entryPath);
|
|
105
105
|
const BODY = app.program.body;
|
|
106
106
|
// Add imports after the StudioFrameworkImport
|
|
107
107
|
BODY.splice(1, 0, ...imports);
|
|
108
108
|
// Insert the "setups" into the setup method:
|
|
109
|
-
recast_1.visit(app, {
|
|
109
|
+
(0, recast_1.visit)(app, {
|
|
110
110
|
visitBlockStatement(path) {
|
|
111
111
|
const parentValue = path.parent.parent.value;
|
|
112
112
|
if (parentValue.type === 'MethodDefinition' && parentValue.key.name === 'setup') {
|
|
@@ -116,6 +116,6 @@ function generateApp(pkg, entryPath) {
|
|
|
116
116
|
this.traverse(path);
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
|
-
return recast_1.prettyPrint(app, { tabWidth: 2 }).code;
|
|
119
|
+
return (0, recast_1.prettyPrint)(app, { tabWidth: 2 }).code;
|
|
120
120
|
}
|
|
121
121
|
exports.default = generateApp;
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const chai_1 = require("chai");
|
|
4
4
|
const recast_1 = require("recast");
|
|
5
5
|
function printAst(ast) {
|
|
6
|
-
return recast_1.prettyPrint(ast, { tabWidth: 2 }).code;
|
|
6
|
+
return (0, recast_1.prettyPrint)(ast, { tabWidth: 2 }).code;
|
|
7
7
|
}
|
|
8
8
|
function expectAstEqual(compareFrom, compareTo) {
|
|
9
|
-
const astA = recast_1.parse(compareFrom);
|
|
10
|
-
const astB = recast_1.parse(compareTo);
|
|
11
|
-
chai_1.expect(printAst(astA)).to.eq(printAst(astB));
|
|
9
|
+
const astA = (0, recast_1.parse)(compareFrom);
|
|
10
|
+
const astB = (0, recast_1.parse)(compareTo);
|
|
11
|
+
(0, chai_1.expect)(printAst(astA)).to.eq(printAst(astB));
|
|
12
12
|
}
|
|
13
13
|
exports.default = expectAstEqual;
|
|
@@ -7,11 +7,11 @@ const mocha_1 = require("mocha");
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
function setupFixture(fixtureName) {
|
|
9
9
|
const previousCWD = process.cwd();
|
|
10
|
-
mocha_1.beforeEach(() => {
|
|
10
|
+
(0, mocha_1.beforeEach)(() => {
|
|
11
11
|
const fixturePath = path_1.default.join(__dirname, '../fixtures', fixtureName);
|
|
12
12
|
process.chdir(fixturePath);
|
|
13
13
|
});
|
|
14
|
-
mocha_1.afterEach(() => {
|
|
14
|
+
(0, mocha_1.afterEach)(() => {
|
|
15
15
|
process.chdir(previousCWD);
|
|
16
16
|
});
|
|
17
17
|
}
|
package/build/test/index-test.js
CHANGED
|
@@ -10,15 +10,15 @@ const plugin_node_resolve_1 = __importDefault(require("@rollup/plugin-node-resol
|
|
|
10
10
|
const yamljs_1 = __importDefault(require("yamljs"));
|
|
11
11
|
const index_1 = require("../src/index");
|
|
12
12
|
const setup_fixture_1 = __importDefault(require("./helpers/setup-fixture"));
|
|
13
|
-
mocha_1.describe('test', () => {
|
|
14
|
-
setup_fixture_1.default('test-package');
|
|
15
|
-
mocha_1.it('can bundle based on an index', async () => {
|
|
16
|
-
const bundle = await rollup_1.rollup({
|
|
13
|
+
(0, mocha_1.describe)('test', () => {
|
|
14
|
+
(0, setup_fixture_1.default)('test-package');
|
|
15
|
+
(0, mocha_1.it)('can bundle based on an index', async () => {
|
|
16
|
+
const bundle = await (0, rollup_1.rollup)({
|
|
17
17
|
input: index_1.inputFile,
|
|
18
18
|
plugins: [
|
|
19
|
-
index_1.packageBuilder({ entry: 'src/index.js' }),
|
|
20
|
-
index_1.manifestMerger({ output: 'manifest.yml', appManifest: 'test-app-manifest.yml' }),
|
|
21
|
-
plugin_node_resolve_1.default()
|
|
19
|
+
(0, index_1.packageBuilder)({ entry: 'src/index.js' }),
|
|
20
|
+
(0, index_1.manifestMerger)({ output: 'manifest.yml', appManifest: 'test-app-manifest.yml' }),
|
|
21
|
+
(0, plugin_node_resolve_1.default)()
|
|
22
22
|
]
|
|
23
23
|
});
|
|
24
24
|
const { output } = await bundle.generate({
|
|
@@ -28,16 +28,16 @@ mocha_1.describe('test', () => {
|
|
|
28
28
|
const yaml = output.find(({ fileName }) => fileName === 'manifest.yml');
|
|
29
29
|
const html = output.find(({ fileName }) => fileName === 'index.html');
|
|
30
30
|
// @ts-ignore
|
|
31
|
-
chai_1.expect(javascript.code).to.contain('test-package');
|
|
31
|
+
(0, chai_1.expect)(javascript.code).to.contain('test-package');
|
|
32
32
|
// @ts-ignore
|
|
33
|
-
chai_1.expect(javascript.code).to.contain('src/random-file');
|
|
33
|
+
(0, chai_1.expect)(javascript.code).to.contain('src/random-file');
|
|
34
34
|
// @ts-ignore
|
|
35
|
-
chai_1.expect(javascript.code).to.contain('@movable/studio-framework');
|
|
35
|
+
(0, chai_1.expect)(javascript.code).to.contain('@movable/studio-framework');
|
|
36
36
|
// @ts-ignore
|
|
37
|
-
chai_1.expect(html.source).to.contain(`<div style="display: none;" class="mi-attributes">[]</div>`);
|
|
37
|
+
(0, chai_1.expect)(html.source).to.contain(`<div style="display: none;" class="mi-attributes">[]</div>`);
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
const manifest = yamljs_1.default.parse(yaml.source);
|
|
40
|
-
chai_1.expect(manifest).to.deep.eq({
|
|
40
|
+
(0, chai_1.expect)(manifest).to.deep.eq({
|
|
41
41
|
name: 'Test App Manifest',
|
|
42
42
|
authors: ['Foo'],
|
|
43
43
|
height: 400,
|
|
@@ -30,15 +30,15 @@ const expectedAppManifest = {
|
|
|
30
30
|
};
|
|
31
31
|
const bundledManifest = async ({ outputJSON = true, ignoreFrameworkVersionUpdate = false } = {}) => {
|
|
32
32
|
const outputFile = outputJSON ? 'manifest.json' : 'manifest.yml';
|
|
33
|
-
const bundle = await rollup_1.rollup({
|
|
33
|
+
const bundle = await (0, rollup_1.rollup)({
|
|
34
34
|
input: 'index.js',
|
|
35
35
|
plugins: [
|
|
36
|
-
index_1.manifestMerger({
|
|
36
|
+
(0, index_1.manifestMerger)({
|
|
37
37
|
outputJSON,
|
|
38
38
|
output: outputFile,
|
|
39
39
|
ignoreFrameworkVersionUpdate
|
|
40
40
|
}),
|
|
41
|
-
plugin_node_resolve_1.default()
|
|
41
|
+
(0, plugin_node_resolve_1.default)()
|
|
42
42
|
]
|
|
43
43
|
});
|
|
44
44
|
const { output } = await bundle.generate({
|
|
@@ -48,49 +48,49 @@ const bundledManifest = async ({ outputJSON = true, ignoreFrameworkVersionUpdate
|
|
|
48
48
|
// @ts-ignore
|
|
49
49
|
return outputJSON ? JSON.parse(file.source) : yamljs_1.default.parse(file.source);
|
|
50
50
|
};
|
|
51
|
-
mocha_1.describe('manifestMerger - app test', async () => {
|
|
52
|
-
setup_fixture_1.default('test-app-no-integration-ids');
|
|
53
|
-
mocha_1.it('can build the manifest via dependencies with yml output', async () => {
|
|
51
|
+
(0, mocha_1.describe)('manifestMerger - app test', async () => {
|
|
52
|
+
(0, setup_fixture_1.default)('test-app-no-integration-ids');
|
|
53
|
+
(0, mocha_1.it)('can build the manifest via dependencies with yml output', async () => {
|
|
54
54
|
const manifest = await bundledManifest({ outputJSON: false });
|
|
55
|
-
chai_1.expect(manifest).to.deep.equal(expectedAppManifest);
|
|
55
|
+
(0, chai_1.expect)(manifest).to.deep.equal(expectedAppManifest);
|
|
56
56
|
});
|
|
57
|
-
mocha_1.it('can optionally ignore the actual Studio Framework version', async () => {
|
|
57
|
+
(0, mocha_1.it)('can optionally ignore the actual Studio Framework version', async () => {
|
|
58
58
|
const manifest = await bundledManifest({
|
|
59
59
|
outputJSON: false,
|
|
60
60
|
ignoreFrameworkVersionUpdate: true
|
|
61
61
|
});
|
|
62
|
-
chai_1.expect(manifest).to.deep.equal({
|
|
62
|
+
(0, chai_1.expect)(manifest).to.deep.equal({
|
|
63
63
|
...expectedAppManifest,
|
|
64
64
|
studio_options: { framework_version: '2.15' }
|
|
65
65
|
});
|
|
66
|
-
mocha_1.it('can build the manifest via dependencies with json output', async () => {
|
|
66
|
+
(0, mocha_1.it)('can build the manifest via dependencies with json output', async () => {
|
|
67
67
|
const manifest = await bundledManifest();
|
|
68
|
-
chai_1.expect(manifest).to.deep.equal(expectedAppManifest);
|
|
68
|
+
(0, chai_1.expect)(manifest).to.deep.equal(expectedAppManifest);
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
|
-
mocha_1.it('can build the manifest via dependencies', async () => {
|
|
71
|
+
(0, mocha_1.it)('can build the manifest via dependencies', async () => {
|
|
72
72
|
const manifest = await bundledManifest();
|
|
73
|
-
chai_1.expect(manifest).to.deep.equal(expectedAppManifest);
|
|
73
|
+
(0, chai_1.expect)(manifest).to.deep.equal(expectedAppManifest);
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
-
mocha_1.describe('manifest merger - integration ids', () => {
|
|
77
|
-
mocha_1.describe('app with existing ids / dependencies with ids', () => {
|
|
78
|
-
setup_fixture_1.default('test-app-with-app-and-package-integration-ids');
|
|
79
|
-
mocha_1.it('it can build multiple integration ids from multiple packages', async () => {
|
|
76
|
+
(0, mocha_1.describe)('manifest merger - integration ids', () => {
|
|
77
|
+
(0, mocha_1.describe)('app with existing ids / dependencies with ids', () => {
|
|
78
|
+
(0, setup_fixture_1.default)('test-app-with-app-and-package-integration-ids');
|
|
79
|
+
(0, mocha_1.it)('it can build multiple integration ids from multiple packages', async () => {
|
|
80
80
|
const manifest = await bundledManifest();
|
|
81
|
-
chai_1.expect(manifest.integration_ids).to.have.members(['app-123', '123', 'abc', 'foo', 'bar']);
|
|
81
|
+
(0, chai_1.expect)(manifest.integration_ids).to.have.members(['app-123', '123', 'abc', 'foo', 'bar']);
|
|
82
82
|
});
|
|
83
|
-
mocha_1.it('it does not duplicate appManifest.integration_ids upon regeneration', async () => {
|
|
83
|
+
(0, mocha_1.it)('it does not duplicate appManifest.integration_ids upon regeneration', async () => {
|
|
84
84
|
await bundledManifest();
|
|
85
85
|
const manifest = await bundledManifest();
|
|
86
|
-
chai_1.expect(manifest.integration_ids).to.have.members(['app-123', '123', 'abc', 'foo', 'bar']);
|
|
86
|
+
(0, chai_1.expect)(manifest.integration_ids).to.have.members(['app-123', '123', 'abc', 'foo', 'bar']);
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
|
-
mocha_1.describe('app with existing ids / dependencies with no ids', () => {
|
|
90
|
-
setup_fixture_1.default('test-app-with-app-integration-ids');
|
|
91
|
-
mocha_1.it('it can build integration ids with no package integration ids', async () => {
|
|
89
|
+
(0, mocha_1.describe)('app with existing ids / dependencies with no ids', () => {
|
|
90
|
+
(0, setup_fixture_1.default)('test-app-with-app-integration-ids');
|
|
91
|
+
(0, mocha_1.it)('it can build integration ids with no package integration ids', async () => {
|
|
92
92
|
const manifest = await bundledManifest();
|
|
93
|
-
chai_1.expect(manifest.integration_ids).to.have.members(['app-123']);
|
|
93
|
+
(0, chai_1.expect)(manifest.integration_ids).to.have.members(['app-123']);
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
});
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const mocha_1 = require("mocha");
|
|
7
7
|
const index_js_builder_1 = __importDefault(require("../../src/utils/index-js-builder"));
|
|
8
8
|
const expect_ast_equals_1 = __importDefault(require("../helpers/expect-ast-equals"));
|
|
9
|
-
mocha_1.describe('app template builder', () => {
|
|
10
|
-
mocha_1.it('imports package when `studio-package` present', () => {
|
|
11
|
-
const app = index_js_builder_1.default({
|
|
9
|
+
(0, mocha_1.describe)('app template builder', () => {
|
|
10
|
+
(0, mocha_1.it)('imports package when `studio-package` present', () => {
|
|
11
|
+
const app = (0, index_js_builder_1.default)({
|
|
12
12
|
name: 'my-package',
|
|
13
13
|
version: '1.3.4',
|
|
14
14
|
main: 'src/index.js'
|
|
15
15
|
}, 'src/index.js');
|
|
16
|
-
expect_ast_equals_1.default(app, `
|
|
16
|
+
(0, expect_ast_equals_1.default)(app, `
|
|
17
17
|
import StudioFramework from '@movable/studio-framework';
|
|
18
18
|
import _my_package from './src/index';
|
|
19
19
|
|
|
@@ -32,8 +32,8 @@ mocha_1.describe('app template builder', () => {
|
|
|
32
32
|
});
|
|
33
33
|
`);
|
|
34
34
|
});
|
|
35
|
-
mocha_1.it('imports manifest when manifest key in `studio-package` present', () => {
|
|
36
|
-
const app = index_js_builder_1.default({
|
|
35
|
+
(0, mocha_1.it)('imports manifest when manifest key in `studio-package` present', () => {
|
|
36
|
+
const app = (0, index_js_builder_1.default)({
|
|
37
37
|
name: 'my-package',
|
|
38
38
|
version: '1.3.4',
|
|
39
39
|
main: 'src/index.js',
|
|
@@ -41,7 +41,7 @@ mocha_1.describe('app template builder', () => {
|
|
|
41
41
|
manifest: 'package-manifest.yml'
|
|
42
42
|
}
|
|
43
43
|
}, 'src/index.js');
|
|
44
|
-
expect_ast_equals_1.default(app, `
|
|
44
|
+
(0, expect_ast_equals_1.default)(app, `
|
|
45
45
|
import StudioFramework from '@movable/studio-framework';
|
|
46
46
|
import _my_package from './src/index';
|
|
47
47
|
import './package-manifest.yml';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movable/rollup-plugin-manifest-merger",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.41.0-up-yarn-lock",
|
|
4
4
|
"description": "Merges package manifests into an App manifest",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"keywords": [],
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"volta": {
|
|
48
48
|
"extends": "../../package.json"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "54f3961fffa4b13b7ea9d5da094b4b4ff3c8a26c"
|
|
51
51
|
}
|