Skip to content

Commit ff99d30

Browse files
committed
removed support for legacy plugin API
this effectively reverts 4d8b1ac and d5f4016
1 parent f32886c commit ff99d30

File tree

4 files changed

+0
-90
lines changed

4 files changed

+0
-90
lines changed

lib/plugins.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ function pluginsByBucket(config, defaults) {
4646
}
4747

4848
let { bucket, plugin } = _plugin;
49-
// special-casing for default plugins' legacy versions
50-
if(_plugin.default && plugin.substr) {
51-
let __plugin = loadExtension(plugin, "ERROR: missing plugin");
52-
if(__plugin.call) { // legacy plugin version
53-
plugin = __plugin;
54-
}
55-
}
56-
5749
buckets[bucket].push({
5850
plugin: plugin.call ? plugin : loadPlugin(plugin).plugin,
5951
config: pluginConfig
@@ -66,10 +58,6 @@ function pluginsByBucket(config, defaults) {
6658
// `{ key, bucket, plugin }` object`, with `key` being the configuration key and
6759
// `plugin` being either a function or a package identifier
6860
function determinePlugins(plugins = [], defaults = DEFAULTS) {
69-
if(!plugins.pop) { // for backwards compatibility
70-
plugins = modernize(plugins);
71-
}
72-
7361
let registry = {};
7462
// NB: default plugins are resolved lazily because eager loading would
7563
// result in them becoming a hard dependency rather than a convenience
@@ -126,17 +114,3 @@ function loadPlugin(pkg) {
126114
} = loadExtension(pkg, "ERROR: missing plugin");
127115
return { key, bucket, plugin };
128116
}
129-
130-
// converts legacy `{ key: { bucket, plugin } }` format
131-
function modernize(plugins) {
132-
return Object.entries(plugins).map(([key, _plugin]) => {
133-
let { bucket, plugin } = _plugin;
134-
if(plugin.substr) {
135-
plugin = loadExtension(plugin, "ERROR: missing plugin");
136-
if(!plugin.call) { // non-legacy plugin
137-
plugin = plugin.plugin;
138-
}
139-
}
140-
return { key, bucket, plugin };
141-
});
142-
}

test/fixtures/node_modules/faucet-pipeline-legacy/index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/test_plugins.js

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -103,64 +103,6 @@ describe("plugin registration", _ => {
103103
markup: []
104104
});
105105
});
106-
107-
it("ensures backwards compatibility", () => {
108-
let defaults = [{
109-
key: "legacy",
110-
bucket: "static",
111-
plugin: path.resolve(CUSTOM_NODE_PATH, "faucet-pipeline-legacy")
112-
}];
113-
let res = pluginsByBucket({
114-
legacy: [{ foo: "lorem" }]
115-
}, defaults);
116-
assertDeep(normalizeAll(res), {
117-
static: [{
118-
plugin: "<Function faucetLegacy>",
119-
config: [{ foo: "lorem" }]
120-
}],
121-
scripts: [],
122-
styles: [],
123-
markup: []
124-
});
125-
126-
res = pluginsByBucket({
127-
dummy: [{ foo: "lorem" }],
128-
plugins: {
129-
dummy: {
130-
bucket: "static",
131-
plugin: path.resolve(CUSTOM_NODE_PATH, "faucet-pipeline-dummy")
132-
}
133-
}
134-
});
135-
assertDeep(normalizeAll(res), {
136-
static: [{
137-
plugin: "<Function faucetDummy>",
138-
config: [{ foo: "lorem" }]
139-
}],
140-
scripts: [],
141-
styles: [],
142-
markup: []
143-
});
144-
145-
res = pluginsByBucket({
146-
legacy: [{ bar: "ipsum" }],
147-
plugins: {
148-
legacy: {
149-
bucket: "static",
150-
plugin: path.resolve(CUSTOM_NODE_PATH, "faucet-pipeline-legacy")
151-
}
152-
}
153-
});
154-
assertDeep(normalizeAll(res), {
155-
static: [{
156-
plugin: "<Function faucetLegacy>",
157-
config: [{ bar: "ipsum" }]
158-
}],
159-
scripts: [],
160-
styles: [],
161-
markup: []
162-
});
163-
});
164106
});
165107

166108
describe("plugin resolution", _ => {

test/test_util.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ describe("FileFinder", _ => {
4545
"node_modules/faucet-pipeline-invalid-b/index.js",
4646
"node_modules/faucet-pipeline-invalid-c/index.js",
4747
"node_modules/faucet-pipeline-js/index.js",
48-
"node_modules/faucet-pipeline-legacy/index.js",
4948
"node_modules/faucet-pipeline-sass/index.js",
5049
"node_modules/faucet-pipeline-static/index.js"
5150
]);
@@ -68,7 +67,6 @@ describe("FileFinder", _ => {
6867
"node_modules/faucet-pipeline-invalid-b/index.js",
6968
"node_modules/faucet-pipeline-invalid-c/index.js",
7069
"node_modules/faucet-pipeline-js/index.js",
71-
"node_modules/faucet-pipeline-legacy/index.js",
7270
"node_modules/faucet-pipeline-sass/index.js",
7371
"node_modules/faucet-pipeline-static/index.js"
7472
]);
@@ -90,7 +88,6 @@ describe("FileFinder", _ => {
9088
"node_modules/faucet-pipeline-invalid-b/index.js",
9189
"node_modules/faucet-pipeline-invalid-c/index.js",
9290
"node_modules/faucet-pipeline-js/index.js",
93-
"node_modules/faucet-pipeline-legacy/index.js",
9491
"node_modules/faucet-pipeline-sass/index.js",
9592
"node_modules/faucet-pipeline-static/index.js"
9693
]);

0 commit comments

Comments
 (0)