Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: is opting out of caching #60

Open
JohannKa opened this issue Jan 24, 2023 · 1 comment
Open

Warning: is opting out of caching #60

JohannKa opened this issue Jan 24, 2023 · 1 comment

Comments

@JohannKa
Copy link

Has quoted in ember-basic-dropdown (cibernox/ember-basic-dropdown#690 (comment))
ember-maybe-in-element@^2.0.3 triggers this warning :

[Packaged Application Javascript]broccoli-babel-transpiler is opting out of caching due to a plugin that does not provide a caching strategy: `function embroiderFirstMacrosTransform(env) {
        if (!opts.packageRoot && !env.filename) {
            throw new Error(`bug in @embroider/macros. Running without packageRoot but don't have filename.`);
        }
        let packageCache = shared_internals_1.PackageCache.shared('embroider-stage3', opts.appRoot);
        let scopeStack = [];
        // packageRoot is set when we run inside classic ember-cli. Otherwise we're in
        // Embroider, where we can use absolute filenames.
        const moduleName = opts.packageRoot ? env.meta.moduleName : env.filename;
        return {
            name: '@embroider/macros/first',
            visitor: {
                Program: {
                    enter(node) {
                        if (node.blockParams.length > 0) {
                            scopeStack.push(node.blockParams);
                        }
                    },
                    exit(node) {
                        if (node.blockParams.length > 0) {
                            scopeStack.pop();
                        }
                    },
                },
                SubExpression(node) {
                    if (node.path.type !== 'PathExpression') {
                        return;
                    }
                    if (inScope(scopeStack, node.path.parts[0])) {
                        return;
                    }
                    if (node.path.original === 'macroGetOwnConfig') {
                        return (0, literal_1.default)((0, get_config_1.default)(node, opts.configs, opts.packageRoot, moduleName, true, packageCache), env.syntax.builders);
                    }
                    if (node.path.original === 'macroGetConfig') {
                        return (0, literal_1.default)((0, get_config_1.default)(node, opts.configs, opts.packageRoot, moduleName, false, packageCache), env.syntax.builders);
                    }
                    if (node.path.original === 'macroDependencySatisfies') {
                        return (0, literal_1.default)((0, dependency_satisfies_1.default)(node, opts.packageRoot, moduleName, packageCache), env.syntax.builders);
                    }
                },
                MustacheStatement(node) {
                    if (node.path.type !== 'PathExpression') {
                        return;
                    }
                    if (inScope(scopeStack, node.path.parts[0])) {
                        return;
                    }
                    if (node.path.original === 'macroGetOwnConfig') {
                        return env.syntax.builders.mustache((0, literal_1.default)((0, get_config_1.default)(node, opts.configs, opts.packageRoot, moduleName, true, packageCache), env.syntax.builders));
                    }
                    if (node.path.original === 'macroGetConfig') {
                        return env.syntax.builders.mustache((0, literal_1.default)((0, get_config_1.default)(node, opts.configs, opts.packageRoot, moduleName, false, packageCache), env.syntax.builders));
                    }
                    if (node.path.original === 'macroDependencySatisfies') {
                        return env.syntax.builders.mustache((0, literal_1.default)((0, dependency_satisfies_1.default)(node, opts.packageRoot, moduleName, packageCache), env.syntax.builders));
                    }
                },
            },
        };
    }
@andreyfel
Copy link

It seems that this PR #54 resolves this issue as well. @cibernox @snewcomer can you guys take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants