Skip to content

Commit

Permalink
chore: Remove deprecated assets APIs.
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Deprecated APIs eyeglass.assets.AssetCollection eyeglass.assets.AssetPathEntry were removed.

Use eyeglass.assets.export() and eyeglass.assets.addSource() respectively instead.
  • Loading branch information
chriseppstein committed Mar 28, 2020
1 parent c63656c commit 7b7fd25
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 51 deletions.
2 changes: 2 additions & 0 deletions packages/eyeglass/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
error. Instead pass it to Eyeglass via the `eyeglass.engines.sass` option.
* Reading or writing to `Eyeglass#enableImportOnce` will now throw an error.
Instead access it via the option: `eyeglass.enableImportOnce`.
* `eyeglass.assets.AssetCollection` - Use `eyeglass.assets.export()` instead.
* `eyeglass.assets.AssetPathEntry` - Use `eyeglass.assets.addSource()` instead.
* The following deprecated options will now cause an error:
* `root` - Use `eyeglass.root` instead.
* `httpRoot` - Use `eyeglass.httpRoot` instead.
Expand Down
21 changes: 0 additions & 21 deletions packages/eyeglass/src/assets/Assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as sass from "node-sass";
import { URI } from "../util/URI";

import AssetsCollection from "./AssetsCollection";
import AssetsSource from "./AssetsSource";
import { isPresent } from "../util/typescriptUtils";
import errorFor from "../util/errorFor";

Expand Down Expand Up @@ -49,8 +48,6 @@ export default class Assets implements Resolves, Installs {
* Assets declared by eyeglass modules.
*/
moduleCollections: Array<AssetsCollection>;
AssetCollection: () => AssetsCollection;
AssetPathEntry: (src: string, options: AssetSourceOptions) => AssetsSource;
sassImpl: typeof sass;
constructor(eyeglass: IEyeglass, sassImpl: SassImplementation) {
this.sassImpl = sassImpl;
Expand All @@ -59,24 +56,6 @@ export default class Assets implements Resolves, Installs {
this.collection = new AssetsCollection(eyeglass.options);
// and keep a list of module collections
this.moduleCollections = [];

// Expose these temporarily for back-compat reasons
function deprecate(method: string): void {
eyeglass.deprecate("0.8.3", "0.9.0", [
"The assets." + method + " interface will be removed from the public API.",
"If you currently use this method, please open an issue at",
"https://github.com/sass-eyeglass/eyeglass/issues/ so we can",
"understand and accommodate your use case"
].join(" "));
}
this.AssetCollection = function () {
deprecate("AssetCollection");
return new AssetsCollection(eyeglass.options);
};
this.AssetPathEntry = function (src: string, options: AssetSourceOptions) {
deprecate("AssetPathEntry");
return new AssetsSource(src, options);
};
}

/**
Expand Down
30 changes: 0 additions & 30 deletions packages/eyeglass/test/test_assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1003,36 +1003,6 @@ describe("assets", function () {
});
});

// @deprecated
describe("deprecated APIs", function() {
["AssetPathEntry", "AssetCollection"].forEach(function(method) {
it("should warn when using deprecated " + method, function(done) {
var rootDir = testutils.fixtureDirectory("app_assets");
var eyeglass = new Eyeglass({
eyeglass: {
root: rootDir,
installWithSymlinks: installWithSymlinks
}
});
var Method = eyeglass.assets[method];
testutils.assertStderr(function(checkStderr) {
var result = new Method(rootDir, {
pattern: "images/**/*"
});
assert(result);
checkStderr([
"[eyeglass:deprecation] (deprecated in 0.8.3, will be removed in 0.9.0)",
"The assets." + method + " interface will be removed from the public API.",
"If you currently use this method, please open an issue at",
"https://github.com/sass-eyeglass/eyeglass/issues/ so we can",
"understand and accommodate your use case\n"
].join(" "));
done();
});
});
});
});

describe("cache keys", function() {
var rootDir = testutils.fixtureDirectory("app_assets");
var rootDir2 = testutils.fixtureDirectory("app_assets_odd_names");
Expand Down

0 comments on commit 7b7fd25

Please sign in to comment.