@warp-drive-mirror/build-config 0.0.0 → 0.0.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/LICENSE.md +19 -5
- package/README.md +2 -2
- package/dist/addon-shim.cjs.map +1 -1
- package/dist/babel-macros.js +2 -1
- package/dist/babel-macros.js.map +1 -1
- package/dist/babel-plugin-transform-asserts.cjs.map +1 -1
- package/dist/babel-plugin-transform-deprecations.cjs.map +1 -1
- package/dist/babel-plugin-transform-features.cjs.map +1 -1
- package/dist/babel-plugin-transform-logging.cjs +46 -3
- package/dist/babel-plugin-transform-logging.cjs.map +1 -1
- package/dist/canary-features-BzGSGY5j.js.map +1 -1
- package/dist/cjs-set-config.cjs +46 -1
- package/dist/cjs-set-config.cjs.map +1 -1
- package/dist/{debugging-BzogyWJo.js → debugging-PCb4hczb.js} +34 -3
- package/dist/{debugging-BzogyWJo.js.map → debugging-PCb4hczb.js.map} +1 -1
- package/dist/debugging.js +1 -1
- package/dist/deprecations-ChFQtx-4.js.map +1 -1
- package/dist/env.js.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/macros.js.map +1 -1
- package/logos/NCC-1701-a-gold.svg +4 -0
- package/logos/NCC-1701-a-gold_100.svg +1 -0
- package/logos/NCC-1701-a-gold_base-64.txt +1 -0
- package/logos/README.md +4 -0
- package/logos/docs-badge.svg +2 -0
- package/logos/ember-data-logo-dark.svg +12 -0
- package/logos/ember-data-logo-light.svg +12 -0
- package/logos/github-header.svg +444 -0
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +4 -0
- package/logos/warp-drive-logo-gold.svg +4 -0
- package/package.json +18 -18
- package/unstable-preview-types/-private/utils/get-env.d.ts.map +1 -1
- package/unstable-preview-types/-private/utils/logging.d.ts +14 -0
- package/unstable-preview-types/-private/utils/logging.d.ts.map +1 -0
- package/unstable-preview-types/babel-macros.d.ts +3 -24
- package/unstable-preview-types/babel-macros.d.ts.map +1 -1
- package/unstable-preview-types/debugging.d.ts +27 -0
- package/unstable-preview-types/debugging.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +9 -5
- package/unstable-preview-types/index.d.ts.map +1 -1
- /package/{NCC-1701-a-blue.svg → logos/NCC-1701-a-blue.svg} +0 -0
- /package/{NCC-1701-a.svg → logos/NCC-1701-a.svg} +0 -0
package/LICENSE.md
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (
|
|
3
|
+
Copyright (c) 2017-2025 Ember.js and contributors
|
|
4
|
+
Copyright (c) 2011-2017 Tilde, Inc. and contributors
|
|
5
|
+
Copyright (c) 2011 LivingSocial Inc.
|
|
4
6
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
6
13
|
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
8
16
|
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<img
|
|
3
3
|
class="project-logo"
|
|
4
|
-
src="./NCC-1701-a-blue.svg#gh-light-mode-only"
|
|
4
|
+
src="./logos/NCC-1701-a-blue.svg#gh-light-mode-only"
|
|
5
5
|
alt="WarpDrive"
|
|
6
6
|
width="120px"
|
|
7
7
|
title="WarpDrive" />
|
|
8
8
|
<img
|
|
9
9
|
class="project-logo"
|
|
10
|
-
src="./NCC-1701-a.svg#gh-dark-mode-only"
|
|
10
|
+
src="./logos/NCC-1701-a.svg#gh-dark-mode-only"
|
|
11
11
|
alt="WarpDrive"
|
|
12
12
|
width="120px"
|
|
13
13
|
title="WarpDrive" />
|
package/dist/addon-shim.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon-shim.cjs","sources":["../cjs-src/addon-shim.js"],"sourcesContent":["'use strict';\n\nexport function addonShim(dirName, options) {\n const path = require('path');\n const pkg = require(path.join(dirName, './package.json'));\n\n const isV2Addon = pkg['ember-addon']?.version === 2;\n if (isV2Addon) {\n const { addonV1Shim } = require('@embroider/addon-shim');\n return addonV1Shim(dirName, options);\n }\n\n const Funnel = require('broccoli-funnel');\n return {\n name: pkg.name,\n\n treeForVendor() {},\n treeForPublic() {},\n treeForStyles() {},\n treeForAddonStyles() {},\n treeForApp() {},\n treeForAddon() {\n return this._super.treeForAddon.call(this, new Funnel(path.join(dirName, 'dist')));\n },\n };\n}\n"],"names":["addonShim","dirName","options","path","require","pkg","join","isV2Addon","version","addonV1Shim","Funnel","name","treeForVendor","treeForPublic","treeForStyles","treeForAddonStyles","treeForApp","treeForAddon","_super","call"],"mappings":";;;;AAEO,SAASA,SAASA,CAACC,OAAO,EAAEC,OAAO,EAAE;AAC1C,EAAA,MAAMC,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"addon-shim.cjs","sources":["../cjs-src/addon-shim.js"],"sourcesContent":["'use strict';\n\nexport function addonShim(dirName, options) {\n const path = require('path');\n const pkg = require(path.join(dirName, './package.json'));\n\n const isV2Addon = pkg['ember-addon']?.version === 2;\n if (isV2Addon) {\n const { addonV1Shim } = require('@embroider/addon-shim');\n return addonV1Shim(dirName, options);\n }\n\n const Funnel = require('broccoli-funnel');\n return {\n name: pkg.name,\n\n treeForVendor() {},\n treeForPublic() {},\n treeForStyles() {},\n treeForAddonStyles() {},\n treeForApp() {},\n treeForAddon() {\n return this._super.treeForAddon.call(this, new Funnel(path.join(dirName, 'dist')));\n },\n };\n}\n"],"names":["addonShim","dirName","options","path","require","pkg","join","isV2Addon","version","addonV1Shim","Funnel","name","treeForVendor","treeForPublic","treeForStyles","treeForAddonStyles","treeForApp","treeForAddon","_super","call"],"mappings":";;;;AAEO,SAASA,SAASA,CAACC,OAAO,EAAEC,OAAO,EAAE;AAC1C,EAAA,MAAMC,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,EAAA,MAAMC,GAAG,GAAGD,OAAO,CAACD,IAAI,CAACG,IAAI,CAACL,OAAO,EAAE,gBAAgB,CAAC,CAAC;EAEzD,MAAMM,SAAS,GAAGF,GAAG,CAAC,aAAa,CAAC,EAAEG,OAAO,KAAK,CAAC;AACnD,EAAA,IAAID,SAAS,EAAE;IACb,MAAM;AAAEE,MAAAA;AAAY,KAAC,GAAGL,OAAO,CAAC,uBAAuB,CAAC;AACxD,IAAA,OAAOK,WAAW,CAACR,OAAO,EAAEC,OAAO,CAAC;AACtC;AAEA,EAAA,MAAMQ,MAAM,GAAGN,OAAO,CAAC,iBAAiB,CAAC;EACzC,OAAO;IACLO,IAAI,EAAEN,GAAG,CAACM,IAAI;IAEdC,aAAaA,GAAG,EAAE;IAClBC,aAAaA,GAAG,EAAE;IAClBC,aAAaA,GAAG,EAAE;IAClBC,kBAAkBA,GAAG,EAAE;IACvBC,UAAUA,GAAG,EAAE;AACfC,IAAAA,YAAYA,GAAG;MACb,OAAO,IAAI,CAACC,MAAM,CAACD,YAAY,CAACE,IAAI,CAAC,IAAI,EAAE,IAAIT,MAAM,CAACP,IAAI,CAACG,IAAI,CAACL,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACpF;GACD;AACH;;;;"}
|
package/dist/babel-macros.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LOGGING } from './debugging-
|
|
1
|
+
import { L as LOGGING } from './debugging-PCb4hczb.js';
|
|
2
2
|
import { C as CURRENT_FEATURES } from './canary-features-BzGSGY5j.js';
|
|
3
3
|
import { C as CURRENT_DEPRECATIONS } from './deprecations-ChFQtx-4.js';
|
|
4
4
|
|
|
@@ -29,6 +29,7 @@ function macros() {
|
|
|
29
29
|
}, '@warp-drive-mirror/build-config/deprecation-stripping'], [TransformDebugLogging, {
|
|
30
30
|
source: '@warp-drive-mirror/build-config/debugging',
|
|
31
31
|
configKey: 'debug',
|
|
32
|
+
runtimeKey: 'activeLogging',
|
|
32
33
|
flags: config.debug
|
|
33
34
|
}, '@warp-drive-mirror/build-config/debugging-stripping'], [TransformDebugLogging, {
|
|
34
35
|
source: '@warp-drive-mirror/build-config/env',
|
package/dist/babel-macros.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-macros.js","sources":["../src/babel-macros.ts"],"sourcesContent":["import * as LOGGING from './debugging.ts';\nimport * as CURRENT_FEATURES from './canary-features.ts';\nimport * as CURRENT_DEPRECATIONS from './deprecations.ts';\n\ntype FEATURE = keyof typeof CURRENT_FEATURES;\nconst features = Object.keys(CURRENT_FEATURES) as FEATURE[];\nconst FEATURES = Object.assign({}, CURRENT_FEATURES) as Record<FEATURE, boolean>;\nfeatures.forEach((feature) => {\n let featureValue = FEATURES[feature];\n if (featureValue === null) {\n FEATURES[feature] = false;\n }\n});\n\nconst config = {\n features: FEATURES,\n deprecations: Object.assign({}, CURRENT_DEPRECATIONS),\n debug: Object.assign({}, LOGGING),\n};\n\nexport function macros() {\n const TransformAsserts = import.meta.resolve('./babel-plugin-transform-asserts.cjs').slice(7);\n const TransformDeprecations = import.meta.resolve('./babel-plugin-transform-deprecations.cjs').slice(7);\n const TransformDebugLogging = import.meta.resolve('./babel-plugin-transform-logging.cjs').slice(7);\n const TransformFeatures = import.meta.resolve('./babel-plugin-transform-features.cjs').slice(7);\n\n let plugins = [\n [TransformAsserts, {}, '@warp-drive-mirror/build-config/asserts-stripping'],\n [\n TransformFeatures,\n {\n source: '@warp-drive-mirror/build-config/canary-features',\n flags: config.features,\n },\n '@warp-drive-mirror/build-config/canary-features-stripping',\n ],\n [\n TransformDeprecations,\n {\n source: '@warp-drive-mirror/build-config/deprecations',\n flags: config.deprecations,\n },\n '@warp-drive-mirror/build-config/deprecation-stripping',\n ],\n [\n TransformDebugLogging,\n {\n source: '@warp-drive-mirror/build-config/debugging',\n configKey: 'debug',\n flags: config.debug,\n },\n '@warp-drive-mirror/build-config/debugging-stripping',\n ],\n [\n TransformDebugLogging,\n {\n source: '@warp-drive-mirror/build-config/env',\n configKey: 'env',\n flags: {\n TESTING: true,\n PRODUCTION: true,\n DEBUG: true,\n IS_RECORDING: true,\n IS_CI: true,\n SHOULD_RECORD: true,\n },\n },\n '@warp-drive-mirror/build-config/env',\n ],\n ];\n\n return plugins;\n}\n"],"names":["features","Object","keys","CURRENT_FEATURES","FEATURES","assign","forEach","feature","featureValue","config","deprecations","CURRENT_DEPRECATIONS","debug","LOGGING","macros","TransformAsserts","import","meta","resolve","slice","TransformDeprecations","TransformDebugLogging","TransformFeatures","plugins","source","flags","configKey","TESTING","PRODUCTION","DEBUG","IS_RECORDING","IS_CI","SHOULD_RECORD"],"mappings":";;;;AAKA,MAAMA,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACC,gBAAgB,CAAc
|
|
1
|
+
{"version":3,"file":"babel-macros.js","sources":["../src/babel-macros.ts"],"sourcesContent":["import * as LOGGING from './debugging.ts';\nimport * as CURRENT_FEATURES from './canary-features.ts';\nimport * as CURRENT_DEPRECATIONS from './deprecations.ts';\n\ntype FEATURE = keyof typeof CURRENT_FEATURES;\nconst features = Object.keys(CURRENT_FEATURES) as FEATURE[];\nconst FEATURES = Object.assign({}, CURRENT_FEATURES) as Record<FEATURE, boolean>;\nfeatures.forEach((feature) => {\n let featureValue = FEATURES[feature];\n if (featureValue === null) {\n FEATURES[feature] = false;\n }\n});\n\nconst config = {\n features: FEATURES,\n deprecations: Object.assign({}, CURRENT_DEPRECATIONS),\n debug: Object.assign({}, LOGGING),\n};\n\ntype BabelPlugin = [string, Record<string, unknown>, string];\n\nexport function macros(): BabelPlugin[] {\n const TransformAsserts = import.meta.resolve('./babel-plugin-transform-asserts.cjs').slice(7);\n const TransformDeprecations = import.meta.resolve('./babel-plugin-transform-deprecations.cjs').slice(7);\n const TransformDebugLogging = import.meta.resolve('./babel-plugin-transform-logging.cjs').slice(7);\n const TransformFeatures = import.meta.resolve('./babel-plugin-transform-features.cjs').slice(7);\n\n let plugins = [\n [TransformAsserts, {}, '@warp-drive-mirror/build-config/asserts-stripping'],\n [\n TransformFeatures,\n {\n source: '@warp-drive-mirror/build-config/canary-features',\n flags: config.features,\n },\n '@warp-drive-mirror/build-config/canary-features-stripping',\n ],\n [\n TransformDeprecations,\n {\n source: '@warp-drive-mirror/build-config/deprecations',\n flags: config.deprecations,\n },\n '@warp-drive-mirror/build-config/deprecation-stripping',\n ],\n [\n TransformDebugLogging,\n {\n source: '@warp-drive-mirror/build-config/debugging',\n configKey: 'debug',\n runtimeKey: 'activeLogging',\n flags: config.debug,\n },\n '@warp-drive-mirror/build-config/debugging-stripping',\n ],\n [\n TransformDebugLogging,\n {\n source: '@warp-drive-mirror/build-config/env',\n configKey: 'env',\n flags: {\n TESTING: true,\n PRODUCTION: true,\n DEBUG: true,\n IS_RECORDING: true,\n IS_CI: true,\n SHOULD_RECORD: true,\n },\n },\n '@warp-drive-mirror/build-config/env',\n ],\n ] satisfies BabelPlugin[];\n\n return plugins;\n}\n"],"names":["features","Object","keys","CURRENT_FEATURES","FEATURES","assign","forEach","feature","featureValue","config","deprecations","CURRENT_DEPRECATIONS","debug","LOGGING","macros","TransformAsserts","import","meta","resolve","slice","TransformDeprecations","TransformDebugLogging","TransformFeatures","plugins","source","flags","configKey","runtimeKey","TESTING","PRODUCTION","DEBUG","IS_RECORDING","IS_CI","SHOULD_RECORD"],"mappings":";;;;AAKA,MAAMA,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACC,gBAAgB,CAAc;AAC3D,MAAMC,QAAQ,GAAGH,MAAM,CAACI,MAAM,CAAC,EAAE,EAAEF,gBAAgB,CAA6B;AAChFH,QAAQ,CAACM,OAAO,CAAEC,OAAO,IAAK;AAC5B,EAAA,IAAIC,YAAY,GAAGJ,QAAQ,CAACG,OAAO,CAAC;EACpC,IAAIC,YAAY,KAAK,IAAI,EAAE;AACzBJ,IAAAA,QAAQ,CAACG,OAAO,CAAC,GAAG,KAAK;AAC3B;AACF,CAAC,CAAC;AAEF,MAAME,MAAM,GAAG;AACbT,EAAAA,QAAQ,EAAEI,QAAQ;EAClBM,YAAY,EAAET,MAAM,CAACI,MAAM,CAAC,EAAE,EAAEM,oBAAoB,CAAC;EACrDC,KAAK,EAAEX,MAAM,CAACI,MAAM,CAAC,EAAE,EAAEQ,OAAO;AAClC,CAAC;AAIM,SAASC,MAAMA,GAAkB;AACtC,EAAA,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,IAAI,CAACC,OAAO,CAAC,sCAAsC,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC;AAC7F,EAAA,MAAMC,qBAAqB,GAAGJ,MAAM,CAACC,IAAI,CAACC,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,"file":"babel-plugin-transform-asserts.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-asserts.js"],"sourcesContent":["const { ImportUtil } = require('babel-import-util');\n\nconst Utils = new Set(['assert']);\n\n/*\n// Before\nimport { assert } from '@warp-drive-mirror/build-config/macros';\n\nassert('foo', true);\n\n// After\n(macroCondition(isDevelopingApp()) ? function assert(test) { if (!test) { throw new Error('foo'); } }(true) : {});\n*/\n\n// => _macros.getGlobalConfig().WarpDriveMirror.env.DEBUG\nfunction buildMacroConstDEBUG(types, binding, state) {\n return types.memberExpression(\n types.memberExpression(\n types.memberExpression(\n types.callExpression(state.importer.import(binding, '@embroider/macros', 'getGlobalConfig'), []),\n types.identifier('WarpDriveMirror')\n ),\n types.identifier('env')\n ),\n types.identifier('DEBUG')\n );\n}\n\n// => _macros.macroCondition(_macros.getGlobalConfig().WarpDriveMirror.env.DEBUG)\nfunction buildMacroConditionDEBUG(types, binding, state) {\n return types.callExpression(state.importer.import(binding, '@embroider/macros', 'macroCondition'), [\n buildMacroConstDEBUG(types, binding, state),\n ]);\n}\n\n// (test) => { if (!test) { throw new Error(someMessage); } }(someCond)\nfunction buildAssert(types, originalCallExpression) {\n const desc = originalCallExpression.arguments[0];\n const test = originalCallExpression.arguments[1] ?? types.booleanLiteral(false);\n // prettier-ignore\n return types.callExpression(\n types.arrowFunctionExpression([types.identifier('test')], // (test) =>\n types.blockStatement([ // {\n types.ifStatement( // if\n types.unaryExpression('!', types.identifier('test')), // (!test)\n types.blockStatement([ // {\n types.throwStatement( // throw\n types.newExpression(types.identifier('Error'), [desc]) // new Error(desc)\n )]) // }\n )]) // }\n ),\n [test] // (someCond)\n );\n}\n\n// => ( <debug-macro> ? <assert-exp> : {});\nfunction buildAssertTernary(types, binding, state, originalCallExpression) {\n return types.expressionStatement(\n types.conditionalExpression(\n buildMacroConditionDEBUG(types, binding, state),\n buildAssert(types, originalCallExpression),\n types.objectExpression([])\n )\n );\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === '@warp-drive-mirror/build-config/macros') {\n const specifiers = path.get('specifiers');\n\n specifiers.forEach((specifier) => {\n const name = specifier.node.imported.name;\n if (!Utils.has(name)) {\n throw new Error(`Unexpected import '${name}' imported from '@warp-drive-mirror/build-config/macros'`);\n }\n\n const localBindingName = specifier.node.local.name;\n const binding = specifier.scope.getBinding(localBindingName);\n\n binding.referencePaths.forEach((p) => {\n const originalCallExpression = p.parentPath.node;\n\n if (!t.isCallExpression(originalCallExpression)) {\n throw new Error('Expected a call expression');\n }\n\n const assertTernary = buildAssertTernary(t, binding, state, originalCallExpression);\n p.parentPath.replaceWith(assertTernary);\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["ImportUtil","require","Utils","Set","buildMacroConstDEBUG","types","binding","state","memberExpression","callExpression","importer","import","identifier","buildMacroConditionDEBUG","buildAssert","originalCallExpression","desc","arguments","test","booleanLiteral","arrowFunctionExpression","blockStatement","ifStatement","unaryExpression","throwStatement","newExpression","buildAssertTernary","expressionStatement","conditionalExpression","objectExpression","babel","t","name","visitor","ImportDeclaration","path","importPath","node","source","value","specifiers","get","forEach","specifier","imported","has","Error","localBindingName","local","scope","getBinding","referencePaths","p","parentPath","isCallExpression","assertTernary","replaceWith","removeOwnBinding","remove","length","Program"],"mappings":";;AAAA,MAAM;AAAEA,EAAAA
|
|
1
|
+
{"version":3,"file":"babel-plugin-transform-asserts.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-asserts.js"],"sourcesContent":["const { ImportUtil } = require('babel-import-util');\n\nconst Utils = new Set(['assert']);\n\n/*\n// Before\nimport { assert } from '@warp-drive-mirror/build-config/macros';\n\nassert('foo', true);\n\n// After\n(macroCondition(isDevelopingApp()) ? function assert(test) { if (!test) { throw new Error('foo'); } }(true) : {});\n*/\n\n// => _macros.getGlobalConfig().WarpDriveMirror.env.DEBUG\nfunction buildMacroConstDEBUG(types, binding, state) {\n return types.memberExpression(\n types.memberExpression(\n types.memberExpression(\n types.callExpression(state.importer.import(binding, '@embroider/macros', 'getGlobalConfig'), []),\n types.identifier('WarpDriveMirror')\n ),\n types.identifier('env')\n ),\n types.identifier('DEBUG')\n );\n}\n\n// => _macros.macroCondition(_macros.getGlobalConfig().WarpDriveMirror.env.DEBUG)\nfunction buildMacroConditionDEBUG(types, binding, state) {\n return types.callExpression(state.importer.import(binding, '@embroider/macros', 'macroCondition'), [\n buildMacroConstDEBUG(types, binding, state),\n ]);\n}\n\n// (test) => { if (!test) { throw new Error(someMessage); } }(someCond)\nfunction buildAssert(types, originalCallExpression) {\n const desc = originalCallExpression.arguments[0];\n const test = originalCallExpression.arguments[1] ?? types.booleanLiteral(false);\n // prettier-ignore\n return types.callExpression(\n types.arrowFunctionExpression([types.identifier('test')], // (test) =>\n types.blockStatement([ // {\n types.ifStatement( // if\n types.unaryExpression('!', types.identifier('test')), // (!test)\n types.blockStatement([ // {\n types.throwStatement( // throw\n types.newExpression(types.identifier('Error'), [desc]) // new Error(desc)\n )]) // }\n )]) // }\n ),\n [test] // (someCond)\n );\n}\n\n// => ( <debug-macro> ? <assert-exp> : {});\nfunction buildAssertTernary(types, binding, state, originalCallExpression) {\n return types.expressionStatement(\n types.conditionalExpression(\n buildMacroConditionDEBUG(types, binding, state),\n buildAssert(types, originalCallExpression),\n types.objectExpression([])\n )\n );\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === '@warp-drive-mirror/build-config/macros') {\n const specifiers = path.get('specifiers');\n\n specifiers.forEach((specifier) => {\n const name = specifier.node.imported.name;\n if (!Utils.has(name)) {\n throw new Error(`Unexpected import '${name}' imported from '@warp-drive-mirror/build-config/macros'`);\n }\n\n const localBindingName = specifier.node.local.name;\n const binding = specifier.scope.getBinding(localBindingName);\n\n binding.referencePaths.forEach((p) => {\n const originalCallExpression = p.parentPath.node;\n\n if (!t.isCallExpression(originalCallExpression)) {\n throw new Error('Expected a call expression');\n }\n\n const assertTernary = buildAssertTernary(t, binding, state, originalCallExpression);\n p.parentPath.replaceWith(assertTernary);\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["ImportUtil","require","Utils","Set","buildMacroConstDEBUG","types","binding","state","memberExpression","callExpression","importer","import","identifier","buildMacroConditionDEBUG","buildAssert","originalCallExpression","desc","arguments","test","booleanLiteral","arrowFunctionExpression","blockStatement","ifStatement","unaryExpression","throwStatement","newExpression","buildAssertTernary","expressionStatement","conditionalExpression","objectExpression","babel","t","name","visitor","ImportDeclaration","path","importPath","node","source","value","specifiers","get","forEach","specifier","imported","has","Error","localBindingName","local","scope","getBinding","referencePaths","p","parentPath","isCallExpression","assertTernary","replaceWith","removeOwnBinding","remove","length","Program"],"mappings":";;AAAA,MAAM;AAAEA,EAAAA;AAAW,CAAC,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AAEnD,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;;AAEjC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,SAASC,oBAAoBA,CAACC,KAAK,EAAEC,OAAO,EAAEC,KAAK,EAAE;EACnD,OAAOF,KAAK,CAACG,gBAAgB,CAC3BH,KAAK,CAACG,gBAAgB,CACpBH,KAAK,CAACG,gBAAgB,CACpBH,KAAK,CAACI,cAAc,CAACF,KAAK,CAACG,QAAQ,CAACC,MAAM,CAACL,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,EAA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C,YAAAA,OAAO,CAAC6C,cAAc,CAACT,OAAO,CAAEU,CAAC,IAAK;AACpC,cAAA,MAAMrC,sBAAsB,GAAGqC,CAAC,CAACC,UAAU,CAAChB,IAAI;AAEhD,cAAA,IAAI,CAACN,CAAC,CAACuB,gBAAgB,CAACvC,sBAAsB,CAAC,EAAE;AAC/C,gBAAA,MAAM,IAAI+B,KAAK,CAAC,4BAA4B,CAAC;AAC/C;cAEA,MAAMS,aAAa,GAAG7B,kBAAkB,CAACK,CAAC,EAAEzB,OAAO,EAAEC,KAAK,EAAEQ,sBAAsB,CAAC;AACnFqC,cAAAA,CAAC,CAACC,UAAU,CAACG,WAAW,CAACD,aAAa,CAAC;AACzC,aAAC,CAAC;AACFZ,YAAAA,SAAS,CAACM,KAAK,CAACQ,gBAAgB,CAACV,gBAAgB,CAAC;YAClDJ,SAAS,CAACe,MAAM,EAAE;AACpB,WAAC,CAAC;UAEF,IAAIvB,IAAI,CAACM,GAAG,CAAC,YAAY,CAAC,CAACkB,MAAM,KAAK,CAAC,EAAE;YACvCxB,IAAI,CAACuB,MAAM,EAAE;AACf;AACF;OACD;AAEDE,MAAAA,OAAOA,CAACzB,IAAI,EAAE5B,KAAK,EAAE;QACnBA,KAAK,CAACG,QAAQ,GAAG,IAAIV,UAAU,CAAC+B,CAAC,EAAEI,IAAI,CAAC;AAC1C;AACF;GACD;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-transform-deprecations.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-deprecations.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'deprecation-flags',\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p, other) => {\n let negateStatement = false;\n let node = p;\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n const comments =\n node.node.leadingComments ??\n (node.parent.type === 'ConditionalExpression' && node.parent.leadingComments) ??\n [];\n let shouldInlineConfigValue = false;\n if (comments?.length) {\n const lastComment = comments.at(-1);\n if (lastComment.value.trim() === 'inline-macro-config') {\n shouldInlineConfigValue = true;\n }\n }\n\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDriveMirror')\n ),\n t.identifier('deprecations')\n ),\n t.identifier(name)\n );\n\n const configExp = negateStatement ? t.unaryExpression('!', getConfig) : getConfig;\n const replaceExp = shouldInlineConfigValue\n ? // if (DEPRECATE_FOO)\n // =>\n // if (getGlobalConfig('WarpDriveMirror').deprecations.FOO)\n configExp\n : // if (DEPRECATE_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDriveMirror').deprecations.FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [configExp]);\n node.replaceWith(replaceExp);\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","other","negateStatement","parentPath","comments","leadingComments","shouldInlineConfigValue","length","lastComment","at","trim","getConfig","memberExpression","callExpression","importer","import","identifier","configExp","unaryExpression","replaceExp","replaceWith","removeOwnBinding","remove","Program","ImportUtil"],"mappings":";;;;AAEA,SAASA,aAAaA,CAACC,IAAI,EAAE;AAC3B,EAAA,IAAIA,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,iBAAiB,IAAIF,IAAI,CAACC,MAAM,CAACE,QAAQ,KAAK,GAAG,EAAE;AAC1E,IAAA,OAAO,IAAI
|
|
1
|
+
{"version":3,"file":"babel-plugin-transform-deprecations.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-deprecations.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'deprecation-flags',\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p, other) => {\n let negateStatement = false;\n let node = p;\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n const comments =\n node.node.leadingComments ??\n (node.parent.type === 'ConditionalExpression' && node.parent.leadingComments) ??\n [];\n let shouldInlineConfigValue = false;\n if (comments?.length) {\n const lastComment = comments.at(-1);\n if (lastComment.value.trim() === 'inline-macro-config') {\n shouldInlineConfigValue = true;\n }\n }\n\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDriveMirror')\n ),\n t.identifier('deprecations')\n ),\n t.identifier(name)\n );\n\n const configExp = negateStatement ? t.unaryExpression('!', getConfig) : getConfig;\n const replaceExp = shouldInlineConfigValue\n ? // if (DEPRECATE_FOO)\n // =>\n // if (getGlobalConfig('WarpDriveMirror').deprecations.FOO)\n configExp\n : // if (DEPRECATE_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDriveMirror').deprecations.FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [configExp]);\n node.replaceWith(replaceExp);\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","other","negateStatement","parentPath","comments","leadingComments","shouldInlineConfigValue","length","lastComment","at","trim","getConfig","memberExpression","callExpression","importer","import","identifier","configExp","unaryExpression","replaceExp","replaceWith","removeOwnBinding","remove","Program","ImportUtil"],"mappings":";;;;AAEA,SAASA,aAAaA,CAACC,IAAI,EAAE;AAC3B,EAAA,IAAIA,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,iBAAiB,IAAIF,IAAI,CAACC,MAAM,CAACE,QAAQ,KAAK,GAAG,EAAE;AAC1E,IAAA,OAAO,IAAI;AACb;AACA,EAAA,OAAO,KAAK;AACd;AAEe,yCAAA,EAAUC,KAAK,EAAE;EAC9B,MAAM;AAAEC,IAAAA,KAAK,EAAEC;AAAE,GAAC,GAAGF,KAAK;EAE1B,OAAO;AACLG,IAAAA,IAAI,EAAE,mBAAmB;AACzBC,IAAAA,OAAO,EAAE;AACPC,MAAAA,iBAAiBA,CAACC,IAAI,EAAEC,KAAK,EAAE;QAC7B,MAAMC,UAAU,GAAGF,IAAI,CAACV,IAAI,CAACa,MAAM,CAACC,KAAK;AAEzC,QAAA,IAAIF,UAAU,KAAKD,KAAK,CAAC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,CAAC/C,CAAC,EAAEI,IAAI,CAAC;AAC1C;AACF;GACD;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-transform-features.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-features.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\nimport fs from 'fs';\n\nconst pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));\nconst version = pkg.version;\n\nconst isCanary = version.includes('alpha');\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p) => {\n let negateStatement = false;\n let node = p;\n if (!isCanary) {\n p.replaceWith(t.boolean(state.opts.flags[name]));\n return;\n }\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDriveMirror')\n ),\n t.identifier('features')\n ),\n t.identifier(name)\n );\n node.replaceWith(\n // if (LOG_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDriveMirror').debug.LOG_FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [\n negateStatement ? t.unaryExpression('!', getConfig) : getConfig,\n ])\n );\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["pkg","JSON","parse","fs","readFileSync","version","isCanary","includes","parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","negateStatement","replaceWith","boolean","parentPath","getConfig","memberExpression","callExpression","importer","import","identifier","unaryExpression","removeOwnBinding","remove","length","Program","ImportUtil"],"mappings":";;;;;;AAGA,MAAMA,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACC,EAAE,CAACC,YAAY,CAAC,IAAA,GAAA,CAAA,iBAAA,EAAA,qRAAA,CAA2C,EAAE,OAAO,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"babel-plugin-transform-features.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-features.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\nimport fs from 'fs';\n\nconst pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));\nconst version = pkg.version;\n\nconst isCanary = version.includes('alpha');\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p) => {\n let negateStatement = false;\n let node = p;\n if (!isCanary) {\n p.replaceWith(t.boolean(state.opts.flags[name]));\n return;\n }\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDriveMirror')\n ),\n t.identifier('features')\n ),\n t.identifier(name)\n );\n node.replaceWith(\n // if (LOG_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDriveMirror').debug.LOG_FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [\n negateStatement ? t.unaryExpression('!', getConfig) : getConfig,\n ])\n );\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["pkg","JSON","parse","fs","readFileSync","version","isCanary","includes","parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","negateStatement","replaceWith","boolean","parentPath","getConfig","memberExpression","callExpression","importer","import","identifier","unaryExpression","removeOwnBinding","remove","length","Program","ImportUtil"],"mappings":";;;;;;AAGA,MAAMA,GAAG,GAAGC,IAAI,CAACC,KAAK,CAACC,EAAE,CAACC,YAAY,CAAC,IAAA,GAAA,CAAA,iBAAA,EAAA,qRAAA,CAA2C,EAAE,OAAO,CAAC,CAAC;AAC7F,MAAMC,OAAO,GAAGL,GAAG,CAACK,OAAO;AAE3B,MAAMC,QAAQ,GAAGD,OAAO,CAACE,QAAQ,CAAC,OAAO,CAAC;AAE1C,SAASC,aAAaA,CAACC,IAAI,EAAE;AAC3B,EAAA,IAAIA,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,iBAAiB,IAAIF,IAAI,CAACC,MAAM,CAACE,QAAQ,KAAK,GAAG,EAAE;AAC1E,IAAA,OAAO,IAAI;AACb;AACA,EAAA,OAAO,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,CAAC;AAC1C;AACF;GACD;AACH;;;;"}
|
|
@@ -27,6 +27,8 @@ function babelPluginTransformLogging (babel) {
|
|
|
27
27
|
}
|
|
28
28
|
let localBindingName = specifier.node.local.name;
|
|
29
29
|
let binding = specifier.scope.getBinding(localBindingName);
|
|
30
|
+
const enableRuntimeActivation = Boolean(state.opts.runtimeKey);
|
|
31
|
+
const strippableKey = enableRuntimeActivation ? state.opts.runtimeKey : state.opts.configKey;
|
|
30
32
|
binding.referencePaths.forEach(p => {
|
|
31
33
|
let negateStatement = false;
|
|
32
34
|
let node = p;
|
|
@@ -34,12 +36,53 @@ function babelPluginTransformLogging (babel) {
|
|
|
34
36
|
negateStatement = true;
|
|
35
37
|
node = p.parentPath;
|
|
36
38
|
}
|
|
37
|
-
let getConfig = t.memberExpression(t.memberExpression(t.memberExpression(t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []), t.identifier('WarpDriveMirror')), t.identifier(
|
|
39
|
+
let getConfig = t.memberExpression(t.memberExpression(t.memberExpression(t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []), t.identifier('WarpDriveMirror')), t.identifier(strippableKey)), t.identifier(name));
|
|
38
40
|
node.replaceWith(
|
|
39
|
-
// if (LOG_FOO)
|
|
41
|
+
// if (LOG_FOO) {
|
|
42
|
+
// // ...
|
|
43
|
+
// }
|
|
40
44
|
// =>
|
|
41
|
-
// if (macroCondition(getGlobalConfig('WarpDriveMirror').debug.LOG_FOO))
|
|
45
|
+
// if (macroCondition(getGlobalConfig('WarpDriveMirror').debug.LOG_FOO)) {
|
|
46
|
+
// // ...
|
|
47
|
+
// }
|
|
42
48
|
t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [negateStatement ? t.unaryExpression('!', getConfig) : getConfig]));
|
|
49
|
+
if (enableRuntimeActivation) {
|
|
50
|
+
// we do not yet support arbitrary runtime activation locations,
|
|
51
|
+
// the only supported locations are `if (LOG)` style statements, no
|
|
52
|
+
// ternaries or other more complex expressions
|
|
53
|
+
const parentIfStatement = node.parentPath.type === 'IfStatement' ? node.parentPath : null;
|
|
54
|
+
if (!parentIfStatement) {
|
|
55
|
+
throw new Error(`Runtime activation of logging flags is only supported in if statements, but found node '${node.parentPath.type}'`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// if (LOG_FOO) {
|
|
59
|
+
// // ...
|
|
60
|
+
// }
|
|
61
|
+
// =>
|
|
62
|
+
// if (macroCondition(getGlobalConfig('WarpDriveMirror').activeLogging.LOG_FOO)) {
|
|
63
|
+
// if (getGlobalConfig('WarpDriveMirror').debug.LOG_FOO || globalThis.getWarpDriveRuntimeConfig().debug.LOG_FOO) {
|
|
64
|
+
// // ...
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
//
|
|
68
|
+
// the outer-if is generated by the node-replace above. The inner if is generated here.
|
|
69
|
+
const originalBody = parentIfStatement.node.consequent;
|
|
70
|
+
|
|
71
|
+
// getGlobalConfig('WarpDriveMirror').debug.LOG_FOO
|
|
72
|
+
const getActualConfig = t.memberExpression(t.memberExpression(t.memberExpression(t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []), t.identifier('WarpDriveMirror')), t.identifier(state.opts.configKey)), t.identifier(name));
|
|
73
|
+
|
|
74
|
+
// globalThis.getWarpDriveRuntimeConfig().debug.LOG_FOO
|
|
75
|
+
const getRuntimeConfig = t.memberExpression(t.memberExpression(t.callExpression(t.memberExpression(t.identifier('globalThis'), t.identifier('getWarpDriveRuntimeConfig')), []), t.identifier(state.opts.configKey)), t.identifier(name));
|
|
76
|
+
|
|
77
|
+
// <getActualConfig> || <getRuntimeConfig>
|
|
78
|
+
const ifExp = t.logicalExpression('||', getActualConfig, getRuntimeConfig);
|
|
79
|
+
|
|
80
|
+
// if (<negateStatement>(<getActualConfig> || <getRuntimeConfig>)) <originalBody>
|
|
81
|
+
const innerIfStatement = t.ifStatement(negateStatement ? t.unaryExpression('!', ifExp) : ifExp, originalBody);
|
|
82
|
+
|
|
83
|
+
// replace the original body with the new if statement
|
|
84
|
+
parentIfStatement.node.consequent = t.blockStatement([innerIfStatement]);
|
|
85
|
+
}
|
|
43
86
|
});
|
|
44
87
|
specifier.scope.removeOwnBinding(localBindingName);
|
|
45
88
|
specifier.remove();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-transform-logging.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-logging.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n binding.referencePaths.forEach((p) => {\n let negateStatement = false;\n let node = p;\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDriveMirror')\n ),\n t.identifier(state.opts.configKey)\n ),\n t.identifier(name)\n );\n node.replaceWith(\n // if (LOG_FOO)\n // =>\n // if (macroCondition(getGlobalConfig('WarpDriveMirror').debug.LOG_FOO))\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [\n negateStatement ? t.unaryExpression('!', getConfig) : getConfig,\n ])\n );\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","referencePaths","p","negateStatement","parentPath","getConfig","memberExpression","callExpression","importer","import","identifier","configKey","replaceWith","unaryExpression","removeOwnBinding","remove","length","Program","ImportUtil"],"mappings":";;;;AAEA,SAASA,aAAaA,CAACC,IAAI,EAAE;AAC3B,EAAA,IAAIA,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,iBAAiB,IAAIF,IAAI,CAACC,MAAM,CAACE,QAAQ,KAAK,GAAG,EAAE;AAC1E,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AACA,EAAA,OAAO,KAAK,CAAA;AACd,CAAA;AAEe,oCAAA,EAAUC,KAAK,EAAE;EAC9B,MAAM;AAAEC,IAAAA,KAAK,EAAEC,CAAAA;AAAE,GAAC,GAAGF,KAAK,CAAA;EAE1B,OAAO;AACLG,IAAAA,IAAI,EAAE,eAAe;AAAE;AACvBC,IAAAA,OAAO,EAAE;AACPC,MAAAA,iBAAiBA,CAACC,IAAI,EAAEC,KAAK,EAAE;QAC7B,MAAMC,UAAU,GAAGF,IAAI,CAACV,IAAI,CAACa,MAAM,CAACC,KAAK,CAAA;AAEzC,QAAA,IAAIF,UAAU,KAAKD,KAAK,CAACI,IAAI,CAACF,MAAM,EAAE;AACpC,UAAA,MAAMG,UAAU,GAAGN,IAAI,CAACO,GAAG,CAAC,YAAY,CAAC,CAAA;AACzCD,UAAAA,UAAU,CAACE,OAAO,CAAEC,SAAS,IAAK;YAChC,IAAIZ,IAAI,GAAGY,SAAS,CAACnB,IAAI,CAACoB,QAAQ,CAACb,IAAI,CAAA;YACvC,IAAI,EAAEA,IAAI,IAAII,KAAK,CAACI,IAAI,CAACM,KAAK,CAAC,EAAE;AAC/B,cAAA,MAAM,IAAIC,KAAK,CAAC,CAAA,g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CAAC,GAAG,EAAER,SAAS,CAAC,GAAGA,SAAS,CAChE,CACH,CAAC,CAAA;AACH,aAAC,CAAC,CAAA;AACFb,YAAAA,SAAS,CAACO,KAAK,CAACe,gBAAgB,CAAClB,gBAAgB,CAAC,CAAA;YAClDJ,SAAS,CAACuB,MAAM,EAAE,CAAA;AACpB,WAAC,CAAC,CAAA;UACF,IAAIhC,IAAI,CAACO,GAAG,CAAC,YAAY,CAAC,CAAC0B,MAAM,KAAK,CAAC,EAAE;YACvCjC,IAAI,CAACgC,MAAM,EAAE,CAAA;AACf,WAAA;AACF,SAAA;OACD;AAEDE,MAAAA,OAAOA,CAAClC,IAAI,EAAEC,KAAK,EAAE;QACnBA,KAAK,CAACwB,QAAQ,GAAG,IAAIU,0BAAU,CAACvC,CAAC,EAAEI,IAAI,CAAC,CAAA;AAC1C,OAAA;AACF,KAAA;GACD,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"babel-plugin-transform-logging.cjs","sources":["../cjs-src/transforms/babel-plugin-transform-logging.js"],"sourcesContent":["import { ImportUtil } from 'babel-import-util';\n\nfunction parentIsUnary(node) {\n if (node.parent.type === 'UnaryExpression' && node.parent.operator === '!') {\n return true;\n }\n return false;\n}\n\nexport default function (babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n ImportDeclaration(path, state) {\n const importPath = path.node.source.value;\n\n if (importPath === state.opts.source) {\n const specifiers = path.get('specifiers');\n specifiers.forEach((specifier) => {\n let name = specifier.node.imported.name;\n if (!(name in state.opts.flags)) {\n throw new Error(`Unexpected flag ${name} imported from ${state.opts.source}`);\n }\n let localBindingName = specifier.node.local.name;\n let binding = specifier.scope.getBinding(localBindingName);\n const enableRuntimeActivation = Boolean(state.opts.runtimeKey);\n const strippableKey = enableRuntimeActivation ? state.opts.runtimeKey : state.opts.configKey;\n\n binding.referencePaths.forEach((p) => {\n let negateStatement = false;\n let node = p;\n if (parentIsUnary(p)) {\n negateStatement = true;\n node = p.parentPath;\n }\n let getConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDriveMirror')\n ),\n t.identifier(strippableKey)\n ),\n t.identifier(name)\n );\n\n node.replaceWith(\n // if (LOG_FOO) {\n // // ...\n // }\n // =>\n // if (macroCondition(getGlobalConfig('WarpDriveMirror').debug.LOG_FOO)) {\n // // ...\n // }\n t.callExpression(state.importer.import(p, '@embroider/macros', 'macroCondition'), [\n negateStatement ? t.unaryExpression('!', getConfig) : getConfig,\n ])\n );\n\n if (enableRuntimeActivation) {\n // we do not yet support arbitrary runtime activation locations,\n // the only supported locations are `if (LOG)` style statements, no\n // ternaries or other more complex expressions\n const parentIfStatement = node.parentPath.type === 'IfStatement' ? node.parentPath : null;\n if (!parentIfStatement) {\n throw new Error(\n `Runtime activation of logging flags is only supported in if statements, but found node '${node.parentPath.type}'`\n );\n }\n\n // if (LOG_FOO) {\n // // ...\n // }\n // =>\n // if (macroCondition(getGlobalConfig('WarpDriveMirror').activeLogging.LOG_FOO)) {\n // if (getGlobalConfig('WarpDriveMirror').debug.LOG_FOO || globalThis.getWarpDriveRuntimeConfig().debug.LOG_FOO) {\n // // ...\n // }\n // }\n //\n // the outer-if is generated by the node-replace above. The inner if is generated here.\n const originalBody = parentIfStatement.node.consequent;\n\n // getGlobalConfig('WarpDriveMirror').debug.LOG_FOO\n const getActualConfig = t.memberExpression(\n t.memberExpression(\n t.memberExpression(\n t.callExpression(state.importer.import(p, '@embroider/macros', 'getGlobalConfig'), []),\n t.identifier('WarpDriveMirror')\n ),\n t.identifier(state.opts.configKey)\n ),\n t.identifier(name)\n );\n\n // globalThis.getWarpDriveRuntimeConfig().debug.LOG_FOO\n const getRuntimeConfig = t.memberExpression(\n t.memberExpression(\n t.callExpression(\n t.memberExpression(t.identifier('globalThis'), t.identifier('getWarpDriveRuntimeConfig')),\n []\n ),\n t.identifier(state.opts.configKey)\n ),\n t.identifier(name)\n );\n\n // <getActualConfig> || <getRuntimeConfig>\n const ifExp = t.logicalExpression('||', getActualConfig, getRuntimeConfig);\n\n // if (<negateStatement>(<getActualConfig> || <getRuntimeConfig>)) <originalBody>\n const innerIfStatement = t.ifStatement(\n negateStatement ? t.unaryExpression('!', ifExp) : ifExp,\n originalBody\n );\n\n // replace the original body with the new if statement\n parentIfStatement.node.consequent = t.blockStatement([innerIfStatement]);\n } else {\n }\n });\n specifier.scope.removeOwnBinding(localBindingName);\n specifier.remove();\n });\n if (path.get('specifiers').length === 0) {\n path.remove();\n }\n }\n },\n\n Program(path, state) {\n state.importer = new ImportUtil(t, path);\n },\n },\n };\n}\n"],"names":["parentIsUnary","node","parent","type","operator","babel","types","t","name","visitor","ImportDeclaration","path","state","importPath","source","value","opts","specifiers","get","forEach","specifier","imported","flags","Error","localBindingName","local","binding","scope","getBinding","enableRuntimeActivation","Boolean","runtimeKey","strippableKey","configKey","referencePaths","p","negateStatement","parentPath","getConfig","memberExpression","callExpression","importer","import","identifier","replaceWith","unaryExpression","parentIfStatement","originalBody","consequent","getActualConfig","getRuntimeConfig","ifExp","logicalExpression","innerIfStatement","ifStatement","blockStatement","removeOwnBinding","remove","length","Program","ImportUtil"],"mappings":";;;;AAEA,SAASA,aAAaA,CAACC,IAAI,EAAE;AAC3B,EAAA,IAAIA,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,iBAAiB,IAAIF,IAAI,CAACC,MAAM,CAACE,QAAQ,KAAK,GAAG,EAAE;AAC1E,IAAA,OAAO,IAAI;AACb;AACA,EAAA,OAAO,KAAK;AACd;AAEe,oCAAA,EAAUC,KAAK,EAAE;EAC9B,MAAM;AAAEC,IAAAA,KAAK,EAAEC;AAAE,GAAC,GAAGF,KAAK;EAE1B,OAAO;AACLG,IAAAA,IAAI,EAAE,eAAe;AAAE;AACvBC,IAAAA,OAAO,EAAE;AACPC,MAAAA,iBAAiBA,CAACC,IAAI,EAAEC,KAAK,EAAE;QAC7B,MAA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G,CAAC,YAAY,CAAC,CAACwC,MAAM,KAAK,CAAC,EAAE;YACvC/C,IAAI,CAAC8C,MAAM,EAAE;AACf;AACF;OACD;AAEDE,MAAAA,OAAOA,CAAChD,IAAI,EAAEC,KAAK,EAAE;QACnBA,KAAK,CAAC6B,QAAQ,GAAG,IAAImB,0BAAU,CAACrD,CAAC,EAAEI,IAAI,CAAC;AAC1C;AACF;GACD;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canary-features-BzGSGY5j.js","sources":["../src/canary-features.ts"],"sourcesContent":["/**\n * ## Canary Features\n *\n * EmberData allows users to test features that are implemented but not yet\n * available even in canary.\n *\n * Typically these features represent work that might introduce a new concept,\n * new API, change an API, or risk an unintended change in behavior to consuming\n * applications.\n *\n * Such features have their implementations guarded by a \"feature flag\", and the\n * flag is only activated once the core-data team is prepared to ship the work\n * in a canary release.\n *\n * ### Installing Canary\n *\n * To test a feature you MUST be using a canary build. Canary builds are published\n * to `npm` and can be installed using a precise tag (such as `ember-data@3.16.0-alpha.1`)\n * or by installing the latest dist-tag published to the `canary` channel using your javascript\n * package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n ```cli\n pnpm add ember-data@canary\n ```\n *\n * ### Activating a Canary Feature\n *\n * Once you have installed canary, feature-flags can be activated at build-time\n *\n * by setting an environment variable:\n *\n * ```cli\n * # Activate a single flag\n * EMBER_DATA_FEATURE_OVERRIDE=SOME_FLAG ember build\n *\n * # Activate multiple flags by separating with commas\n * EMBER_DATA_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build\n *\n * # Activate all flags\n * EMBER_DATA_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build\n * ```\n *\n * or by setting the appropriate flag in your `ember-cli-build` file:\n *\n * ```ts\n * let app = new EmberApp(defaults, {\n * emberData: {\n * features: {\n * SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature\n * OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior\n * }\n * }\n * })\n * ```\n *\n * **The \"off\" branch of feature-flagged code is always stripped from production builds.**\n *\n * The list of available feature-flags is located [here](https://github.com/emberjs/data/tree/main/packages/build-config/src/virtual/canary-features.ts \"List of EmberData FeatureFlags\")\n *\n *\n * ### Preparing a Project to use a Canary Feature\n *\n * For most projects, simple version detection should be enough.\n * Using the provided version compatibility helpers from [embroider-macros](https://github.com/embroider-build/embroider/tree/main/packages/macros#readme)\n * the following can be done:\n *\n * ```js\n * if (macroCondition(dependencySatisfies('@ember-data-mirror/store', '5.0'))) {\n * // do thing\n * }\n * ```\n *\n @module @warp-drive-mirror/build-config/canary-features\n @main @warp-drive-mirror/build-config/canary-features\n */\n/**\n This is the current list of features used at build time for canary releases.\n If empty there are no features currently gated by feature flags.\n\n The valid values are:\n\n - `true` | The feature is **enabled** at all times, and cannot be disabled.\n - `false` | The feature is **disabled** at all times, and cannot be enabled.\n - `null` | The feature is **disabled by default**, but can be enabled via configuration.\n\n @class CanaryFeatureFlags\n @public\n*/\nexport const SAMPLE_FEATURE_FLAG: boolean | null = null;\n"],"names":["SAMPLE_FEATURE_FLAG"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":"canary-features-BzGSGY5j.js","sources":["../src/canary-features.ts"],"sourcesContent":["/**\n * ## Canary Features\n *\n * EmberData allows users to test features that are implemented but not yet\n * available even in canary.\n *\n * Typically these features represent work that might introduce a new concept,\n * new API, change an API, or risk an unintended change in behavior to consuming\n * applications.\n *\n * Such features have their implementations guarded by a \"feature flag\", and the\n * flag is only activated once the core-data team is prepared to ship the work\n * in a canary release.\n *\n * ### Installing Canary\n *\n * To test a feature you MUST be using a canary build. Canary builds are published\n * to `npm` and can be installed using a precise tag (such as `ember-data@3.16.0-alpha.1`)\n * or by installing the latest dist-tag published to the `canary` channel using your javascript\n * package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n ```cli\n pnpm add ember-data@canary\n ```\n *\n * ### Activating a Canary Feature\n *\n * Once you have installed canary, feature-flags can be activated at build-time\n *\n * by setting an environment variable:\n *\n * ```cli\n * # Activate a single flag\n * EMBER_DATA_FEATURE_OVERRIDE=SOME_FLAG ember build\n *\n * # Activate multiple flags by separating with commas\n * EMBER_DATA_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build\n *\n * # Activate all flags\n * EMBER_DATA_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build\n * ```\n *\n * or by setting the appropriate flag in your `ember-cli-build` file:\n *\n * ```ts\n * let app = new EmberApp(defaults, {\n * emberData: {\n * features: {\n * SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature\n * OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior\n * }\n * }\n * })\n * ```\n *\n * **The \"off\" branch of feature-flagged code is always stripped from production builds.**\n *\n * The list of available feature-flags is located [here](https://github.com/emberjs/data/tree/main/packages/build-config/src/virtual/canary-features.ts \"List of EmberData FeatureFlags\")\n *\n *\n * ### Preparing a Project to use a Canary Feature\n *\n * For most projects, simple version detection should be enough.\n * Using the provided version compatibility helpers from [embroider-macros](https://github.com/embroider-build/embroider/tree/main/packages/macros#readme)\n * the following can be done:\n *\n * ```js\n * if (macroCondition(dependencySatisfies('@ember-data-mirror/store', '5.0'))) {\n * // do thing\n * }\n * ```\n *\n @module @warp-drive-mirror/build-config/canary-features\n @main @warp-drive-mirror/build-config/canary-features\n */\n/**\n This is the current list of features used at build time for canary releases.\n If empty there are no features currently gated by feature flags.\n\n The valid values are:\n\n - `true` | The feature is **enabled** at all times, and cannot be disabled.\n - `false` | The feature is **disabled** at all times, and cannot be enabled.\n - `null` | The feature is **disabled by default**, but can be enabled via configuration.\n\n @class CanaryFeatureFlags\n @public\n*/\nexport const SAMPLE_FEATURE_FLAG: boolean | null = null;\n"],"names":["SAMPLE_FEATURE_FLAG"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,mBAAmC,GAAG;;;;;;;;;"}
|
package/dist/cjs-set-config.cjs
CHANGED
|
@@ -824,20 +824,64 @@ const LOG_GRAPH = false;
|
|
|
824
824
|
* @public
|
|
825
825
|
*/
|
|
826
826
|
const LOG_INSTANCE_CACHE = false;
|
|
827
|
+
/**
|
|
828
|
+
* Log key count metrics, useful for performance
|
|
829
|
+
* debugging.
|
|
830
|
+
*
|
|
831
|
+
* @property {boolean} LOG_METRIC_COUNTS
|
|
832
|
+
* @public
|
|
833
|
+
*/
|
|
834
|
+
const LOG_METRIC_COUNTS = false;
|
|
835
|
+
/**
|
|
836
|
+
* Helps when debugging causes of a change notification
|
|
837
|
+
* when processing an update to a hasMany relationship.
|
|
838
|
+
*
|
|
839
|
+
* @property {boolean} DEBUG_RELATIONSHIP_NOTIFICATIONS
|
|
840
|
+
* @public
|
|
841
|
+
*/
|
|
842
|
+
const DEBUG_RELATIONSHIP_NOTIFICATIONS = false;
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* A private flag to enable logging of the native Map/Set
|
|
846
|
+
* constructor and method calls.
|
|
847
|
+
*
|
|
848
|
+
* EXTREMELY MALPERFORMANT
|
|
849
|
+
*
|
|
850
|
+
* LOG_METRIC_COUNTS must also be enabled.
|
|
851
|
+
*
|
|
852
|
+
* @typedoc
|
|
853
|
+
*/
|
|
854
|
+
const __INTERNAL_LOG_NATIVE_MAP_SET_COUNTS = false;
|
|
827
855
|
|
|
828
856
|
const LOGGING = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
829
857
|
__proto__: null,
|
|
858
|
+
DEBUG_RELATIONSHIP_NOTIFICATIONS,
|
|
830
859
|
LOG_GRAPH,
|
|
831
860
|
LOG_IDENTIFIERS,
|
|
832
861
|
LOG_INSTANCE_CACHE,
|
|
862
|
+
LOG_METRIC_COUNTS,
|
|
833
863
|
LOG_MUTATIONS,
|
|
834
864
|
LOG_NOTIFICATIONS,
|
|
835
865
|
LOG_OPERATIONS,
|
|
836
866
|
LOG_PAYLOADS,
|
|
837
867
|
LOG_REQUESTS,
|
|
838
|
-
LOG_REQUEST_STATUS
|
|
868
|
+
LOG_REQUEST_STATUS,
|
|
869
|
+
__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS
|
|
839
870
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
840
871
|
|
|
872
|
+
function createLoggingConfig(env, debug) {
|
|
873
|
+
const config = {};
|
|
874
|
+
const keys = Object.keys(LOGGING);
|
|
875
|
+
for (const key of keys) {
|
|
876
|
+
if (env.DEBUG || env.TESTING) {
|
|
877
|
+
config[key] = true;
|
|
878
|
+
} else {
|
|
879
|
+
config[key] = debug[key] || false;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return config;
|
|
883
|
+
}
|
|
884
|
+
|
|
841
885
|
const _MacrosConfig = EmbroiderMacros.MacrosConfig;
|
|
842
886
|
function recastMacrosConfig(macros) {
|
|
843
887
|
if (!('globalConfig' in macros)) {
|
|
@@ -886,6 +930,7 @@ function setConfig(context, appRoot, config) {
|
|
|
886
930
|
compatWith: config.compatWith ?? null,
|
|
887
931
|
deprecations: DEPRECATIONS,
|
|
888
932
|
features: FEATURES,
|
|
933
|
+
activeLogging: createLoggingConfig(env, debugOptions),
|
|
889
934
|
env
|
|
890
935
|
};
|
|
891
936
|
macros.setGlobalConfig(undefined, 'WarpDriveMirror', finalizedConfig);
|