{"id":26891869,"url":"https://github.com/mickeyjsx/babel-plugin-mickey-model-loader","last_synced_at":"2025-03-31T22:41:56.114Z","repository":{"id":98837502,"uuid":"101849763","full_name":"mickeyjsx/babel-plugin-mickey-model-loader","owner":"mickeyjsx","description":"💪 Inject a model loader function into mickey with hmr support.","archived":false,"fork":false,"pushed_at":"2019-11-14T09:50:55.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T06:52:59.722Z","etag":null,"topics":["babel","framework","hmr","hmr-support","mickey","model","plugin","react","redux","saga"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mickeyjsx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-30T07:13:36.000Z","updated_at":"2024-08-21T22:04:19.542Z","dependencies_parsed_at":"2023-03-12T18:45:42.442Z","dependency_job_id":null,"html_url":"https://github.com/mickeyjsx/babel-plugin-mickey-model-loader","commit_stats":{"total_commits":45,"total_committers":3,"mean_commits":15.0,"dds":0.0888888888888889,"last_synced_commit":"684f968d6808acd8e9a13eeef346dbc4baf18237"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickeyjsx%2Fbabel-plugin-mickey-model-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickeyjsx%2Fbabel-plugin-mickey-model-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickeyjsx%2Fbabel-plugin-mickey-model-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mickeyjsx%2Fbabel-plugin-mickey-model-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mickeyjsx","download_url":"https://codeload.github.com/mickeyjsx/babel-plugin-mickey-model-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246552903,"owners_count":20795836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","framework","hmr","hmr-support","mickey","model","plugin","react","redux","saga"],"created_at":"2025-03-31T22:41:55.185Z","updated_at":"2025-03-31T22:41:56.108Z","avatar_url":"https://github.com/mickeyjsx.png","language":"JavaScript","readme":"# babel-plugin-mickey-model-loader\n\n\u003e Inject a model loader function into mickey with hmr support.\n\n[![MIT License](https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square)](https://github.com/mickey/babel-plugin-mickey-model-loader/blob/master/LICENSE)\n\n[![NPM Version](https://img.shields.io/npm/v/babel-plugin-mickey-model-loader.svg?style=flat-square)](https://www.npmjs.com/package/babel-plugin-mickey-model-loader)\n[![Build Status](https://img.shields.io/travis/mickeyjsx/babel-plugin-mickey-model-loader.svg?style=flat)](https://travis-ci.org/mickeyjsx/babel-plugin-mickey-model-loader)\n[![Dependencies](https://david-dm.org/mickey/babel-plugin-mickey-model-loader/status.svg)](https://david-dm.org/mickey/babel-plugin-mickey-model-loader)\n\n## Install\n\n```\nnpm install babel-plugin-mickey-model-loader redbox-react@1.x --save-dev\n```\n\n## Usage\n\nAdd the following section in your `.babelrc`:\n\n```\n{\n  \"plugins\": [\"mickey-model-loader\", { loaderOptions: { directory: './models' } }]\n}\n```\n\nLoad models:\n\n```\nimport React from 'react';\nimport createApp from 'mickey';\nimport SomeComponent from './SomeComponent';\n\nconst app = createApp({\n  historyMode: 'hash',\n});\n\napp.load(); // default load all models from './models'\napp.render(\u003cSomeComponent /\u003e, document.getElementById('root'));\n```\n\n## app.load(pattern)\n\nWith this plugin, a handily method `load(pattern)` will be injected into `app`. \n\nThis method will try to load models matched with `pattern` from `loaderOptions.directory` specified directory (e.g. `./models`). The `pattern` is a glob pattern matched by [minimatch](https://www.npmjs.com/package/minimatch). \n\nFalsely `pattern` will load all models.\n\n## Options\n\n - `disableHmr` Disable any HMR. Default: `false`\n - `disableModelHmr` Disable model HMR. Default: `false`\n - `quiet` Don't output any log. Default: `false`\n - `loaderOptions` Options for `app.loader()` and these options are same as [`require.context(directory, useSubdirectories, regExp)`](https://webpack.github.io/docs/context.html#require-context)\n    - `directory` The directory to match within. Default: `'./models'`\n    - `useSubdirectories` A boolean flag to include or exclude subdirectories. Default: `true`\n    - `regExp` A regular expression to match files against. Default: `/^\\.\\//`\n\nNote: If `process.env.NODE_ENV` is `'production'`, will disable any HMR and do not output any log. This is useful for release building.\n\n\n## Contributing\n\nPull requests and stars are highly welcome.\n\nFor bugs and feature requests, please [create an issue](https://github.com/mickey/babel-plugin-mickey-model-loader/issues/new).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickeyjsx%2Fbabel-plugin-mickey-model-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmickeyjsx%2Fbabel-plugin-mickey-model-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickeyjsx%2Fbabel-plugin-mickey-model-loader/lists"}