-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: @ember-data/store as v2-lite addon (#8285)
* feat: @ember-data/store as v2-lite addon * fix config * fix build path * fix lint and docs * fix configs * cleanup * fix lint * fix deps * make some small size optimizations
- Loading branch information
Showing
61 changed files
with
417 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const pkg = require('../package.json'); | ||
|
||
// eslint-disable-next-line import/order | ||
const requireModule = require('./utilities/require-module'); | ||
|
||
const debugFlags = requireModule('@ember-data/private-build-infra/addon/debugging.ts'); | ||
const deprecationFlags = requireModule('@ember-data/private-build-infra/addon/current-deprecations.ts'); | ||
const featureFlags = requireModule('@ember-data/canary-features/addon/default-features.ts'); | ||
|
||
const isCanary = pkg.version.includes('alpha'); | ||
|
||
const features = {}; | ||
Object.keys(featureFlags).forEach((flag) => { | ||
if (isCanary) { | ||
features[flag] = featureFlags[flag]; | ||
} else { | ||
const value = featureFlags[flag]; | ||
|
||
if (value === null) { | ||
features[flag] = false; | ||
} else { | ||
features[flag] = value; | ||
} | ||
} | ||
}); | ||
|
||
const config = { | ||
debug: Object.assign({}, debugFlags.default), | ||
deprecations: Object.assign({}, deprecationFlags.default), | ||
features, | ||
}; | ||
|
||
const plugins = require('./debug-macros')(config); | ||
|
||
module.exports = plugins; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"plugins": [ | ||
"@babel/plugin-transform-runtime", | ||
["@babel/plugin-transform-runtime", { "loose": true }], | ||
["@babel/plugin-transform-typescript", { "allowDeclareFields": true }], | ||
["@babel/plugin-proposal-decorators", { "legacy": true }], | ||
"@babel/plugin-proposal-class-properties" | ||
["@babel/plugin-proposal-decorators", { "legacy": true, "loose": true }], | ||
["@babel/plugin-proposal-class-properties", { "loose": true }] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
const pkg = require('./package.json'); | ||
|
||
module.exports = { | ||
name: pkg.name, | ||
|
||
options: { | ||
'@embroider/macros': { | ||
setOwnConfig: {}, | ||
}, | ||
}, | ||
|
||
_emberDataConfig: null, | ||
configureEmberData() { | ||
if (this._emberDataConfig) { | ||
return this._emberDataConfig; | ||
} | ||
const app = this._findHost(); | ||
const isProd = /production/.test(process.env.EMBER_ENV); | ||
const hostOptions = app.options?.emberData || {}; | ||
const debugOptions = Object.assign( | ||
{ | ||
LOG_PAYLOADS: false, | ||
LOG_OPERATIONS: false, | ||
LOG_MUTATIONS: false, | ||
LOG_NOTIFICATIONS: false, | ||
LOG_REQUEST_STATUS: false, | ||
LOG_IDENTIFIERS: false, | ||
LOG_GRAPH: false, | ||
LOG_INSTANCE_CACHE: false, | ||
}, | ||
hostOptions.debug || {} | ||
); | ||
let HAS_DEBUG_PACKAGE, HAS_META_PACKAGE; | ||
|
||
try { | ||
// eslint-disable-next-line node/no-missing-require | ||
require.resolve('@ember-data/debug', { paths: [process.cwd(), __dirname] }); | ||
HAS_DEBUG_PACKAGE = true; | ||
} catch { | ||
HAS_DEBUG_PACKAGE = false; | ||
} | ||
try { | ||
// eslint-disable-next-line node/no-missing-require | ||
require.resolve('ember-data', { paths: [process.cwd(), __dirname] }); | ||
HAS_META_PACKAGE = true; | ||
} catch { | ||
HAS_META_PACKAGE = false; | ||
} | ||
const includeDataAdapterInProduction = | ||
typeof hostOptions.includeDataAdapterInProduction === 'boolean' | ||
? hostOptions.includeDataAdapterInProduction | ||
: HAS_META_PACKAGE; | ||
|
||
const includeDataAdapter = HAS_DEBUG_PACKAGE ? (isProd ? includeDataAdapterInProduction : true) : false; | ||
const DEPRECATIONS = require('@ember-data/private-build-infra/src/deprecations')(hostOptions.compatWith || null); | ||
const FEATURES = require('@ember-data/private-build-infra/src/features')(isProd); | ||
|
||
// copy configs forward | ||
const ownConfig = this.options['@embroider/macros'].setOwnConfig; | ||
ownConfig.compatWith = hostOptions.compatWith || null; | ||
ownConfig.debug = debugOptions; | ||
ownConfig.deprecations = Object.assign(DEPRECATIONS, ownConfig.deprecations || {}); | ||
ownConfig.features = Object.assign({}, FEATURES); | ||
ownConfig.includeDataAdapter = includeDataAdapter; | ||
|
||
this._emberDataConfig = ownConfig; | ||
return ownConfig; | ||
}, | ||
|
||
included() { | ||
this.configureEmberData(); | ||
return this._super.included.call(this, ...arguments); | ||
}, | ||
|
||
treeForVendor() { | ||
return; | ||
}, | ||
treeForPublic() { | ||
return; | ||
}, | ||
treeForStyles() { | ||
return; | ||
}, | ||
treeForAddonStyles() { | ||
return; | ||
}, | ||
treeForApp() { | ||
return; | ||
}, | ||
}; |
Oops, something went wrong.