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

chore: Deprecating cds.lazify #260

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 2 additions & 25 deletions apis/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,11 @@ export function extend<T> (target: T): {
}

/**
* Equip a given facade object with getters for lazy-loading modules instead
* of static requires. Example:
*
* @example
* ```js
* const facade = lazify ({
* sub: lazy => require ('./sub-module')
* })
* ```
*
* The first usage of `facade.sub` will load the sub module
* using standard Node.js's `module.require` functions.
* @deprecated since version 8.1
*/
export function lazify<T> (target: T): T

/**
* Prepare a node module for lazy-loading submodules instead
* of static requires. Example:
*
* @example
* ```js
* require = lazify (module) //> turns require into a lazy one
* const facade = module.exports = {
* sub: require ('./sub-module')
* })
* ```
*
* The first usage of `facade.sub` will load the sub module
* using standard Node.js's `module.require` functions.
* @deprecated since version 8.1
*/
export function lazified<T> (target: T): T
6 changes: 0 additions & 6 deletions test/typescript/apis/project/cds-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ const x = cds.extend({ a: 42 }).with({ b: 'hello world' })
const a: number = x.a
const b: string = x.b

const l1 = cds.lazify({x: 42})
l1.x

const l2 = cds.lazified({x: 42})
l2.x

const e: cds.entity = new cds.entity
e.drafts
cds.entity === cds.builtin.classes.entity
Expand Down
4 changes: 1 addition & 3 deletions test/typescript/runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('runtime tests', () => {
let foo = cds.extend({foo:1}).with({bar:2},{car:3})
foo.foo
foo.bar

// FIXME: broke after 0.6.3 in CI, but works locally, renable asap
//cds.model = cds.linked({})
{
Expand Down Expand Up @@ -159,8 +159,6 @@ describe('runtime tests', () => {
test,
log,
debug,
lazify,
lazified,
// clone,
exit,

Expand Down